Conditions | 6 |
Paths | 9 |
Total Lines | 23 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
40 | 5 | public function negotiate(ServerRequestInterface $request): bool |
|
41 | { |
||
42 | 5 | if (!$request->hasHeader(self::HEADER)) { |
|
43 | 1 | return false; |
|
44 | } |
||
45 | |||
46 | 4 | $headers = []; |
|
47 | 4 | foreach (explode(',', $request->getHeaderLine(self::HEADER)) as $header) { |
|
48 | 4 | $headers[] = trim($header); |
|
49 | } |
||
50 | |||
51 | 4 | foreach ($headers as $i => $header) { |
|
52 | 4 | foreach ($this->allowHeaders as $allowHeader) { |
|
53 | 4 | if (mb_strtolower($allowHeader) !== mb_strtolower($header)) { |
|
54 | 4 | continue; |
|
55 | } |
||
56 | |||
57 | 4 | unset($headers[$i]); |
|
58 | } |
||
59 | } |
||
60 | |||
61 | 4 | return [] === $headers; |
|
62 | } |
||
63 | |||
72 |