| Conditions | 5 |
| Paths | 4 |
| Total Lines | 32 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 25 | public function __invoke(ViewController $view, $filename, $actualLine = 0) |
||
| 26 | { |
||
| 27 | |||
| 28 | $lineNr = 0; |
||
| 29 | $lines = ''; |
||
| 30 | $file = fopen($filename, 'r'); |
||
| 31 | |||
| 32 | $tabChar = ' '; |
||
| 33 | $regularChar = ' '; |
||
| 34 | |||
| 35 | while ($line = fgets($file)) { |
||
| 36 | |||
| 37 | $lineNr++; |
||
| 38 | |||
| 39 | if ($lineNr >= $actualLine - 6 && $lineNr <= $actualLine + 3) { |
||
| 40 | |||
| 41 | $l = str_replace("\t", $tabChar, $line); |
||
| 42 | $l = str_replace(" ", $regularChar, $l); |
||
| 43 | |||
| 44 | if ($lineNr === $actualLine) { |
||
| 45 | $lines .= '<span class="line highlight"><span class="line-nr">' . $lineNr . '</span>' . $view->highlighter($l, 'php') . '</span>'; |
||
|
|
|||
| 46 | } else { |
||
| 47 | $lines .= '<span class="line"><span class="line-nr">' . $lineNr . '</span>' . $view->highlighter($l, 'php') . '</span>'; |
||
| 48 | } |
||
| 49 | |||
| 50 | } |
||
| 51 | |||
| 52 | } |
||
| 53 | |||
| 54 | return $lines; |
||
| 55 | |||
| 56 | } |
||
| 57 | |||
| 58 | } |
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: