Completed
Pull Request — master (#112)
by Pieter
04:24 queued 01:13
created

GitOutputEvent   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 81.82%

Importance

Changes 3
Bugs 3 Features 1
Metric Value
wmc 4
c 3
b 3
f 1
lcom 1
cbo 1
dl 0
loc 53
ccs 9
cts 11
cp 0.8182
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getBuffer() 0 4 1
A isError() 0 4 1
A getType() 0 4 1
1
<?php
2
3
namespace GitWrapper\Event;
4
5
use GitWrapper\GitCommand;
6
use GitWrapper\GitWrapper;
7
use Symfony\Component\Process\Process;
8
9
/**
10
 * Event instance passed when output is returned from Git commands.
11
 */
12
class GitOutputEvent extends GitEvent
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $type;
18
19
    /**
20
     * @var string
21
     */
22
    protected $buffer;
23
24
    /**
25
     * Constructs a GitEvent object.
26
     *
27
     * @param \GitWrapper\GitWrapper $wrapper
28
     *   The GitWrapper object that likely instantiated this class.
29
     * @param \Symfony\Component\Process\Process $process
30
     *   The Process object being run.
31
     * @param \GitWrapper\GitCommand $command
32
     *   The GitCommand object being executed.
33
     */
34 72
    public function __construct(GitWrapper $wrapper, Process $process, GitCommand $command, $type, $buffer)
35
    {
36 72
        parent::__construct($wrapper, $process, $command);
37 72
        $this->type = $type;
38 72
        $this->buffer = $buffer;
39 72
    }
40
41
    /**
42
     * @return string
43
     */
44
    public function getType()
45
    {
46
        return $this->type;
47
    }
48
49
    /**
50
     * @return string
51
     */
52 4
    public function getBuffer()
53
    {
54 4
        return $this->buffer;
55
    }
56
57
    /**
58
     * Tests wheter the buffer was captured from STDERR.
59
     */
60 4
    public function isError()
61
    {
62 4
        return (Process::ERR == $this->type);
63
    }
64
}
65