Failed Conditions
Push — master ( 356b1f...e74f9e )
by Adrien
10:44
created

Booking::getStartDate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Model;
6
7
use Cake\Chronos\Chronos;
8
use Doctrine\Common\Collections\ArrayCollection;
9
use Doctrine\Common\Collections\Collection;
10
use Doctrine\ORM\Mapping as ORM;
11
12
/**
13
 * User
14
 *
15
 * @ORM\Entity(repositoryClass="Application\Repository\BookingRepository")
16
 */
17
class Booking extends AbstractModel
18
{
19
    /**
20
     * @var User
21
     *
22
     * @ORM\ManyToOne(targetEntity="Application\Model\User", inversedBy="bookings")
23
     * @ORM\JoinColumns({
24
     *     @ORM\JoinColumn(onDelete="SET NULL")
25
     * })
26
     */
27
    private $responsible;
28
29
    /**
30
     * @var Collection
31
     *
32
     * @ORM\ManyToMany(targetEntity="Application\Model\Item", inversedBy="bookings")
33
     */
34
    private $items;
35
36
    /**
37
     * Constructor
38
     */
39
    public function __construct()
40
    {
41
        $this->items = new ArrayCollection();
42
    }
43
44
    /**
45
     * Set responsible
46
     *
47
     * @param null|User $responsible
48
     */
49
    public function setResponsible(?User $responsible): void
50
    {
51
        $this->responsible = $responsible;
52
        $this->responsible->bookingAdded($this);
0 ignored issues
show
Bug introduced by
The method bookingAdded() does not exist on null. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
        $this->responsible->/** @scrutinizer ignore-call */ 
53
                            bookingAdded($this);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
53
    }
54
55
    /**
56
     * Get responsible
57
     *
58
     * @return null|User
59
     */
60
    public function getResponsible(): ?User
61
    {
62
        return $this->responsible;
63
    }
64
65
    /**
66
     * @var int
67
     * @ORM\Column(type="integer", options={"unsigned" = true, "default" = 1})
68
     */
69
    private $participantCount = 1;
70
71
    /**
72
     * @var string
73
     *
74
     * @ORM\Column(type="string", length=50, options={"default" = ""})
75
     */
76
    private $destination = '';
77
78
    /**
79
     * @var string
80
     *
81
     * @ORM\Column(type="text", length=65535, options={"default" = ""})
82
     */
83
    private $startComment = '';
84
85
    /**
86
     * @var string
87
     *
88
     * @ORM\Column(type="text", length=65535, options={"default" = ""})
89
     */
90
    private $endComment = '';
91
92
    /**
93
     * @var Chronos
94
     *
95
     * @ORM\Column(type="datetime")
96
     */
97
    private $startDate;
98
99
    /**
100
     * @var Chronos
101
     *
102
     * @ORM\Column(type="datetime", nullable=true)
103
     */
104
    private $endDate;
105
106
    /**
107
     * @var Chronos
108
     *
109
     * @ORM\Column(type="string", length=50, options={"default" = ""})
110
     */
111
    private $estimatedEndDate = '';
112
113
    /**
114
     * Total count of participant, at least 1.
115
     *
116
     * @return int
117
     */
118
    public function getParticipantCount(): int
119
    {
120
        return $this->participantCount;
121
    }
122
123
    /**
124
     * @param int $participantCount
125
     */
126
    public function setParticipantCount(int $participantCount): void
127
    {
128
        $this->participantCount = $participantCount;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getDestination(): string
135
    {
136
        return $this->destination;
137
    }
138
139
    /**
140
     * @param string $destination
141
     */
142
    public function setDestination(string $destination): void
143
    {
144
        $this->destination = $destination;
145
    }
146
147
    /**
148
     * @return string
149
     */
150
    public function getStartComment(): string
151
    {
152
        return $this->startComment;
153
    }
154
155
    /**
156
     * @param string $startComment
157
     */
158
    public function setStartComment(string $startComment): void
159
    {
160
        $this->startComment = $startComment;
161
    }
162
163
    /**
164
     * @return string
165
     */
166
    public function getEndComment(): string
167
    {
168
        return $this->endComment;
169
    }
170
171
    /**
172
     * @param string $endComment
173
     */
174
    public function setEndComment(string $endComment): void
175
    {
176
        $this->endComment = $endComment;
177
    }
178
179
    /**
180
     * @return Chronos
181
     */
182
    public function getStartDate(): Chronos
183
    {
184
        return $this->startDate;
185
    }
186
187
    /**
188
     * @param Chronos $startDate
189
     */
190
    public function setStartDate(Chronos $startDate): void
191
    {
192
        $this->startDate = $startDate;
193
    }
194
195
    /**
196
     * @return Chronos
197
     */
198
    public function getEndDate(): Chronos
199
    {
200
        return $this->endDate;
201
    }
202
203
    /**
204
     * @param Chronos $endDate
205
     */
206
    public function setEndDate(Chronos $endDate): void
207
    {
208
        $this->endDate = $endDate;
209
    }
210
211
    /**
212
     * @return Chronos
213
     */
214
    public function getEstimatedEndDate(): Chronos
215
    {
216
        return $this->estimatedEndDate;
217
    }
218
219
    /**
220
     * @param Chronos $estimatedEndDate
221
     */
222
    public function setEstimatedEndDate(Chronos $estimatedEndDate): void
223
    {
224
        $this->estimatedEndDate = $estimatedEndDate;
225
    }
226
227
    /**
228
     * @return Collection
229
     */
230
    public function getItems(): Collection
231
    {
232
        return $this->items;
233
    }
234
235
    /**
236
     * Add item
237
     *
238
     * @param Item $item
239
     */
240
    public function addItem(Item $item): void
241
    {
242
        if (!$this->items->contains($item)) {
243
            $this->items->add($item);
244
        }
245
    }
246
}
247