File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -11,13 +11,20 @@ class SparkPostException extends \Exception
1111 */
1212 private $ body = null ;
1313
14+ /**
15+ * Array with the request values sent
16+ */
17+ private $ request ;
18+
1419 /**
1520 * Sets up the custom exception and copies over original exception values.
1621 *
1722 * @param Exception $exception - the exception to be wrapped
1823 */
19- public function __construct (\Exception $ exception )
24+ public function __construct (\Exception $ exception, $ request )
2025 {
26+ $ this ->request = $ request ;
27+
2128 $ message = $ exception ->getMessage ();
2229 $ code = $ exception ->getCode ();
2330 if ($ exception instanceof HttpException) {
@@ -29,6 +36,15 @@ public function __construct(\Exception $exception)
2936 parent ::__construct ($ message , $ code , $ exception ->getPrevious ());
3037 }
3138
39+ /**
40+ * Returns the request values sent
41+ *
42+ * @return Array $request
43+ */
44+ public function getRequest () {
45+ return $ this ->request ;
46+ }
47+
3248 /**
3349 * Returns the body.
3450 *
Original file line number Diff line number Diff line change 44
55use Psr \Http \Message \ResponseInterface as ResponseInterface ;
66use Psr \Http \Message \StreamInterface as StreamInterface ;
7+ use Psr \Http \Message \RequestInterface as RequestInterface ;
78
89class SparkPostResponse implements ResponseInterface
910{
@@ -12,14 +13,29 @@ class SparkPostResponse implements ResponseInterface
1213 */
1314 private $ response ;
1415
16+ /**
17+ * Array with the request values sent
18+ */
19+ private $ request ;
20+
1521 /**
1622 * set the response to be wrapped.
1723 *
1824 * @param ResponseInterface $response
1925 */
20- public function __construct (ResponseInterface $ response )
26+ public function __construct (ResponseInterface $ response, $ request )
2127 {
2228 $ this ->response = $ response ;
29+ $ this ->request = $ request ;
30+ }
31+
32+ /**
33+ * Returns the request values sent
34+ *
35+ * @return Array $request
36+ */
37+ public function getRequest () {
38+ return $ this ->request ;
2339 }
2440
2541 /**
You can’t perform that action at this time.
0 commit comments