22
33namespace Http \Client \Exception ;
44
5- use Psr \Http \Message \ResponseInterface ;
6-
75/**
8- * @author GeLo <geloen.eric @gmail.com>
6+ * @author Márk Sági-Kazár <mark.sagikazar @gmail.com>
97 */
108final class BatchException extends TransferException
119{
@@ -14,16 +12,10 @@ final class BatchException extends TransferException
1412 */
1513 private $ exceptions ;
1614
17- /**
18- * @var ResponseInterface[]
19- */
20- private $ responses ;
21-
2215 /**
2316 * @param TransferException[] $exceptions
24- * @param ResponseInterface[] $responses
2517 */
26- public function __construct (array $ exceptions = [], array $ responses = [] )
18+ public function __construct (array $ exceptions = [])
2719 {
2820 parent ::__construct ('An error occurred when sending multiple requests. ' );
2921
@@ -33,15 +25,7 @@ public function __construct(array $exceptions = [], array $responses = [])
3325 }
3426 }
3527
36- foreach ($ responses as $ response ) {
37- if (!$ response instanceof ResponseInterface) {
38- throw new InvalidArgumentException ('Response is not an instanceof Psr\Http\Message\ResponseInterface ' );
39- }
40- }
41-
42-
4328 $ this ->exceptions = $ exceptions ;
44- $ this ->responses = $ responses ;
4529 }
4630
4731 /**
@@ -75,36 +59,4 @@ public function hasExceptions()
7559 {
7660 return !empty ($ this ->exceptions );
7761 }
78-
79- /**
80- * Returns all responses
81- *
82- * @return ResponseInterface[]
83- */
84- public function getResponses ()
85- {
86- return $ this ->responses ;
87- }
88-
89- /**
90- * Checks if a specific response exists
91- *
92- * @param ResponseInterface $response
93- *
94- * @return boolean
95- */
96- public function hasResponse (ResponseInterface $ response )
97- {
98- return array_search ($ response , $ this ->responses , true ) !== false ;
99- }
100-
101- /**
102- * Checks if any response exists
103- *
104- * @return boolean
105- */
106- public function hasResponses ()
107- {
108- return !empty ($ this ->responses );
109- }
11062}
0 commit comments