JobDefinition::addTask()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/**
4
 * This file is part of Bldr.io
5
 *
6
 * (c) Aaron Scherer <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE
10
 */
11
12
namespace Bldr\Definition;
13
14
/**
15
 * This is the model that the job configuration is turned in to.
16
 *
17
 * @author Aaron Scherer <[email protected]>
18
 */
19
class JobDefinition
20
{
21
    /**
22
     * @var string $name
23
     */
24
    private $name;
25
26
    /**
27
     * @var string $description
28
     */
29
    private $description;
30
31
    /**
32
     * @var TaskDefinition[] $tasks
33
     */
34
    private $tasks = [];
35
36
    /**
37
     * @param string           $name
38
     * @param string           $description
39
     * @param TaskDefinition[] $tasks
40
     */
41
    public function __construct($name, $description = '', array $tasks = [])
42
    {
43
        $this->name         = $name;
44
        $this->description  = $description;
45
        $this->tasks        = $tasks;
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getName()
52
    {
53
        return $this->name;
54
    }
55
56
    /**
57
     * @return string
58
     */
59
    public function getDescription()
60
    {
61
        return $this->description;
62
    }
63
64
    /**
65
     * @return TaskDefinition[]
66
     */
67
    public function getTasks()
68
    {
69
        return $this->tasks;
70
    }
71
72
    /**
73
     * @param TaskDefinition $task
74
     *
75
     * @return JobDefinition
76
     */
77
    public function addTask(TaskDefinition $task)
78
    {
79
        $this->tasks[] = $task;
80
81
        return $this;
82
    }
83
}
84