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

GitOutputEvent::getType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
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