Conditions | 6 |
Paths | 12 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
17 | public function getHeader($headerName, $regex = null) |
||
18 | { |
||
19 | $headers = $this->getHeaders(); |
||
20 | |||
21 | $value = null; |
||
22 | |||
23 | foreach ($headers as $header) { |
||
24 | if ($header->key === $headerName) { |
||
25 | $value = $header->value; |
||
26 | if (!is_null($regex)) { |
||
27 | preg_match_all($regex, $header->value, $value); |
||
28 | } |
||
29 | break; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | if (is_array($value)) { |
||
34 | return isset($value[1]) ? $value[1] : null; |
||
35 | } |
||
36 | |||
37 | return $value; |
||
38 | } |
||
43 |