AbstractPhpUnitProcessor   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 42
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A runProcess() 0 13 1
1
<?php
2
3
namespace PhpGitHooks\Module\PhpUnit\Infrastructure\Tool;
4
5
use PhpGitHooks\Infrastructure\Tool\ToolPathFinder;
6
use Symfony\Component\Console\Output\OutputInterface;
7
use Symfony\Component\Process\Process;
8
9
abstract class AbstractPhpUnitProcessor
10
{
11
    /**
12
     * @var OutputInterface
13
     */
14
    protected $output;
15
    /**
16
     * @var ToolPathFinder
17
     */
18
    protected $toolPathFinder;
19
20
    /**
21
     * PhpUnitProcessor constructor.
22
     *
23
     * @param OutputInterface $output
24
     * @param ToolPathFinder  $toolPathFinder
25
     */
26
    public function __construct(OutputInterface $output, ToolPathFinder $toolPathFinder)
27
    {
28
        $this->output = $output;
29
        $this->toolPathFinder = $toolPathFinder;
30
    }
31
32
    /**
33
     * @param Process $process
34
     *
35
     * @return mixed
36
     */
37
    protected function runProcess(Process $process)
38
    {
39
        $output = $this->output;
40
41
        $process->run(
42
            function ($type, $buffer) use ($output) {
43
                $type;
44
                $output->write($buffer);
45
            }
46
        );
47
48
        return $process->isSuccessful();
49
    }
50
}
51