LineEndingReview::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 9
c 0
b 0
f 0
ccs 6
cts 6
cp 1
rs 9.6666
cc 2
eloc 5
nc 2
nop 2
crap 2
1
<?php
2
3
  namespace Funivan\Cs\Tools\LineEnding;
4
5
  use Funivan\Cs\Fs\File;
6
  use Funivan\Cs\Report\Report;
7
8
  /**
9
   * @author Ivan Shcherbak <[email protected]> 2016
10
   */
11
  class LineEndingReview extends LineEndingAbstract {
12
13
    const NAME = 'line_ending_review';
14
15
16
    /**
17
     * @inheritdoc
18
     */
19 4
    public function getName() {
20 4
      return self::NAME;
21
    }
22
23
24
    /**
25
     * @inheritdoc
26
     */
27 4
    public function process(File $file, Report $report) {
28 4
      $collection = \Funivan\PhpTokenizer\Collection::createFromString($file->getContent()->get());
29 4
      $tokens = $collection->find($this->getFindQuery());
30
31 4
      foreach ($tokens as $token) {
32 3
        $report->addMessage($file, $this, 'Expect only LF line ending', $token->getLine());
33
      }
34
35 4
    }
36
37
  }