Conditions | 5 |
Paths | 8 |
Total Lines | 28 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php |
||
35 | public function process(File $file, Report $report) { |
||
36 | $collection = \Funivan\PhpTokenizer\Collection::createFromString($file->getContent()->get()); |
||
37 | |||
38 | $tokens = $this->findTokens($collection); |
||
39 | |||
40 | $lastInvalidToken = $this->getLastInvalidToken($collection); |
||
41 | if (null !== $lastInvalidToken) { |
||
42 | $tokens->append($lastInvalidToken); |
||
43 | } |
||
44 | |||
45 | if ($tokens->count() === 0) { |
||
46 | return; |
||
47 | } |
||
48 | |||
49 | $lines = []; |
||
50 | foreach ($tokens as $token) { |
||
51 | $line = $token->getLine(); |
||
52 | $line++; # Our token start in previous line |
||
53 | if (isset($lines[$line])) { |
||
54 | continue; |
||
55 | } |
||
56 | |||
57 | $lines[$line] = true; |
||
58 | |||
59 | $report->addMessage($file, $this, 'File contains empty lines with spaces.', $line); |
||
60 | } |
||
61 | |||
62 | } |
||
63 | |||
64 | } |