TaskBuilder::addError()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php
2
3
namespace Jarobe\TaskRunnerBundle\Model;
4
5
use Jarobe\TaskRunnerBundle\TaskType\TaskTypeInterface;
6
7
class TaskBuilder
8
{
9
    /**
10
     * @var TaskTypeInterface $task
11
     */
12
    private $task;
13
14
    /**
15
     * @var array
16
     */
17
    private $errors;
18
19 1
    public function __construct()
20
    {
21 1
        $this->errors = [];
22 1
    }
23
24
    /**
25
     * @return TaskTypeInterface
26
     */
27
    public function getTask()
28
    {
29
        return $this->task;
30
    }
31
32
    /**
33
     * @param TaskTypeInterface $task
34
     * @return TaskBuilder
35
     */
36
    public function setTask($task)
37
    {
38
        $this->task = $task;
39
        return $this;
40
    }
41
42 1
    public function hasErrors()
43
    {
44 1
        return count($this->errors) > 0;
45
    }
46
47
    /**
48
     * @return array
49
     */
50
    public function getErrors()
51
    {
52
        return $this->errors;
53
    }
54
55
    /**
56
     * @param string $error
57
     * @return TaskBuilder
58
     */
59 1
    public function addError($error)
60
    {
61 1
        $this->errors[] = $error;
62 1
        return $this;
63
    }
64
}
65