Quest::getTitle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Badger\Bundle\GameBundle\Entity;
4
5
use Badger\Component\Game\Model\QuestInterface;
6
use Badger\Component\Game\Model\TagInterface;
7
use Doctrine\Common\Collections\ArrayCollection;
8
9
/**
10
 * Quest entity.
11
 *
12
 * @license http://opensource.org/licenses/MIT The MIT License (MIT)
13
 */
14
class Quest implements QuestInterface
15
{
16
    /** @var string */
17
    protected $id;
18
19
    /** @var string */
20
    protected $title;
21
22
    /** @var string */
23
    protected $description;
24
25
    /** @var int */
26
    protected $reward;
27
28
    /** @var \DateTime */
29
    protected $startDate;
30
31
    /** @var \DateTime */
32
    protected $endDate;
33
34
    /** @var ArrayCollection */
35
    protected $tags;
36
37
    /** @var ArrayCollection */
38
    protected $completions;
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function getId()
44
    {
45
        return $this->id;
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function getTitle()
52
    {
53
        return $this->title;
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function setTitle($title)
60
    {
61
        $this->title = $title;
62
63
        return $this;
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    public function getDescription()
70
    {
71
        return $this->description;
72
    }
73
74
    /**
75
     * {@inheritdoc}
76
     */
77
    public function setDescription($description)
78
    {
79
        $this->description = $description;
80
81
        return $this;
82
    }
83
84
    /**
85
     * {@inheritdoc}
86
     */
87
    public function getReward()
88
    {
89
        return $this->reward;
90
    }
91
92
    /**
93
     * {@inheritdoc}
94
     */
95
    public function setReward($reward)
96
    {
97
        $this->reward = $reward;
98
99
        return $this;
100
    }
101
102
    /**
103
     * {@inheritdoc}
104
     */
105
    public function getStartDate()
106
    {
107
        return $this->startDate;
108
    }
109
110
    /**
111
     * {@inheritdoc}
112
     */
113
    public function setStartDate($startDate)
114
    {
115
        $this->startDate = $startDate;
116
117
        return $this;
118
    }
119
120
    /**
121
     * {@inheritdoc}
122
     */
123
    public function getEndDate()
124
    {
125
        return $this->endDate;
126
    }
127
128
    /**
129
     * {@inheritdoc}
130
     */
131
    public function setEndDate($endDate)
132
    {
133
        $this->endDate = $endDate;
134
135
        return $this;
136
    }
137
138
    /**
139
     * {@inheritdoc}
140
     */
141
    public function addTag(TagInterface $tag)
142
    {
143
        $this->tags[] = $tag;
144
145
        return $this;
146
    }
147
148
    /**
149
     * {@inheritdoc}
150
     */
151
    public function setTags(ArrayCollection $tags)
152
    {
153
        $this->tags = $tags;
154
    }
155
156
    /**
157
     * {@inheritdoc}
158
     */
159
    public function getTags()
160
    {
161
        return $this->tags;
162
    }
163
164
    /**
165
     * {@inheritdoc}
166
     */
167
    public function getCompletions()
168
    {
169
        return $this->completions;
170
    }
171
172
    /**
173
     * {@inheritdoc}
174
     */
175
    public function setCompletions($completions)
176
    {
177
        $this->completions = $completions;
178
    }
179
180
    /**
181
     * {@inheritdoc}
182
     */
183
    public function getApprovedCompletionsCount()
184
    {
185
        return $this->completions->filter(function($completion) {
186
            return !$completion->isPending();
187
        })->count();
188
    }
189
}
190