Completed
Pull Request — master (#130)
by Gorka
02:47
created

TaskCreated   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 70
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 9
lcom 0
cbo 0
dl 0
loc 70
rs 10
c 0
b 0
f 0

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 18 1
A id() 0 4 1
A title() 0 4 1
A description() 0 4 1
A creator() 0 4 1
A assignee() 0 4 1
A priority() 0 4 1
A parentId() 0 4 1
A occurredOn() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\TaskManager\Domain\Model\Project\Task;
16
17
use Kreta\SharedKernel\Domain\Model\DomainEvent;
18
use Kreta\TaskManager\Domain\Model\Organization\Participant;
19
20
class TaskCreated implements DomainEvent
21
{
22
    private $id;
23
    private $title;
24
    private $description;
25
    private $creator;
26
    private $assignee;
27
    private $priority;
28
    private $parentId;
29
    private $occurredOn;
30
31
    public function __construct(
32
        TaskId $id,
33
        TaskTitle $title,
34
        string $description,
35
        Participant $creator,
36
        Participant $assignee,
37
        TaskPriority $priority,
38
        TaskId $parentId = null
39
    ) {
40
        $this->id = $id;
41
        $this->title = $title;
42
        $this->description = $description;
43
        $this->creator = $creator;
44
        $this->assignee = $assignee;
45
        $this->priority = $priority;
46
        $this->parentId = $parentId;
47
        $this->occurredOn = new \DateTimeImmutable();
48
    }
49
50
    public function id() : TaskId
51
    {
52
        return $this->id;
53
    }
54
55
    public function title() : TaskTitle
56
    {
57
        return $this->title;
58
    }
59
60
    public function description() : string
61
    {
62
        return $this->description;
63
    }
64
65
    public function creator() : Participant
66
    {
67
        return $this->creator;
68
    }
69
70
    public function assignee() : Participant
71
    {
72
        return $this->assignee;
73
    }
74
75
    public function priority() : TaskPriority
76
    {
77
        return $this->priority;
78
    }
79
80
    public function parentId()
81
    {
82
        return $this->parentId;
83
    }
84
85
    public function occurredOn() : \DateTimeInterface
86
    {
87
        return $this->occurredOn;
88
    }
89
}
90