Completed
Push — master ( 3ef484...ea5778 )
by Paweł
08:46
created

Event::getIngestProvider()   A

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
/*
4
 * This file is part of the Superdesk Web Publisher Bridge Component.
5
 *
6
 * Copyright 2017 Sourcefabric z.ú. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2017 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace SWP\Component\Bridge\Model;
16
17
use Doctrine\Common\Collections\ArrayCollection;
18
use SWP\Component\Bridge\Model\Event\Category;
19
use SWP\Component\Bridge\Model\Event\Date;
20
use SWP\Component\Bridge\Model\Event\Location;
21
use SWP\Component\Bridge\Model\Event\OccurStatus;
22
use SWP\Component\Common\Model\TimestampableInterface;
23
use SWP\Component\Common\Model\TimestampableTrait;
24
25
class Event implements TimestampableInterface, EventInterface
26
{
27
    use TimestampableTrait;
28
29
    /**
30
     * @var string
31
     */
32
    protected $id;
33
34
    /**
35
     * @var string
36
     */
37
    protected $guid;
38
39
    /**
40
     * @var string
41
     */
42
    protected $etag;
43
44
    /**
45
     * @var string
46
     */
47
    protected $type;
48
49
    /**
50
     * @var int
51
     */
52
    protected $version;
53
54
    /**
55
     * @var string
56
     */
57
    protected $ingestId;
58
59
    /**
60
     * @var string
61
     */
62
    protected $recurrenceId;
63
64
    /**
65
     * @var string
66
     */
67
    protected $originalCreator;
68
69
    /**
70
     * @var string
71
     */
72
    protected $versionCreator;
73
74
    /**
75
     * @var string
76
     */
77
    protected $ingestProvider;
78
79
    /**
80
     * @var string
81
     */
82
    protected $originalSource;
83
84
    /**
85
     * @var string
86
     */
87
    protected $ingestProviderSequence;
88
89
    /**
90
     * @var string
91
     */
92
    protected $name;
93
94
    /**
95
     * @var string
96
     */
97
    protected $definitionShort;
98
99
    /**
100
     * @var string
101
     */
102
    protected $definitionLong;
103
104
    /**
105
     * @var Category[]
106
     */
107
    protected $anpaCategory = [];
108
109
    /**
110
     * @var Date
111
     */
112
    protected $dates;
113
114
    /**
115
     * @var Location[]
116
     */
117
    protected $locations = [];
118
119
    /**
120
     * @var OccurStatus
121
     */
122
    protected $occurStatus;
123
124
    /**
125
     * Event constructor.
126
     */
127
    public function __construct()
128
    {
129
        $this->locations = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,object<SWP...\Model\Event\Location>> of property $locations.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
130
        $this->anpaCategory = new ArrayCollection();
0 ignored issues
show
Documentation Bug introduced by
It seems like new \Doctrine\Common\Collections\ArrayCollection() of type object<Doctrine\Common\C...ctions\ArrayCollection> is incompatible with the declared type array<integer,object<SWP...\Model\Event\Category>> of property $anpaCategory.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
131
    }
132
133
    /**
134
     * {@inheritdoc}
135
     */
136
    public function getId()
137
    {
138
        return $this->id;
139
    }
140
141
    /**
142
     * {@inheritdoc}
143
     */
144
    public function getGuid()
145
    {
146
        return $this->guid;
147
    }
148
149
    /**
150
     * {@inheritdoc}
151
     */
152
    public function setGuid($guid)
153
    {
154
        $this->guid = $guid;
155
    }
156
157
    /**
158
     * {@inheritdoc}
159
     */
160
    public function getVersion()
161
    {
162
        return $this->version;
163
    }
164
165
    /**
166
     * {@inheritdoc}
167
     */
168
    public function setVersion($version)
169
    {
170
        $this->version = $version;
171
    }
172
173
    /**
174
     * {@inheritdoc}
175
     */
176
    public function getIngestId()
177
    {
178
        return $this->ingestId;
179
    }
180
181
    /**
182
     * {@inheritdoc}
183
     */
184
    public function setIngestId($ingestId)
185
    {
186
        $this->ingestId = $ingestId;
187
    }
188
189
    /**
190
     * {@inheritdoc}
191
     */
192
    public function getRecurrenceId()
193
    {
194
        return $this->recurrenceId;
195
    }
196
197
    /**
198
     * {@inheritdoc}
199
     */
200
    public function setRecurrenceId($recurrenceId)
201
    {
202
        $this->recurrenceId = $recurrenceId;
203
    }
204
205
    /**
206
     * {@inheritdoc}
207
     */
208
    public function getOriginalCreator()
209
    {
210
        return $this->originalCreator;
211
    }
212
213
    /**
214
     * {@inheritdoc}
215
     */
216
    public function setOriginalCreator($originalCreator)
217
    {
218
        $this->originalCreator = $originalCreator;
219
    }
220
221
    /**
222
     * {@inheritdoc}
223
     */
224
    public function getVersionCreator()
225
    {
226
        return $this->versionCreator;
227
    }
228
229
    /**
230
     * {@inheritdoc}
231
     */
232
    public function setVersionCreator($versionCreator)
233
    {
234
        $this->versionCreator = $versionCreator;
235
    }
236
237
    /**
238
     * {@inheritdoc}
239
     */
240
    public function getIngestProvider()
241
    {
242
        return $this->ingestProvider;
243
    }
244
245
    /**
246
     * {@inheritdoc}
247
     */
248
    public function setIngestProvider($ingestProvider)
249
    {
250
        $this->ingestProvider = $ingestProvider;
251
    }
252
253
    /**
254
     * {@inheritdoc}
255
     */
256
    public function getOriginalSource()
257
    {
258
        return $this->originalSource;
259
    }
260
261
    /**
262
     * {@inheritdoc}
263
     */
264
    public function setOriginalSource($originalSource)
265
    {
266
        $this->originalSource = $originalSource;
267
    }
268
269
    /**
270
     * {@inheritdoc}
271
     */
272
    public function getIngestProviderSequence()
273
    {
274
        return $this->ingestProviderSequence;
275
    }
276
277
    /**
278
     * {@inheritdoc}
279
     */
280
    public function setIngestProviderSequence($ingestProviderSequence)
281
    {
282
        $this->ingestProviderSequence = $ingestProviderSequence;
283
    }
284
285
    /**
286
     * {@inheritdoc}
287
     */
288
    public function getName()
289
    {
290
        return $this->name;
291
    }
292
293
    /**
294
     * {@inheritdoc}
295
     */
296
    public function setName($name)
297
    {
298
        $this->name = $name;
299
    }
300
301
    /**
302
     * {@inheritdoc}
303
     */
304
    public function getDefinitionShort()
305
    {
306
        return $this->definitionShort;
307
    }
308
309
    /**
310
     * {@inheritdoc}
311
     */
312
    public function setDefinitionShort($definitionShort)
313
    {
314
        $this->definitionShort = $definitionShort;
315
    }
316
317
    /**
318
     * {@inheritdoc}
319
     */
320
    public function getDefinitionLong()
321
    {
322
        return $this->definitionLong;
323
    }
324
325
    /**
326
     * {@inheritdoc}
327
     */
328
    public function setDefinitionLong($definitionLong)
329
    {
330
        $this->definitionLong = $definitionLong;
331
    }
332
333
    /**
334
     * {@inheritdoc}
335
     */
336
    public function getAnpaCategory()
337
    {
338
        return $this->anpaCategory;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->anpaCategory; (SWP\Component\Bridge\Model\Event\Category[]) is incompatible with the return type declared by the interface SWP\Component\Bridge\Mod...erface::getAnpaCategory of type SWP\Component\Bridge\Model\ArrayCollection.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
339
    }
340
341
    /**
342
     * {@inheritdoc}
343
     */
344
    public function setAnpaCategory($anpaCategory)
345
    {
346
        $this->anpaCategory = $anpaCategory;
0 ignored issues
show
Documentation Bug introduced by
It seems like $anpaCategory of type object<SWP\Component\Bri...\Model\ArrayCollection> is incompatible with the declared type array<integer,object<SWP...\Model\Event\Category>> of property $anpaCategory.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
347
    }
348
349
    /**
350
     * {@inheritdoc}
351
     */
352
    public function getDates()
353
    {
354
        return $this->dates;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->dates; (SWP\Component\Bridge\Model\Event\Date) is incompatible with the return type declared by the interface SWP\Component\Bridge\Mod...ventInterface::getDates of type SWP\Component\Bridge\Model\Date.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
355
    }
356
357
    /**
358
     * {@inheritdoc}
359
     */
360
    public function setDates($dates)
361
    {
362
        $this->dates = $dates;
0 ignored issues
show
Documentation Bug introduced by
It seems like $dates of type object<SWP\Component\Bridge\Model\Date> is incompatible with the declared type object<SWP\Component\Bridge\Model\Event\Date> of property $dates.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
363
    }
364
365
    /**
366
     * {@inheritdoc}
367
     */
368
    public function getLocations()
369
    {
370
        return $this->locations;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->locations; (SWP\Component\Bridge\Model\Event\Location[]) is incompatible with the return type declared by the interface SWP\Component\Bridge\Mod...Interface::getLocations of type SWP\Component\Bridge\Model\ArrayCollection.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
371
    }
372
373
    /**
374
     * {@inheritdoc}
375
     */
376
    public function setLocations($locations)
377
    {
378
        $this->locations = $locations;
0 ignored issues
show
Documentation Bug introduced by
It seems like $locations of type object<SWP\Component\Bri...\Model\ArrayCollection> is incompatible with the declared type array<integer,object<SWP...\Model\Event\Location>> of property $locations.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
379
    }
380
381
    /**
382
     * {@inheritdoc}
383
     */
384
    public function getOccurStatus()
385
    {
386
        return $this->occurStatus;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $this->occurStatus; (SWP\Component\Bridge\Model\Event\OccurStatus) is incompatible with the return type declared by the interface SWP\Component\Bridge\Mod...terface::getOccurStatus of type SWP\Component\Bridge\Model\OccurStatus.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
387
    }
388
389
    /**
390
     * {@inheritdoc}
391
     */
392
    public function setOccurStatus($occurStatus)
393
    {
394
        $this->occurStatus = $occurStatus;
0 ignored issues
show
Documentation Bug introduced by
It seems like $occurStatus of type object<SWP\Component\Bridge\Model\OccurStatus> is incompatible with the declared type object<SWP\Component\Bri...odel\Event\OccurStatus> of property $occurStatus.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
395
    }
396
}
397