Conditions | 4 |
Paths | 3 |
Total Lines | 22 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
27 | public static function logOffset($log, $offset = 0, $is_end = false) |
||
28 | { |
||
29 | if (is_numeric($offset) && $offset > 0) { |
||
30 | $offset_log = (string) mb_substr($log, $offset, mb_strlen($log, 'UTF-8') - $offset, 'UTF-8'); |
||
31 | |||
32 | try { |
||
33 | return new self([ |
||
34 | 'offset' => $offset, |
||
35 | 'content' => $offset_log, |
||
36 | 'end' => $is_end, |
||
37 | ]); |
||
38 | } catch (\Exception $e) { |
||
39 | // use default condition |
||
40 | } |
||
41 | } |
||
42 | |||
43 | return new self([ |
||
44 | 'offset' => 0, |
||
45 | 'content' => $log, |
||
46 | 'end' => $is_end, |
||
47 | ]); |
||
48 | } |
||
49 | } |
||
50 |