Completed
Pull Request — master (#268)
by greg
07:26 queued 04:08
created

Game::getOnInvitation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace PlaygroundGame\Entity;
3
4
use DateTime;
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
use Gedmo\Translatable\Translatable;
8
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
9
use Doctrine\ORM\Mapping\PrePersist;
10
use Doctrine\ORM\Mapping\PreUpdate;
11
use Doctrine\Common\Collections\ArrayCollection;
12
use Zend\InputFilter\InputFilter;
13
use Zend\InputFilter\Factory as InputFactory;
14
use Zend\InputFilter\InputFilterAwareInterface;
15
use Zend\InputFilter\InputFilterInterface;
16
17
/**
18
 * @ORM\Entity @HasLifecycleCallbacks
19
 *
20
 * @ORM\InheritanceType("JOINED")
21
 * @ORM\DiscriminatorColumn(name="type", type="string")
22
 * @ORM\DiscriminatorMap({"quiz" = "Quiz", "lottery" = "Lottery", "instantwin" =
23
 * "InstantWin", "postvote" = "PostVote", "mission" = "Mission"})
24
 * @ORM\Table(name="game")
25
 * @Gedmo\TranslationEntity(class="PlaygroundGame\Entity\GameTranslation")
26
 */
27
abstract class Game implements InputFilterAwareInterface, Translatable, \JsonSerializable
28
{
29
    // not yet published
30
    const GAME_SCHEDULE  = 'scheduled';
31
    // published and not yet started
32
    const GAME_PUBLISHED  = 'published';
33
    // published and game in progress
34
    const GAME_IN_PROGRESS = 'in progress';
35
    // published and game finished
36
    const GAME_FINISHED   = 'finished';
37
    // closed
38
    const GAME_CLOSED = 'closed';
39
40
    /**
41
     * @Gedmo\Locale
42
     * Used locale to override Translation listener`s locale
43
     * this is not a mapped field of entity metadata, just a simple property
44
     */
45
    protected $locale;
46
47
    protected $inputFilter;
48
49
    /**
50
     * @ORM\Id
51
     * @ORM\Column(type="integer");
52
     * @ORM\GeneratedValue(strategy="AUTO")
53
     */
54
    protected $id;
55
56
    /**
57
     * @ORM\ManyToOne(targetEntity="\PlaygroundPartnership\Entity\Partner")
58
     */
59
    protected $partner;
60
61
    /**
62
     * Implementer ManyToOne(targetEntity="PrizeCategory") avec hydrator sur le formulaire
63
     * @ORM\Column(name="prize_category", type="integer", nullable=true)
64
     */
65
    protected $prizeCategory;
66
67
    /**
68
     * @Gedmo\Translatable
69
     * @ORM\Column(type="string", length=255, nullable=false)
70
     */
71
    protected $title;
72
73
    /**
74
     * @ORM\Column(type="string", length=255, unique=true, nullable=false)
75
     */
76
    protected $identifier;
77
78
    /**
79
     * @ORM\OneToOne(targetEntity="PlayerForm", mappedBy="game", cascade={"persist","remove"})
80
     **/
81
    protected $playerForm;
82
83
    /**
84
     * @ORM\Column(name="main_image", type="string", length=255, nullable=true)
85
     */
86
    protected $mainImage;
87
88
    /**
89
     * @ORM\Column(name="second_image", type="string", length=255, nullable=true)
90
     */
91
    protected $secondImage;
92
93
    /**
94
     * @ORM\Column(name="broadcast_facebook",type="boolean", nullable=true)
95
     */
96
    protected $broadcastFacebook = 0;
97
98
    /**
99
     * @ORM\Column(name="broadcast_platform",type="boolean", nullable=true)
100
     */
101
    protected $broadcastPlatform = 0;
102
103
    /**
104
     * @ORM\Column(name="broadcast_embed",type="boolean", nullable=true)
105
     */
106
    protected $broadcastEmbed = 0;
107
108
    /**
109
     * @ORM\Column(name="push_home",type="boolean", nullable=true)
110
     */
111
    protected $pushHome = 0;
112
113
    /**
114
     * @ORM\Column(name="display_home",type="boolean", nullable=true)
115
     */
116
    protected $displayHome = 0;
117
118
    /**
119
     * @ORM\Column(name="mail_winner",type="boolean", nullable=true)
120
     */
121
    protected $mailWinner = 0;
122
123
    /**
124
     * @Gedmo\Translatable
125
     * @ORM\Column(name="mail_winner_block", type="text", nullable=true)
126
     */
127
    protected $mailWinnerBlock;
128
129
    /**
130
     * @ORM\Column(name="mail_looser",type="boolean", nullable=true)
131
     */
132
    protected $mailLooser = 0;
133
134
    /**
135
     * @Gedmo\Translatable
136
     * @ORM\Column(name="mail_looser_block", type="text", nullable=true)
137
     */
138
    protected $mailLooserBlock;
139
140
    /**
141
     * @ORM\Column(type="boolean", nullable=false)
142
     */
143
    protected $active = 0;
144
145
    /**
146
     * @ORM\Column(type="boolean", nullable=false)
147
     */
148
    protected $onInvitation = false;
149
150
    /**
151
     * @ORM\OneToMany(targetEntity="Invitation", mappedBy="game", cascade={"persist","remove"}, orphanRemoval=true)
152
     */
153
    private $invitations;
154
155
    /**
156
     * @ORM\Column(name="anonymous_allowed",type="boolean", nullable=true)
157
     */
158
    protected $anonymousAllowed = 0;
159
    
160
    /**
161
     * This column can be filled in when anonymousAllowed = 1.
162
     * If you put a value, it has to be a field key from playerdata. This key will
163
     * then be used to identify a player (generally 'email')
164
     *
165
     * @ORM\Column(name="anonymous_identifier", type="text", nullable=true)
166
     */
167
    protected $anonymousIdentifier;
168
169
    /**
170
     * @ORM\Column(name="publication_date", type="datetime", nullable=true)
171
     */
172
    protected $publicationDate;
173
174
    /**
175
     * @ORM\Column(name="start_date", type="datetime", nullable=true)
176
     */
177
    protected $startDate;
178
179
    /**
180
     * @ORM\Column(name="end_date", type="datetime", nullable=true)
181
     */
182
    protected $endDate;
183
184
    /**
185
     * @ORM\Column(name="close_date", type="datetime", nullable=true)
186
     */
187
    protected $closeDate;
188
189
    /**
190
     * play limitation. 0 : No limit
191
     *
192
     * @ORM\Column(name="play_limit", type="integer", nullable=false)
193
     */
194
    protected $playLimit = 0;
195
196
    /**
197
     * this field is taken into account only if playLimit<>0.
198
     * if 'always' only $playLimit play by person for this game
199
     * if 'day' only $playLimit play by person a day
200
     * if 'week' only $playLimit play by person a week
201
     * if 'month' only $playLimit play by person a month
202
     * if 'year' only $playLimit play by person a year
203
     *
204
     * @ORM\Column(name="play_limit_scale", type="string", nullable=true)
205
     */
206
    protected $playLimitScale;
207
208
    /**
209
     * this field is used for offering a complementary play entry
210
     * (for example, when the player share the game). The entries
211
     * of type 'bonus' won't be taken into account in the calaculation
212
     * of the authorized playLimit.
213
     *
214
     * if 'none' or null no play bonus is offered
215
     * if 'per_entry' a play bonus is offered for each entry
216
     * if 'one' only one play bonus is offered for every entries of the game
217
     *
218
     * @ORM\Column(name="play_bonus", type="string", nullable=true)
219
     */
220
    protected $playBonus;
221
222
    /**
223
     * @ORM\Column(type="string", length=255, nullable=true)
224
     */
225
    protected $layout;
226
227
    /**
228
     * @ORM\Column(type="string", length=255, nullable=true)
229
     */
230
    protected $stylesheet;
231
232
    /**
233
     * @Gedmo\Translatable
234
     * @ORM\Column(name="welcome_block", type="text", nullable=true)
235
     */
236
    protected $welcomeBlock;
237
238
    /**
239
     * @Gedmo\Translatable
240
     * @ORM\Column(type="text", nullable=true)
241
     */
242
    protected $termsBlock;
243
244
    /**
245
     * @ORM\Column(name="terms_optin", type="boolean", nullable=true)
246
     */
247
    protected $termsOptin = 0;
248
249
    /**
250
     * @Gedmo\Translatable
251
     * @ORM\Column(type="text", nullable=true)
252
     */
253
    protected $conditionsBlock;
254
255
    // Adherence CMS de ces blocs à revoir
256
    /**
257
     * @Gedmo\Translatable
258
     * @ORM\Column(type="text", nullable=true)
259
     */
260
    protected $columnBlock1;
261
262
    /**
263
     * @Gedmo\Translatable
264
     * @ORM\Column(type="text", nullable=true)
265
     */
266
    protected $columnBlock2;
267
268
    /**
269
     * @Gedmo\Translatable
270
     * @ORM\Column(type="text", nullable=true)
271
     */
272
    protected $columnBlock3;
273
274
    /**
275
     * @ORM\OneToMany(targetEntity="Prize", mappedBy="game", cascade={"persist","remove"}, orphanRemoval=true)
276
     */
277
    private $prizes;
278
279
    /**
280
     * @ORM\Column(name="fb_app_id", type="string", nullable=true)
281
     */
282
    protected $fbAppId;
283
284
    /**
285
     * @Gedmo\Translatable
286
     * @ORM\Column(name="fb_page_tab_title", type="string", length=255, nullable=true)
287
     */
288
    protected $fbPageTabTitle;
289
290
    /**
291
     * @ORM\Column(name="fb_page_tab_image", type="string", length=255, nullable=true)
292
     */
293
    protected $fbPageTabImage;
294
295
    /**
296
     * @Gedmo\Translatable
297
     * @ORM\Column(name="fb_share_message", type="text", nullable=true)
298
     */
299
    protected $fbShareMessage;
300
301
    /**
302
     * @ORM\Column(name="fb_share_image", type="string", length=255, nullable=true)
303
     */
304
    protected $fbShareImage;
305
306
    /**
307
     * @Gedmo\Translatable
308
     * @ORM\Column(name="fb_request_message", type="text", nullable=true)
309
     */
310
    protected $fbRequestMessage;
311
312
    /**
313
     * @ORM\Column(type="boolean", nullable=true)
314
     */
315
    protected $fbFan = 0;
316
317
    /**
318
     * @Gedmo\Translatable
319
     * @ORM\Column(name="fb_fan_gate", type="text", nullable=true)
320
     */
321
    protected $fbFanGate;
322
323
    /**
324
     * @Gedmo\Translatable
325
     * @ORM\Column(name="tw_share_message", type="string", length=255, nullable=true)
326
     */
327
    protected $twShareMessage;
328
329
    /**
330
     * @ORM\Column(name="steps", type="string", length=255, nullable=true)
331
     */
332
    protected $steps = '{"0":"index","1":"play","2":"result","3":"bounce"}';
333
334
    /**
335
     * @ORM\Column(name="steps_views", type="string", length=255, nullable=true)
336
     */
337
    protected $stepsViews = '{"index":{},"play":{},"result":{},"bounce":{}}';
338
339
    /**
340
     * Doctrine accessible value of discriminator (field 'type' is not
341
     * accessible through query)
342
     * And I want to be able to sort game collection based on type
343
     * http://www.doctrine-project.org/jira/browse/DDC-707
344
     * @ORM\Column(name="class_type", type="string", length=255, nullable=false)
345
     */
346
    protected $classType;
347
348
    /**
349
     * @ORM\Column(name="created_at", type="datetime")
350
     */
351
    protected $createdAt;
352
353
    /**
354
     * @ORM\Column(name="updated_at", type="datetime")
355
     */
356
    protected $updatedAt;
357
358
    public function __construct()
359
    {
360
        $this->prizes = new ArrayCollection();
361
        $this->invitations = new ArrayCollection();
362
    }
363
364
    /**
365
     * @PrePersist
366
     */
367
    public function createChrono()
368
    {
369
        $this->createdAt = new \DateTime("now");
370
        $this->updatedAt = new \DateTime("now");
371
    }
372
373
    /**
374
     * @PreUpdate
375
     */
376
    public function updateChrono()
377
    {
378
        $this->updatedAt = new \DateTime("now");
379
    }
380
381
    /**
382
     *
383
     * @return the $id
384
     */
385
    public function getId()
386
    {
387
        return $this->id;
388
    }
389
390
    /**
391
     *
392
     * @param field_type $id
393
     */
394
    public function setId($id)
395
    {
396
        $this->id = $id;
397
398
        return $this;
399
    }
400
401
    /**
402
     * @return the $playerForm
403
     */
404
    public function getPlayerForm()
405
    {
406
        return $this->playerForm;
407
    }
408
409
    /**
410
     * @param field_type $playerForm
411
     */
412
    public function setPlayerForm($playerForm)
413
    {
414
        $this->playerForm = $playerForm;
415
416
        return $this;
417
    }
418
419
    /**
420
     *
421
     * @return the unknown_type
422
     */
423
    public function getPartner()
424
    {
425
        return $this->partner;
426
    }
427
428
    /**
429
     *
430
     * @param unknown_type $partner
431
     */
432
    public function setPartner($partner)
433
    {
434
        $this->partner = $partner;
435
436
        return $this;
437
    }
438
439
    /**
440
     *
441
     * @param unknown_type $prizeCategory
442
     */
443
    public function setPrizeCategory($prizeCategory)
444
    {
445
        $this->prizeCategory = $prizeCategory;
446
447
        return $this;
448
    }
449
450
    /**
451
     *
452
     * @return the unknown_type
453
     */
454
    public function getPrizeCategory()
455
    {
456
        return $this->prizeCategory;
457
    }
458
459
    /**
460
     *
461
     * @return the $title
462
     */
463
    public function getTitle()
464
    {
465
        return $this->title;
466
    }
467
468
    /**
469
     *
470
     * @param field_type $title
471
     */
472
    public function setTitle($title)
473
    {
474
        $this->title = $title;
475
476
        return $this;
477
    }
478
479
    /**
480
     *
481
     * @return the $identifier
482
     */
483
    public function getIdentifier()
484
    {
485
        return $this->identifier;
486
    }
487
488
    /**
489
     *
490
     * @param field_type $identifier
491
     */
492
    public function setIdentifier($identifier)
493
    {
494
        $this->identifier = $identifier;
495
496
        return $this;
497
    }
498
499
    /**
500
     * @return integer $anonymousAllowed
501
     */
502
    public function getAnonymousAllowed()
503
    {
504
        return $this->anonymousAllowed;
505
    }
506
507
    /**
508
     * @param number $anonymousAllowed
509
     */
510
    public function setAnonymousAllowed($anonymousAllowed)
511
    {
512
        $this->anonymousAllowed = $anonymousAllowed;
0 ignored issues
show
Documentation Bug introduced by
It seems like $anonymousAllowed can also be of type double. However, the property $anonymousAllowed is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

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

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
513
514
        return $this;
515
    }
516
517
    /**
518
     * @return the $anonymousIdentifier
519
     */
520
    public function getAnonymousIdentifier()
521
    {
522
        return $this->anonymousIdentifier;
523
    }
524
525
    /**
526
     * @param field_type $anonymousIdentifier
527
     */
528
    public function setAnonymousIdentifier($anonymousIdentifier)
529
    {
530
        $this->anonymousIdentifier = $anonymousIdentifier;
531
    }
532
533
    /**
534
     *
535
     * @return the $mainImage
536
     */
537
    public function getMainImage()
538
    {
539
        return $this->mainImage;
540
    }
541
542
    /**
543
     *
544
     * @param field_type $mainImage
545
     */
546
    public function setMainImage($mainImage)
547
    {
548
        $this->mainImage = $mainImage;
549
550
        return $this;
551
    }
552
553
    /**
554
     *
555
     * @return the $secondImage
556
     */
557
    public function getSecondImage()
558
    {
559
        return $this->secondImage;
560
    }
561
562
    /**
563
     *
564
     * @param field_type $secondImage
565
     */
566
    public function setSecondImage($secondImage)
567
    {
568
        $this->secondImage = $secondImage;
569
570
        return $this;
571
    }
572
573
    /**
574
     *
575
     * @return integer $broadcastFacebook
576
     */
577
    public function getBroadcastFacebook()
578
    {
579
        return $this->broadcastFacebook;
580
    }
581
582
    /**
583
     *
584
     * @param field_type $broadcastFacebook
585
     */
586
    public function setBroadcastFacebook($broadcastFacebook)
587
    {
588
        $this->broadcastFacebook = $broadcastFacebook;
0 ignored issues
show
Documentation Bug introduced by
It seems like $broadcastFacebook of type object<PlaygroundGame\Entity\field_type> is incompatible with the declared type integer of property $broadcastFacebook.

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...
589
590
        return $this;
591
    }
592
593
    /**
594
     *
595
     * @return integer $broadcastPlatform
596
     */
597
    public function getBroadcastPlatform()
598
    {
599
        return $this->broadcastPlatform;
600
    }
601
602
    /**
603
     *
604
     * @param field_type $broadcastPlatform
605
     */
606
    public function setBroadcastPlatform($broadcastPlatform)
607
    {
608
        $this->broadcastPlatform = $broadcastPlatform;
0 ignored issues
show
Documentation Bug introduced by
It seems like $broadcastPlatform of type object<PlaygroundGame\Entity\field_type> is incompatible with the declared type integer of property $broadcastPlatform.

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...
609
610
        return $this;
611
    }
612
613
    /**
614
     * @return integer $broadcastEmbed
615
     */
616
    public function getBroadcastEmbed()
617
    {
618
        return $this->broadcastEmbed;
619
    }
620
621
    /**
622
     * @param number $broadcastEmbed
623
     */
624
    public function setBroadcastEmbed($broadcastEmbed)
625
    {
626
        $this->broadcastEmbed = $broadcastEmbed;
0 ignored issues
show
Documentation Bug introduced by
It seems like $broadcastEmbed can also be of type double. However, the property $broadcastEmbed is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

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

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
627
628
        return $this;
629
    }
630
631
    /**
632
     * @return integer $mailWinner
633
     */
634
    public function getMailWinner()
635
    {
636
        return $this->mailWinner;
637
    }
638
639
    /**
640
     * @param number $mailWinner
641
     */
642
    public function setMailWinner($mailWinner)
643
    {
644
        $this->mailWinner = $mailWinner;
0 ignored issues
show
Documentation Bug introduced by
It seems like $mailWinner can also be of type double. However, the property $mailWinner is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

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

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
645
    }
646
647
    /**
648
     * @return the $mailWinnerBlock
649
     */
650
    public function getMailWinnerBlock()
651
    {
652
        return $this->mailWinnerBlock;
653
    }
654
655
    /**
656
     * @param field_type $mailWinnerBlock
657
     */
658
    public function setMailWinnerBlock($mailWinnerBlock)
659
    {
660
        $this->mailWinnerBlock = $mailWinnerBlock;
661
    }
662
663
    /**
664
     * @return integer $mailLooser
665
     */
666
    public function getMailLooser()
667
    {
668
        return $this->mailLooser;
669
    }
670
671
    /**
672
     * @param number $mailLooser
673
     */
674
    public function setMailLooser($mailLooser)
675
    {
676
        $this->mailLooser = $mailLooser;
0 ignored issues
show
Documentation Bug introduced by
It seems like $mailLooser can also be of type double. However, the property $mailLooser is declared as type integer. Maybe add an additional type check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.

For example, imagine you have a variable $accountId that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to the id property of an instance of the Account class. This class holds a proper account, so the id value must no longer be false.

Either this assignment is in error or a type check should be added for that assignment.

class Id
{
    public $id;

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

}

class Account
{
    /** @var  Id $id */
    public $id;
}

$account_id = false;

if (starsAreRight()) {
    $account_id = new Id(42);
}

$account = new Account();
if ($account instanceof Id)
{
    $account->id = $account_id;
}
Loading history...
677
    }
678
679
    /**
680
     * @return the $mailLooserBlock
681
     */
682
    public function getMailLooserBlock()
683
    {
684
        return $this->mailLooserBlock;
685
    }
686
687
    /**
688
     * @param field_type $mailLooserBlock
689
     */
690
    public function setMailLooserBlock($mailLooserBlock)
691
    {
692
        $this->mailLooserBlock = $mailLooserBlock;
693
    }
694
695
    /**
696
     *
697
     * @return integer $pushHome
698
     */
699
    public function getPushHome()
700
    {
701
        return $this->pushHome;
702
    }
703
704
    /**
705
     *
706
     * @param field_type $pushHome
707
     */
708
    public function setPushHome($pushHome)
709
    {
710
        $this->pushHome = $pushHome;
0 ignored issues
show
Documentation Bug introduced by
It seems like $pushHome of type object<PlaygroundGame\Entity\field_type> is incompatible with the declared type integer of property $pushHome.

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...
711
712
        return $this;
713
    }
714
715
    /**
716
     *
717
     * @return integer $displayHome
718
     */
719
    public function getDisplayHome()
720
    {
721
        return $this->displayHome;
722
    }
723
724
    /**
725
     *
726
     * @param field_type $displayHome
727
     */
728
    public function setDisplayHome($displayHome)
729
    {
730
        $this->displayHome = $displayHome;
0 ignored issues
show
Documentation Bug introduced by
It seems like $displayHome of type object<PlaygroundGame\Entity\field_type> is incompatible with the declared type integer of property $displayHome.

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...
731
732
        return $this;
733
    }
734
735
    /**
736
     *
737
     * @return the $publicationDate
738
     */
739
    public function getPublicationDate()
740
    {
741
        return $this->publicationDate;
742
    }
743
744
    /**
745
     *
746
     * @param field_type $publicationDate
747
     */
748
    public function setPublicationDate($publicationDate)
749
    {
750
        $this->publicationDate = $publicationDate;
751
752
        return $this;
753
    }
754
755
    /**
756
     *
757
     * @return the $startDate
758
     */
759
    public function getStartDate()
760
    {
761
        return $this->startDate;
762
    }
763
764
    /**
765
     *
766
     * @param field_type $startDate
767
     */
768
    public function setStartDate($startDate)
769
    {
770
        $this->startDate = $startDate;
771
772
        return $this;
773
    }
774
775
    /**
776
     *
777
     * @return the $endDate
778
     */
779
    public function getEndDate()
780
    {
781
        return $this->endDate;
782
    }
783
784
    /**
785
     *
786
     * @param field_type $endDate
787
     */
788
    public function setEndDate($endDate)
789
    {
790
        $this->endDate = $endDate;
791
792
        return $this;
793
    }
794
795
    /**
796
     *
797
     * @return the $closeDate
798
     */
799
    public function getCloseDate()
800
    {
801
        return $this->closeDate;
802
    }
803
804
    /**
805
     *
806
     * @param field_type $closeDate
807
     */
808
    public function setCloseDate($closeDate)
809
    {
810
        $this->closeDate = $closeDate;
811
812
        return $this;
813
    }
814
815 View Code Duplication
    public function isClosed()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
816
    {
817
        $today = new DateTime('now');
818
        if (($this->getCloseDate() && $this->getCloseDate()->setTime(23, 59, 59) < $today)
819
            ||
820
            ($this->getPublicationDate() && $this->getPublicationDate()->setTime(0, 0, 0) > $today)
821
        ) {
822
            return true;
823
        }
824
825
        return false;
826
    }
827
828
    public function isOpen()
829
    {
830
        return !$this->isClosed();
831
    }
832
833 View Code Duplication
    public function isStarted()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
834
    {
835
        $today = new DateTime('now');
836
        if (((!$this->getStartDate() || $this->getStartDate()->setTime(0, 0, 0) <= $today))
837
                &&
838
                (!$this->getEndDate() || $this->getEndDate()->setTime(23, 59, 59) > $today)
839
        ) {
840
            return true;
841
        }
842
843
        return false;
844
    }
845
846 View Code Duplication
    public function isFinished()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
847
    {
848
        $today = new DateTime('now');
849
        if ($this->getEndDate() && $this->getEndDate()->setTime(23, 59, 59) <= $today
850
            ||
851
            ($this->getCloseDate() && $this->getCloseDate()->setTime(23, 59, 59) <= $today)
852
        ) {
853
            return true;
854
        }
855
856
        return false;
857
    }
858
859
    public function isOnline()
860
    {
861
        if ($this->getActive() && $this->getBroadcastPlatform()) {
862
            return true;
863
        }
864
865
        return false;
866
    }
867
868
    // json array : {"0":"index","1":"play","2":"result","3":"bounce"}
869 View Code Duplication
    public function getStepsArray()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
870
    {
871
        $steps = null;
872
873
        if ($this->getSteps()) {
874
            $steps = json_decode($this->getSteps(), true);
875
        }
876
        if (!$steps) {
877
            $steps = array('index','play','result','bounce');
878
        }
879
        return $steps;
880
    }
881
882
883
884 View Code Duplication
    public function getStepsViewsArray()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
885
    {
886
        $viewSteps = null;
887
888
        if ($this->getStepsViews()) {
889
            $viewSteps = json_decode($this->getStepsViews(), true);
890
        }
891
        if (!$viewSteps) {
892
            $viewSteps = array('index','play','result','bounce');
893
        }
894
895
        return $viewSteps;
896
    }
897
898
    public function getSteps()
899
    {
900
        return $this->steps;
901
    }
902
903
    public function setSteps($steps)
904
    {
905
        $this->steps = $steps;
906
907
        return $this;
908
    }
909
910
    /**
911
     * This method returns the first step in the game workflow
912
     * @return string
913
     */
914
    public function firstStep()
915
    {
916
        $steps = $this->getStepsArray();
917
918
        return $steps[0];
919
    }
920
921
    /**
922
     * This method returns the last step in the game workflow
923
     * @return string
924
     */
925
    public function lastStep()
926
    {
927
        $steps = $this->getStepsArray();
928
        $nbSteps = count($steps);
929
930
        return $steps[$nbSteps-1];
931
    }
932
933
    /**
934
     * This method returns the previous step in the game workflow
935
     * @param string $step
936
     * @return string
937
     */
938 View Code Duplication
    public function previousStep($step = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
939
    {
940
        $steps = $this->getStepsArray();
941
        $key = array_search($step, $steps);
942
943
        if (is_int($key) && $key > 0) {
944
            return $steps[$key-1];
945
        }
946
947
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return false; (false) is incompatible with the return type documented by PlaygroundGame\Entity\Game::previousStep of type string.

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...
948
    }
949
950
    /**
951
     * This method returns the next step in the game workflow
952
     * @param string $step
953
     * @return string
954
     */
955 View Code Duplication
    public function nextStep($step = null)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
956
    {
957
        $steps = $this->getStepsArray();
958
        $key = array_search($step, $steps);
959
960
        if (is_int($key) && $key < count($steps)-1) {
961
            return $steps[$key+1];
962
        }
963
964
        return false;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return false; (false) is incompatible with the return type documented by PlaygroundGame\Entity\Game::nextStep of type string.

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...
965
    }
966
967
    /**
968
     * @return string $stepsViews
969
     */
970
    public function getStepsViews()
971
    {
972
        return $this->stepsViews;
973
    }
974
975
    /**
976
     * @param string $stepsViews
977
     */
978
    public function setStepsViews($stepsViews)
979
    {
980
        $this->stepsViews = $stepsViews;
981
982
        return $this;
983
    }
984
985
    public function getState()
986
    {
987
        if ($this->isOpen()) {
988
            if (!$this->isStarted() && !$this->isFinished()) {
989
                return self::GAME_PUBLISHED;
990
            } elseif ($this->isStarted()) {
991
                return self::GAME_IN_PROGRESS;
992
            } elseif ($this->isFinished()) {
993
                return self::GAME_FINISHED;
994
            }
995
        } else {
996
            if ($this->isFinished()) {
997
                return self::GAME_CLOSED;
998
            } else {
999
                return self::GAME_SCHEDULE;
1000
            }
1001
        }
1002
    }
1003
1004
    /**
1005
     * @return integer unknown_type
1006
     */
1007
    public function getPlayLimit()
1008
    {
1009
        return $this->playLimit;
1010
    }
1011
1012
    /**
1013
     * @param unknown_type $playLimit
1014
     */
1015
    public function setPlayLimit($playLimit)
1016
    {
1017
        $this->playLimit = $playLimit;
0 ignored issues
show
Documentation Bug introduced by
It seems like $playLimit of type object<PlaygroundGame\Entity\unknown_type> is incompatible with the declared type integer of property $playLimit.

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...
1018
1019
        return $this;
1020
    }
1021
1022
    /**
1023
     * @return the unknown_type
1024
     */
1025
    public function getPlayLimitScale()
1026
    {
1027
        return $this->playLimitScale;
1028
    }
1029
1030
    /**
1031
     * @param unknown_type $playLimitScale
1032
     */
1033
    public function setPlayLimitScale($playLimitScale)
1034
    {
1035
        $this->playLimitScale = $playLimitScale;
1036
1037
        return $this;
1038
    }
1039
1040
    /**
1041
     * @return the unknown_type
1042
     */
1043
    public function getPlayBonus()
1044
    {
1045
        return $this->playBonus;
1046
    }
1047
1048
    /**
1049
     * @param unknown_type $playBonus
1050
     */
1051
    public function setPlayBonus($playBonus)
1052
    {
1053
        $this->playBonus = $playBonus;
1054
1055
        return $this;
1056
    }
1057
1058
    /**
1059
     *
1060
     * @return the $layout
1061
     */
1062
    public function getLayout()
1063
    {
1064
        return $this->layout;
1065
    }
1066
1067
    /**
1068
     *
1069
     * @param field_type $layout
1070
     */
1071
    public function setLayout($layout)
1072
    {
1073
        $this->layout = $layout;
1074
1075
        return $this;
1076
    }
1077
1078
    /**
1079
     *
1080
     * @return the $stylesheet
1081
     */
1082
    public function getStylesheet()
1083
    {
1084
        return $this->stylesheet;
1085
    }
1086
1087
    /**
1088
     *
1089
     * @param field_type $stylesheet
1090
     */
1091
    public function setStylesheet($stylesheet)
1092
    {
1093
        $this->stylesheet = $stylesheet;
1094
1095
        return $this;
1096
    }
1097
1098
    /**
1099
     *
1100
     * @return the $welcomeBlock
1101
     */
1102
    public function getWelcomeBlock()
1103
    {
1104
        return $this->welcomeBlock;
1105
    }
1106
1107
    /**
1108
     *
1109
     * @param field_type $welcomeBlock
1110
     */
1111
    public function setWelcomeBlock($welcomeBlock)
1112
    {
1113
        $this->welcomeBlock = $welcomeBlock;
1114
1115
        return $this;
1116
    }
1117
1118
    /**
1119
     *
1120
     * @return the $termsBlock
1121
     */
1122
    public function getTermsBlock()
1123
    {
1124
        return $this->termsBlock;
1125
    }
1126
1127
    /**
1128
     *
1129
     * @param text $termsBlock
1130
     */
1131
    public function setTermsBlock($termsBlock)
1132
    {
1133
        $this->termsBlock = $termsBlock;
1134
1135
        return $this;
1136
    }
1137
1138
    /**
1139
     *
1140
     * @return integer $termsOptin
1141
     */
1142
    public function getTermsOptin()
1143
    {
1144
        return $this->termsOptin;
1145
    }
1146
1147
    /**
1148
     *
1149
     * @param text $termsOptin
1150
     */
1151
    public function setTermsOptin($termsOptin)
1152
    {
1153
        $this->termsOptin = $termsOptin;
0 ignored issues
show
Documentation Bug introduced by
It seems like $termsOptin of type object<PlaygroundGame\Entity\text> is incompatible with the declared type integer of property $termsOptin.

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...
1154
1155
        return $this;
1156
    }
1157
1158
    /**
1159
     *
1160
     * @return the $conditionsBlock
1161
     */
1162
    public function getConditionsBlock()
1163
    {
1164
        return $this->conditionsBlock;
1165
    }
1166
1167
    /**
1168
     *
1169
     * @param text $conditionsBlock
1170
     */
1171
    public function setConditionsBlock($conditionsBlock)
1172
    {
1173
        $this->conditionsBlock = $conditionsBlock;
1174
1175
        return $this;
1176
    }
1177
1178
    /**
1179
     *
1180
     * @return the $columnBlock1
1181
     */
1182
    public function getColumnBlock1()
1183
    {
1184
        return $this->columnBlock1;
1185
    }
1186
1187
    /**
1188
     *
1189
     * @param text $columnBlock1
1190
     */
1191
    public function setColumnBlock1($columnBlock1)
1192
    {
1193
        $this->columnBlock1 = $columnBlock1;
1194
1195
        return $this;
1196
    }
1197
1198
    /**
1199
     *
1200
     * @return the $columnBlock2
1201
     */
1202
    public function getColumnBlock2()
1203
    {
1204
        return $this->columnBlock2;
1205
    }
1206
1207
    /**
1208
     *
1209
     * @param text $columnBlock2
1210
     */
1211
    public function setColumnBlock2($columnBlock2)
1212
    {
1213
        $this->columnBlock2 = $columnBlock2;
1214
1215
        return $this;
1216
    }
1217
1218
    /**
1219
     *
1220
     * @return the $columnBlock3
1221
     */
1222
    public function getColumnBlock3()
1223
    {
1224
        return $this->columnBlock3;
1225
    }
1226
1227
    /**
1228
     *
1229
     * @param text $columnBlock3
1230
     */
1231
    public function setColumnBlock3($columnBlock3)
1232
    {
1233
        $this->columnBlock3 = $columnBlock3;
1234
1235
        return $this;
1236
    }
1237
1238
    /**
1239
     * @return ArrayCollection unknown_type
1240
     */
1241
    public function getPrizes()
1242
    {
1243
        return $this->prizes;
1244
    }
1245
1246
    /**
1247
     * frm collection solution
1248
     * @param ArrayCollection $prizes
1249
     */
1250
    public function setPrizes(ArrayCollection $prizes)
1251
    {
1252
        $this->prizes = $prizes;
1253
1254
        return $this;
1255
    }
1256
1257
    public function addPrizes(ArrayCollection $prizes)
1258
    {
1259
        foreach ($prizes as $prize) {
1260
            $prize->setGame($this);
1261
            $this->prizes->add($prize);
1262
        }
1263
    }
1264
1265
1266
    public function removePrizes(ArrayCollection $prizes)
1267
    {
1268
        foreach ($prizes as $prize) {
1269
            $prize->setGame(null);
1270
            $this->prizes->removeElement($prize);
1271
        }
1272
    }
1273
1274
    /**
1275
     * Add a prize to the game.
1276
     *
1277
     * @param Prize $prize
1278
     *
1279
     * @return void
1280
     */
1281
    public function addPrize($prize)
1282
    {
1283
        $this->prizes[] = $prize;
1284
    }
1285
1286
    /**
1287
     *
1288
     * @return string $classType
1289
     */
1290
    public function getClassType()
1291
    {
1292
        return $this->classType;
1293
    }
1294
1295
    /**
1296
     *
1297
     * @param string classType
1298
     * @param string $classType
1299
     */
1300
    public function setClassType($classType)
1301
    {
1302
        $this->classType = $classType;
1303
1304
        return $this;
1305
    }
1306
1307
    /**
1308
     *
1309
     * @return integer unknown_type
1310
     */
1311
    public function getActive()
1312
    {
1313
        return $this->active;
1314
    }
1315
1316
    /**
1317
     *
1318
     * @param unknown_type $active
1319
     */
1320
    public function setActive($active)
1321
    {
1322
        $this->active = $active;
0 ignored issues
show
Documentation Bug introduced by
It seems like $active of type object<PlaygroundGame\Entity\unknown_type> is incompatible with the declared type integer of property $active.

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...
1323
1324
        return $this;
1325
    }
1326
1327
    /**
1328
     *
1329
     * @return boolean $onInvitation
1330
     */
1331
    public function getOnInvitation()
1332
    {
1333
        return $this->onInvitation;
1334
    }
1335
1336
    /**
1337
     *
1338
     * @param boolean $onInvitation
1339
     */
1340
    public function setOnInvitation($onInvitation)
1341
    {
1342
        $this->onInvitation = $onInvitation;
1343
1344
        return $this;
1345
    }
1346
1347
    /**
1348
     * @return ArrayCollection unknown_type
1349
     */
1350
    public function getInvitations()
1351
    {
1352
        return $this->invitations;
1353
    }
1354
1355
    /**
1356
     * @param ArrayCollection $invitations
1357
     */
1358
    public function setInvitations(ArrayCollection $invitations)
1359
    {
1360
        $this->invitations = $invitations;
1361
1362
        return $this;
1363
    }
1364
1365
    public function addInvitations(ArrayCollection $invitations)
1366
    {
1367
        foreach ($invitations as $invitation) {
1368
            $invitation->setGame($this);
1369
            $this->invitations->add($invitation);
1370
        }
1371
    }
1372
1373
    public function removeInvitations(ArrayCollection $invitations)
1374
    {
1375
        foreach ($invitations as $invitation) {
1376
            $prize->setGame(null);
0 ignored issues
show
Bug introduced by
The variable $prize does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
1377
            $this->invitations->removeElement($invitation);
1378
        }
1379
    }
1380
1381
    /**
1382
     * Add an invitation to the game.
1383
     *
1384
     * @param Invitation $invitation
1385
     *
1386
     * @return void
1387
     */
1388
    public function addInvitation($invitation)
1389
    {
1390
        $this->invitations[] = $invitation;
1391
    }
1392
1393
    /**
1394
     *
1395
     * @return string the Facebook app_id
1396
     */
1397
    public function getFbAppId()
1398
    {
1399
        return $this->fbAppId;
1400
    }
1401
1402
    /**
1403
     *
1404
     * @param string $fbAppId
1405
     */
1406
    public function setFbAppId($fbAppId)
1407
    {
1408
        $this->fbAppId = $fbAppId;
1409
1410
        return $this;
1411
    }
1412
1413
    /**
1414
     *
1415
     * @return string the Facebook fbPageTabTitle
1416
     */
1417
    public function getFbPageTabTitle()
1418
    {
1419
        return $this->fbPageTabTitle;
1420
    }
1421
1422
    /**
1423
     *
1424
     * @param string $fbPageTabTitle
1425
     */
1426
    public function setFbPageTabTitle($fbPageTabTitle)
1427
    {
1428
        $this->fbPageTabTitle = $fbPageTabTitle;
1429
1430
        return $this;
1431
    }
1432
1433
    /**
1434
     *
1435
     * @return string the Facebook fbPageTabImage
1436
     */
1437
    public function getFbPageTabImage()
1438
    {
1439
        return $this->fbPageTabImage;
1440
    }
1441
1442
    /**
1443
     *
1444
     * @param string $fbPageTabImage
1445
     */
1446
    public function setFbPageTabImage($fbPageTabImage)
1447
    {
1448
        $this->fbPageTabImage = $fbPageTabImage;
1449
1450
        return $this;
1451
    }
1452
1453
    /**
1454
     *
1455
     * @return the unknown_type
1456
     */
1457
    public function getFbShareMessage()
1458
    {
1459
        return $this->fbShareMessage;
1460
    }
1461
1462
    /**
1463
     *
1464
     * @param unknown_type $fbShareMessage
1465
     */
1466
    public function setFbShareMessage($fbShareMessage)
1467
    {
1468
        $this->fbShareMessage = $fbShareMessage;
1469
1470
        return $this;
1471
    }
1472
1473
    /**
1474
     *
1475
     * @return the unknown_type
1476
     */
1477
    public function getFbShareImage()
1478
    {
1479
        return $this->fbShareImage;
1480
    }
1481
1482
    /**
1483
     *
1484
     * @param unknown_type $fbShareImage
1485
     */
1486
    public function setFbShareImage($fbShareImage)
1487
    {
1488
        $this->fbShareImage = $fbShareImage;
1489
1490
        return $this;
1491
    }
1492
1493
    /**
1494
     *
1495
     * @return string unknown_type
1496
     */
1497
    public function getFbRequestMessage()
1498
    {
1499
        return $this->fbRequestMessage;
1500
    }
1501
1502
    /**
1503
     *
1504
     * @param unknown_type $fbRequestMessage
1505
     */
1506
    public function setFbRequestMessage($fbRequestMessage)
1507
    {
1508
        $this->fbRequestMessage = $fbRequestMessage;
1509
1510
        return $this;
1511
    }
1512
1513
    /**
1514
     *
1515
     * @return integer fbFan
1516
     */
1517
    public function getFbFan()
1518
    {
1519
        return $this->fbFan;
1520
    }
1521
1522
    /**
1523
     *
1524
     * @param unknown_type $fbFan
1525
     */
1526
    public function setFbFan($fbFan)
1527
    {
1528
        $this->fbFan = $fbFan;
0 ignored issues
show
Documentation Bug introduced by
It seems like $fbFan of type object<PlaygroundGame\Entity\unknown_type> is incompatible with the declared type integer of property $fbFan.

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...
1529
1530
        return $this;
1531
    }
1532
1533
    /**
1534
     *
1535
     * @return the fbFanGate
1536
     */
1537
    public function getFbFanGate()
1538
    {
1539
        return $this->fbFanGate;
1540
    }
1541
1542
    /**
1543
     *
1544
     * @param unknown_type $fbFanGate
1545
     */
1546
    public function setFbFanGate($fbFanGate)
1547
    {
1548
        $this->fbFanGate = $fbFanGate;
1549
1550
        return $this;
1551
    }
1552
1553
    /**
1554
     *
1555
     * @return the unknown_type
1556
     */
1557
    public function getTwShareMessage()
1558
    {
1559
        return $this->twShareMessage;
1560
    }
1561
1562
    /**
1563
     *
1564
     * @param unknown_type $twShareMessage
1565
     */
1566
    public function setTwShareMessage($twShareMessage)
1567
    {
1568
        $this->twShareMessage = $twShareMessage;
1569
1570
        return $this;
1571
    }
1572
1573
    /**
1574
     *
1575
     * @return DateTime $createdAt
1576
     */
1577
    public function getCreatedAt()
1578
    {
1579
        return $this->createdAt;
1580
    }
1581
1582
    /**
1583
     *
1584
     * @param \DateTime $createdAt
1585
     */
1586
    public function setCreatedAt($createdAt)
1587
    {
1588
        $this->createdAt = $createdAt;
1589
1590
        return $this;
1591
    }
1592
1593
    /**
1594
     *
1595
     * @return DateTime $updatedAt
1596
     */
1597
    public function getUpdatedAt()
1598
    {
1599
        return $this->updatedAt;
1600
    }
1601
1602
    /**
1603
     *
1604
     * @param \DateTime $updatedAt
1605
     */
1606
    public function setUpdatedAt($updatedAt)
1607
    {
1608
        $this->updatedAt = $updatedAt;
1609
1610
        return $this;
1611
    }
1612
1613
    /**
1614
     * Convert the object to an array.
1615
     *
1616
     * @return array
1617
     */
1618
    public function getArrayCopy()
1619
    {
1620
        $obj_vars = get_object_vars($this);
1621
1622 View Code Duplication
        if (isset($obj_vars['publicationDate']) && $obj_vars['publicationDate'] !== null) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1623
            $obj_vars['publicationDate'] = $obj_vars['publicationDate']->format('d/m/Y');
1624
        }
1625
1626 View Code Duplication
        if (isset($obj_vars['endDate']) && $obj_vars['endDate'] !== null) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1627
            $obj_vars['endDate'] = $obj_vars['endDate']->format('d/m/Y');
1628
        }
1629 View Code Duplication
        if (isset($obj_vars['startDate']) && $obj_vars['startDate'] !== null) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1630
            $obj_vars['startDate'] = $obj_vars['startDate']->format('d/m/Y');
1631
        }
1632
1633
        return $obj_vars;
1634
    }
1635
1636
    /**
1637
     * Convert the object to json.
1638
     *
1639
     * @return array
1640
     */
1641
    public function jsonSerialize()
1642
    {
1643
        return $this->getArrayCopy();
1644
    }
1645
1646
    /**
1647
     * Populate from an array.
1648
     *
1649
     * @param array $data
1650
     */
1651
    public function populate($data = array())
1652
    {
1653
        if (isset($data['partner']) && $data['partner'] !== null) {
1654
            $this->partner = $data['partner'];
1655
        }
1656
1657
        $this->title = (isset($data['title'])) ? $data['title'] : null;
1658
        $this->type = (isset($data['type']) && $data['type'] !== null) ? $data['type'] : null;
1659
1660
        if (isset($data['mainImage']) && $data['mainImage'] !== null) {
1661
            $this->mainImage = $data['mainImage'];
1662
        }
1663
1664
        if (isset($data['secondImage']) && $data['secondImage'] !== null) {
1665
            $this->secondImage = $data['secondImage'];
1666
        }
1667
1668 View Code Duplication
        if (isset($data['active']) && $data['active'] !== null) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
1669
            $this->active = $data['active'];
1670
        }
1671
1672
        $this->layout           = (isset($data['layout'])) ? $data['layout'] : null;
1673
        $this->stylesheet       = (isset($data['stylesheet'])) ? $data['stylesheet'] : null;
1674
1675
        $this->pushHome         = (isset($data['pushHome']) && $data['pushHome'] !== null) ? $data['pushHome'] : 0;
1676
        $this->displayHome      = (isset($data['displayHome']) && $data['displayHome'] !== null) ?
1677
            $data['displayHome'] :
1678
            0;
1679
        $this->prizeCategory   = (isset($data['prizeCategory'])) ? $data['prizeCategory'] : null;
1680
1681
        $this->publicationDate  = (isset($data['publicationDate']) && $data['publicationDate'] !== null) ?
1682
            DateTime::createFromFormat('d/m/Y', $data['publicationDate']) :
1683
            null;
1684
        $this->endDate         = (isset($data['endDate']) && $data['endDate'] !== null) ?
1685
            DateTime::createFromFormat('d/m/Y', $data['endDate']) :
1686
            null;
1687
        $this->startDate       = (isset($data['startDate']) && $data['startDate'] !== null) ?
1688
            DateTime::createFromFormat('d/m/Y', $data['startDate']) :
1689
            null;
1690
1691
        $this->identifier       = (isset($data['identifier'])) ? $data['identifier'] : null;
1692
        $this->welcomeBlock    = (isset($data['welcomeBlock'])) ? $data['welcomeBlock'] : null;
1693
        $this->termsBlock       = (isset($data['termsBlock'])) ? $data['termsBlock'] : null;
1694
        $this->conditionsBlock  = (isset($data['conditionsBlock'])) ? $data['conditionsBlock'] : null;
1695
        $this->columnBlock1     = (isset($data['columnBlock1'])) ? $data['columnBlock1'] : null;
1696
        $this->columnBlock2     = (isset($data['columnBlock2'])) ? $data['columnBlock2'] : null;
1697
        $this->columnBlock3     = (isset($data['columnBlock3'])) ? $data['columnBlock3'] : null;
1698
1699
        $this->fbShareMessage   = (isset($data['fbShareMessage'])) ? $data['fbShareMessage'] : null;
1700
        $this->fbShareImage     = (isset($data['fbShareImage'])) ? $data['fbShareImage'] : null;
1701
        $this->fbRequestMessage = (isset($data['fbRequestMessage'])) ? $data['fbRequestMessage'] : null;
1702
        $this->twShareMessage   = (isset($data['twShareMessage'])) ? $data['twShareMessage'] : null;
1703
    }
1704
1705
    public function setInputFilter(InputFilterInterface $inputFilter)
1706
    {
1707
        throw new \Exception("Not used");
1708
    }
1709
1710
    public function getInputFilter()
1711
    {
1712
        if (! $this->inputFilter) {
1713
            $inputFilter = new InputFilter();
1714
            $factory = new InputFactory();
1715
1716
            $inputFilter->add($factory->createInput(array(
1717
                'name' => 'id',
1718
                'required' => true,
1719
                'filters' => array(
1720
                    array(
1721
                        'name' => 'Int'
1722
                    )
1723
                )
1724
            )));
1725
1726
            $inputFilter->add($factory->createInput(array(
1727
                'name' => 'partner',
1728
                'required' => false
1729
            )));
1730
1731
            $inputFilter->add($factory->createInput(array(
1732
                'name' => 'fbAppId',
1733
                'required' => false
1734
            )));
1735
1736
            $inputFilter->add($factory->createInput(array(
1737
               'name' => 'fbFan',
1738
               'required' => false
1739
            )));
1740
1741
            $inputFilter->add($factory->createInput(array(
1742
                'name' => 'fbFanGate',
1743
                'required' => false
1744
            )));
1745
1746
            $inputFilter->add($factory->createInput(array(
1747
                'name' => 'prizes',
1748
                'required' => false
1749
            )));
1750
1751
            $inputFilter->add($factory->createInput(array(
1752
                'name' => 'invitations',
1753
                'required' => false
1754
            )));
1755
1756
            $inputFilter->add($factory->createInput(array(
1757
                'name' => 'title',
1758
                'required' => true,
1759
                'filters' => array(
1760
                    array(
1761
                        'name' => 'StripTags'
1762
                    ),
1763
                    array(
1764
                        'name' => 'StringTrim'
1765
                    )
1766
                ),
1767
                'validators' => array(
1768
                    array(
1769
                        'name' => 'StringLength',
1770
                        'options' => array(
1771
                            'encoding' => 'UTF-8',
1772
                            'min' => 5,
1773
                            'max' => 255
1774
                        )
1775
                    )
1776
                )
1777
            )));
1778
1779
            $inputFilter->add($factory->createInput(array(
1780
                'name' => 'publicationDate',
1781
                'required' => false,
1782
            )));
1783
1784
            $inputFilter->add($factory->createInput(array(
1785
                'name' => 'startDate',
1786
                'required' => false,
1787
            )));
1788
1789
            $inputFilter->add($factory->createInput(array(
1790
                'name' => 'endDate',
1791
                'required' => false,
1792
            )));
1793
1794
            $inputFilter->add($factory->createInput(array(
1795
               'name' => 'closeDate',
1796
               'required' => false,
1797
            )));
1798
1799
            $inputFilter->add($factory->createInput(array(
1800
                'name' => 'termsOptin',
1801
                'required' => false,
1802
            )));
1803
1804
            $inputFilter->add($factory->createInput(array(
1805
                'name' => 'identifier',
1806
                'required' => true,
1807
                'filters' => array(
1808
                    array(
1809
                        'name' => 'StripTags'
1810
                    ),
1811
                    array(
1812
                        'name' => 'StringTrim'
1813
                    ),
1814
                    array(
1815
                        'name' => 'PlaygroundCore\Filter\Slugify'
1816
                    )
1817
                ),
1818
                'validators' => array(
1819
                    array(
1820
                        'name' => 'StringLength',
1821
                        'options' => array(
1822
                            'encoding' => 'UTF-8',
1823
                            'min' => 3,
1824
                            'max' => 255
1825
                        )
1826
                    )
1827
                )
1828
            )));
1829
1830
            $inputFilter->add($factory->createInput(array(
1831
                'name'     => 'playLimit',
1832
                'required' => false,
1833
                'validators' => array(
1834
                    array(
1835
                        'name'    => 'Between',
1836
                        'options' => array(
1837
                            'min'      => 0,
1838
                            'max'      => 999999,
1839
                        ),
1840
                    ),
1841
                ),
1842
            )));
1843
1844
            $inputFilter->add($factory->createInput(array(
1845
                'name' => 'playLimitScale',
1846
                'required' => false,
1847
                'validators' => array(
1848
                    array(
1849
                        'name' => 'InArray',
1850
                        'options' => array(
1851
                            'haystack' => array('day', 'week', 'month', 'year', 'always'),
1852
                        ),
1853
                    ),
1854
                ),
1855
            )));
1856
1857
            $inputFilter->add($factory->createInput(array(
1858
                'name' => 'playBonus',
1859
                'required' => false,
1860
                'validators' => array(
1861
                    array(
1862
                        'name' => 'InArray',
1863
                        'options' => array(
1864
                            'haystack' => array('none', 'per_entry', 'one'),
1865
                        ),
1866
                    ),
1867
                ),
1868
            )));
1869
1870
            $inputFilter->add($factory->createInput(array(
1871
                'name' => 'active',
1872
                'required' => true
1873
            )));
1874
1875
            $inputFilter->add($factory->createInput(array(
1876
                'name' => 'onInvitation',
1877
                'required' => false
1878
            )));
1879
1880
            $inputFilter->add($factory->createInput(array(
1881
                'name' => 'displayHome',
1882
                'required' => false
1883
            )));
1884
1885
            $inputFilter->add($factory->createInput(array(
1886
                'name' => 'pushHome',
1887
                'required' => false
1888
            )));
1889
1890
            $inputFilter->add($factory->createInput(array(
1891
                'name' => 'prizeCategory',
1892
                'required' => false,
1893
                'filters' => array(
1894
                    array(
1895
                        'name' => 'Int'
1896
                    )
1897
                )
1898
            )));
1899
1900
            $inputFilter->add($factory->createInput(array(
1901
                'name' => 'fbPageTabTitle',
1902
                'required' => false
1903
            )));
1904
1905
            $inputFilter->add($factory->createInput(array(
1906
                'name' => 'fbPageTabImage',
1907
                'required' => false
1908
            )));
1909
1910
            $inputFilter->add($factory->createInput(array(
1911
                'name' => 'layout',
1912
                'required' => false,
1913
                'filters' => array(
1914
                    array(
1915
                        'name' => 'StripTags'
1916
                    ),
1917
                    array(
1918
                        'name' => 'StringTrim'
1919
                    )
1920
                ),
1921
                'validators' => array(
1922
                    array(
1923
                        'name' => 'StringLength',
1924
                        'options' => array(
1925
                            'encoding' => 'UTF-8',
1926
                            'min' => 0,
1927
                            'max' => 255
1928
                        )
1929
                    )
1930
                )
1931
            )));
1932
1933
            $inputFilter->add($factory->createInput(array(
1934
                'name' => 'stylesheet',
1935
                'required' => false,
1936
                'filters' => array(
1937
                    array(
1938
                        'name' => 'StripTags'
1939
                    ),
1940
                    array(
1941
                        'name' => 'StringTrim'
1942
                    )
1943
                ),
1944
                'validators' => array(
1945
                    array(
1946
                        'name' => 'StringLength',
1947
                        'options' => array(
1948
                            'encoding' => 'UTF-8',
1949
                            'min' => 0,
1950
                            'max' => 255
1951
                        )
1952
                    )
1953
                )
1954
            )));
1955
1956
            $inputFilter->add($factory->createInput(array(
1957
                'name' => 'fbShareImage',
1958
                'required' => false,
1959
                'filters' => array(
1960
                    array(
1961
                        'name' => 'StripTags'
1962
                    ),
1963
                    array(
1964
                        'name' => 'StringTrim'
1965
                    )
1966
                ),
1967
                'validators' => array(
1968
                    array(
1969
                        'name' => 'StringLength',
1970
                        'options' => array(
1971
                            'encoding' => 'UTF-8',
1972
                            'min' => 1,
1973
                            'max' => 255
1974
                        )
1975
                    )
1976
                )
1977
            )));
1978
1979
            $inputFilter->add($factory->createInput(array(
1980
                    'name' => 'fbShareMessage',
1981
                    'required' => false,
1982
                    'filters' => array(
1983
                            array(
1984
                                    'name' => 'StripTags'
1985
                            ),
1986
                            array(
1987
                                    'name' => 'StringTrim'
1988
                            )
1989
                    ),
1990
                    'validators' => array(
1991
                        array(
1992
                            'name' => 'StringLength',
1993
                            'options' => array(
1994
                                'encoding' => 'UTF-8',
1995
                                'min' => 1,
1996
                                'max' => 500
1997
                             )
1998
                        )
1999
                    )
2000
            )));
2001
2002
            $inputFilter->add($factory->createInput(array(
2003
                'name' => 'fbRequestMessage',
2004
                'required' => false,
2005
                'filters' => array(
2006
                    array(
2007
                        'name' => 'StripTags'
2008
                    ),
2009
                    array(
2010
                        'name' => 'StringTrim'
2011
                    )
2012
                ),
2013
                'validators' => array(
2014
                    array(
2015
                        'name' => 'StringLength',
2016
                        'options' => array(
2017
                            'encoding' => 'UTF-8',
2018
                            'min' => 1,
2019
                            'max' => 500
2020
                        )
2021
                    )
2022
                )
2023
            )));
2024
2025
            $inputFilter->add($factory->createInput(array(
2026
                'name' => 'twShareMessage',
2027
                'required' => false,
2028
                'filters' => array(
2029
                    array(
2030
                        'name' => 'StripTags'
2031
                    ),
2032
                    array(
2033
                        'name' => 'StringTrim'
2034
                    )
2035
                ),
2036
                'validators' => array(
2037
                    array(
2038
                        'name' => 'StringLength',
2039
                        'options' => array(
2040
                            'encoding' => 'UTF-8',
2041
                            'min' => 1,
2042
                            'max' => 255
2043
                        )
2044
                    )
2045
                )
2046
            )));
2047
            
2048
            $inputFilter->add($factory->createInput(array(
2049
                'name' => 'anonymousIdentifier',
2050
                'required' => false,
2051
                'filters' => array(
2052
                    array(
2053
                        'name' => 'StripTags'
2054
                    ),
2055
                    array(
2056
                        'name' => 'StringTrim'
2057
                    )
2058
                ),
2059
                'validators' => array(
2060
                    array(
2061
                        'name' => 'StringLength',
2062
                        'options' => array(
2063
                            'encoding' => 'UTF-8',
2064
                            'min' => 0,
2065
                            'max' => 255
2066
                        )
2067
                    )
2068
                )
2069
            )));
2070
2071
            $this->inputFilter = $inputFilter;
2072
        }
2073
2074
        return $this->inputFilter;
2075
    }
2076
2077
    public function setTranslatableLocale($locale)
2078
    {
2079
        $this->locale = $locale;
2080
    }
2081
}
2082