Completed
Push — master ( d8cc04...be84ec )
by Shcherbak
04:06
created

LineBeforeClassEndReview::getDescription()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 3
c 0
b 0
f 0
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
  namespace Funivan\Cs\Tools\Php\LineBeforeClassEnd;
4
5
  use Funivan\Cs\Fs\File;
6
  use Funivan\Cs\Report\Report;
7
8
  /**
9
   *
10
   */
11
  class LineBeforeClassEndReview extends AbstractLineBeforeClassEnd {
12
13
    const NAME = 'php_line_before_class_end_review';
14
15
16
    /**
17
     * @inheritdoc
18
     */
19 1
    public function getName() {
20 1
      return self::NAME;
21
    }
22
23
24
    /**
25
     * @inheritdoc
26
     */
27
    public function getDescription() {
28
      return 'Check if there is one empty line before class closing tag';
29
    }
30
31
32
    /**
33
     * @param File $file
34
     * @param Report $report
35
     * @void
36
     */
37 1
    public function process(File $file, Report $report) {
38 1
      $collection = \Funivan\PhpTokenizer\Collection::createFromString($file->getContent()->get());
39 1
      $tokens = $this->getInvalidTokens($collection);
40
41 1
      foreach ($tokens as $token) {
42 1
        $report->addMessage($file, $this, 'Expect one empty line before class end', $token->getLine());
43
      }
44 1
    }
45
46
  }