ReviewFileProcessor   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 0
loc 41
c 0
b 0
f 0
wmc 7
lcom 0
cbo 4
ccs 0
cts 22
cp 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
C process() 0 32 7
1
<?php
2
3
  namespace Funivan\Cs\FileProcessor;
4
5
  use Funivan\Cs\Fs\FilesCollection;
6
  use Funivan\Cs\Report\Report;
7
8
  /**
9
   * @author Ivan Shcherbak <[email protected]> 2016
10
   */
11
  class ReviewFileProcessor extends BaseFileProcessor {
12
13
14
    /**
15
     * @param FilesCollection $files
16
     * @param Report $report
17
     */
18
    public function process(FilesCollection $files, Report $report) {
19
20
      $isDebug = $this->getOutput()->isDebug();
21
22
      foreach ($files as $file) {
23
        $errorsNum = $report->count();
24
25
        if ($isDebug) {
26
          $this->getOutput()->writeln('⚑ open  : ' . $file->getPath());
27
        }
28
29
        foreach ($this->getTools() as $tool) {
30
31
          if (!$tool->canProcess($file)) {
32
            continue;
33
          }
34
35
          $tool->process($file, $report);
36
          if ($errorsNum === $report->count()) {
37
            if ($isDebug) {
38
39
              $this->getOutput()->writeln('✔ ok    : ' . $tool->getDescription() . ' (' . $tool->getName() . ')');
40
            }
41
            continue;
42
          }
43
44
45
          $this->getOutput()->writeln('✘ error : ' . $tool->getDescription() . ' (' . $tool->getName() . ')');
46
        }
47
      }
48
49
    }
50
51
  }