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