1 | <?php |
||
18 | class SessionCheck implements EnvironmentCheck |
||
19 | { |
||
20 | use Configurable; |
||
21 | use Fetcher; |
||
22 | |||
23 | /** |
||
24 | * URL to check |
||
25 | * |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $url; |
||
29 | |||
30 | /** |
||
31 | * Set up check with URL |
||
32 | * |
||
33 | * @param string $url The route, excluding the domain |
||
34 | * @inheritdoc |
||
35 | */ |
||
36 | public function __construct($url = '') |
||
44 | |||
45 | /** |
||
46 | * Check that the response for URL does not create a session |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | public function check(): array |
||
67 | |||
68 | /** |
||
69 | * Get PHPSESSID or SECSESSID cookie set from the response if it exists. |
||
70 | * |
||
71 | * @param ResponseInterface $response |
||
72 | * @return string|null Cookie contents or null if it doesn't exist |
||
73 | */ |
||
74 | public function getCookie(ResponseInterface $response): ?string |
||
86 | } |
||
87 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: