Total Complexity | 7 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class LineHelper |
||
8 | { |
||
9 | protected $line; |
||
10 | |||
11 | public function __construct($line) |
||
12 | { |
||
13 | $this->line = $line; |
||
14 | } |
||
15 | |||
16 | public function getDate() |
||
17 | { |
||
18 | return substr($this->line, strpos($this->line, '[') + 1, strpos($this->line, ']') - 1); |
||
19 | } |
||
20 | |||
21 | public function hasDate() |
||
22 | { |
||
23 | return (bool) strtotime($this->getDate()); |
||
24 | } |
||
25 | |||
26 | public function hasType($type) |
||
29 | } |
||
30 | |||
31 | public function getLogMessageOf($type) |
||
32 | { |
||
33 | return Str::replaceFirst($this->getEnv().'.'.$type.': ', '', $this->lineWithoutDate()); |
||
34 | } |
||
35 | |||
36 | public function lineWithoutDate() |
||
37 | { |
||
38 | return substr($this->line, strpos($this->line, ']') + 2); |
||
39 | } |
||
40 | |||
41 | public function getEnv() |
||
44 | } |
||
45 | } |
||
46 |