-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathUserStory.php
103 lines (89 loc) · 1.93 KB
/
UserStory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
namespace Scrum\Domain\Models\UserStories;
use Scrum\Domain\Models\User\UserId;
/**
* Class UserStory
* @package nrslib\ScrumDomain\Models\UserStories
*/
class UserStory
{
/** @var UserStoryId */
private $id;
/** @var string */
private $story;
/** @var UserId */
private $author;
/** @var string|null */
private $demo;
/** @var int|null */
private $estimation;
/** @var int|null */
private $seq;
/**
* UserStory constructor.
* @param UserStoryId $id
* @param string $story
* @param UserId $author
* @param string|null $demo
* @param int|null $estimation
* @param int|null $seq
*/
public function __construct(UserStoryId $id, string $story, UserId $author, string $demo = null, int $estimation = null, int $seq = null)
{
if (strlen($story) == 0) {
throw new \InvalidArgumentException("story is empty.");
}
$this->id = $id;
$this->story = $story;
$this->author = $author;
$this->demo = $demo;
$this->estimation = $estimation;
$this->seq = $seq;
}
/**
* @return UserStoryId
*/
public function getId(): UserStoryId
{
return $this->id;
}
/**
* @return string
*/
public function getStory(): string
{
return $this->story;
}
/**
* @return UserId
*/
public function getAuthor(): UserId
{
return $this->author;
}
/**
* @return string|null
*/
public function getDemo(): ?string
{
return $this->demo;
}
/**
* @return int|null
*/
public function getEstimation(): ?int
{
return $this->estimation;
}
/**
* @return int|null
*/
public function getSeq(): ?int
{
return $this->seq;
}
public function estimate(int $estimation)
{
$this->estimation = $estimation;
}
}