Conditions | 4 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.0218 |
Changes | 0 |
1 | <?php |
||
20 | 2 | public function parse($line) |
|
21 | { |
||
22 | 2 | if (!preg_match($this->pcreFormat, $line, $matches)) { |
|
23 | throw new \Kassner\LogParser\FormatException($line); |
||
24 | } |
||
25 | |||
26 | 2 | $entry = $this->createEntry(); |
|
27 | 2 | foreach (array_filter(array_keys($matches), 'is_string') as $key) { |
|
28 | 2 | $setter = 'set'.$key; |
|
29 | 2 | if (method_exists($entry, $setter)) { |
|
30 | 2 | $entry->$setter($matches[$key]); |
|
31 | } |
||
32 | } |
||
33 | |||
34 | 2 | return $entry; |
|
35 | } |
||
45 |