File tree Expand file tree Collapse file tree 5 files changed +26
-27
lines changed Expand file tree Collapse file tree 5 files changed +26
-27
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,11 @@ final class ResponseFormatSame extends Constraint
25
25
private Request $ request ;
26
26
private ?string $ format ;
27
27
28
- public function __construct (Request $ request , ?string $ format )
29
- {
28
+ public function __construct (
29
+ Request $ request ,
30
+ ?string $ format ,
31
+ private readonly bool $ verbose = true ,
32
+ ) {
30
33
$ this ->request = $ request ;
31
34
$ this ->format = $ format ;
32
35
}
@@ -57,6 +60,6 @@ protected function failureDescription($response): string
57
60
*/
58
61
protected function additionalFailureDescription ($ response ): string
59
62
{
60
- return (string ) $ response ;
63
+ return $ this -> verbose ? (string ) $ response : explode ( "\r\n\r\n" , ( string ) $ response )[ 0 ] ;
61
64
}
62
65
}
Original file line number Diff line number Diff line change @@ -44,12 +44,11 @@ protected function failureDescription($response): string
44
44
return 'the Response ' .$ this ->toString ();
45
45
}
46
46
47
- protected function additionalFailureDescription ($ other ): string
47
+ /**
48
+ * @param Response $response
49
+ */
50
+ protected function additionalFailureDescription ($ response ): string
48
51
{
49
- if ($ this ->verbose || !($ other instanceof Response)) {
50
- return (string ) $ other ;
51
- } else {
52
- return explode ("\r\n\r\n" , (string ) $ other )[0 ];
53
- }
52
+ return $ this ->verbose ? (string ) $ response : explode ("\r\n\r\n" , (string ) $ response )[0 ];
54
53
}
55
54
}
Original file line number Diff line number Diff line change @@ -44,12 +44,11 @@ protected function failureDescription($response): string
44
44
return 'the Response ' .$ this ->toString ();
45
45
}
46
46
47
- protected function additionalFailureDescription ($ other ): string
47
+ /**
48
+ * @param Response $response
49
+ */
50
+ protected function additionalFailureDescription ($ response ): string
48
51
{
49
- if ($ this ->verbose || !($ other instanceof Response)) {
50
- return (string ) $ other ;
51
- } else {
52
- return explode ("\r\n\r\n" , (string ) $ other )[0 ];
53
- }
52
+ return $ this ->verbose ? (string ) $ response : explode ("\r\n\r\n" , (string ) $ response )[0 ];
54
53
}
55
54
}
Original file line number Diff line number Diff line change @@ -44,12 +44,11 @@ protected function failureDescription($other): string
44
44
return 'the Response ' .$ this ->toString ();
45
45
}
46
46
47
- protected function additionalFailureDescription ($ other ): string
47
+ /**
48
+ * @param Response $response
49
+ */
50
+ protected function additionalFailureDescription ($ response ): string
48
51
{
49
- if ($ this ->verbose || !($ other instanceof Response)) {
50
- return (string ) $ other ;
51
- } else {
52
- return explode ("\r\n\r\n" , (string ) $ other )[0 ];
53
- }
52
+ return $ this ->verbose ? (string ) $ response : explode ("\r\n\r\n" , (string ) $ response )[0 ];
54
53
}
55
54
}
Original file line number Diff line number Diff line change @@ -44,12 +44,11 @@ protected function failureDescription($response): string
44
44
return 'the Response ' .$ this ->toString ();
45
45
}
46
46
47
- protected function additionalFailureDescription ($ other ): string
47
+ /**
48
+ * @param Response $response
49
+ */
50
+ protected function additionalFailureDescription ($ response ): string
48
51
{
49
- if ($ this ->verbose || !($ other instanceof Response)) {
50
- return (string ) $ other ;
51
- } else {
52
- return explode ("\r\n\r\n" , (string ) $ other )[0 ];
53
- }
52
+ return $ this ->verbose ? (string ) $ response : explode ("\r\n\r\n" , (string ) $ response )[0 ];
54
53
}
55
54
}
You can’t perform that action at this time.
0 commit comments