| Conditions | 3 |
| Paths | 3 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 3 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | 5 | public function create($header) |
|
| 9 | { |
||
| 10 | 5 | $parts = $this->splitEntry($header); |
|
| 11 | |||
| 12 | 5 | if (false === $parts) { |
|
| 13 | 1 | return null; |
|
| 14 | } |
||
| 15 | |||
| 16 | 4 | list($name, $value) = $parts; |
|
| 17 | 4 | $name = str_replace('-', '', $name); |
|
| 18 | 4 | $class = '\Fracture\Http\Headers\\' . $name; |
|
| 19 | |||
| 20 | 4 | if (false === class_exists($class)) { |
|
| 21 | 1 | return null; |
|
| 22 | } |
||
| 23 | |||
| 24 | 3 | $instance = new $class($value); |
|
| 25 | 3 | $instance->prepare(); |
|
| 26 | 3 | return $instance; |
|
| 27 | } |
||
| 28 | |||
| 44 |