GitOutputEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 1
dl 0
loc 39
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getType() 0 4 1
A getBuffer() 0 4 1
A isError() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace GitWrapper\Event;
6
7
use GitWrapper\GitCommand;
8
use GitWrapper\GitWrapper;
9
use Symfony\Component\Process\Process;
10
11
/**
12
 * Event instance passed when output is returned from Git commands.
13
 */
14
final class GitOutputEvent extends AbstractGitEvent
15
{
16
    /**
17
     * @var string
18
     */
19
    private $type;
20
21
    /**
22
     * @var string
23
     */
24
    private $buffer;
25
26
    public function __construct(
27
        GitWrapper $gitWrapper,
28
        Process $process,
29
        GitCommand $gitCommand,
30
        string $type,
31
        string $buffer
32
    ) {
33
        parent::__construct($gitWrapper, $process, $gitCommand);
34
        $this->type = $type;
35
        $this->buffer = $buffer;
36
    }
37
38
    public function getType(): string
39
    {
40
        return $this->type;
41
    }
42
43
    public function getBuffer(): string
44
    {
45
        return $this->buffer;
46
    }
47
48
    public function isError(): bool
49
    {
50
        return $this->type === Process::ERR;
51
    }
52
}
53