1 | <?php |
||
7 | class FileHighlighter |
||
8 | { |
||
9 | /** |
||
10 | * Analyzed file. |
||
11 | * @var string file path; |
||
12 | */ |
||
13 | protected $filePath; |
||
14 | |||
15 | /** |
||
16 | * Lines of code with quality issues. |
||
17 | * @var array lines with respective issues. |
||
18 | */ |
||
19 | protected $linesWithIssues; |
||
20 | |||
21 | /** |
||
22 | * Set dependencies. |
||
23 | * @param string $filePath analyzed file path. |
||
24 | * @param array $linesWithIssues lines with respective issues. |
||
25 | */ |
||
26 | public function __construct($filePath, array $linesWithIssues) |
||
31 | |||
32 | /** |
||
33 | * Highlight PHP file showing issues and line numbers. |
||
34 | * @return string HTML. |
||
35 | */ |
||
36 | public function getHtml() |
||
58 | |||
59 | /** |
||
60 | * Ammount of characters of the number of the last line of code. |
||
61 | * @return integer padding length. |
||
62 | */ |
||
63 | protected function getLineNumberPaddingLength() |
||
69 | |||
70 | /** |
||
71 | * Split all formatted PHP lines of code into an array. |
||
72 | * @return string[] HTML splitted into an array. |
||
73 | */ |
||
74 | protected function getFormattedPHPFileLines() |
||
79 | |||
80 | /** |
||
81 | * Create MaterialDesign tooltip showing issues for a given line of code. |
||
82 | * @param integer $lineNumber line number. |
||
83 | * @return string HTML. |
||
84 | */ |
||
85 | protected function getIssuesTooltip($lineNumber) |
||
101 | } |
||
102 |