Game::getConditionsBlock()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
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", "tradingcard" = "TradingCard",
24
 * "memory" = "Memory"})
25
 * @ORM\Table(name="game")
26
 * @Gedmo\TranslationEntity(class="PlaygroundGame\Entity\GameTranslation")
27
 */
28
abstract class Game implements InputFilterAwareInterface, Translatable, \JsonSerializable
29
{
30
    // not yet published
31
    const GAME_SCHEDULE  = 'scheduled';
32
    // published and not yet started
33
    const GAME_PUBLISHED  = 'published';
34
    // published and game in progress
35
    const GAME_IN_PROGRESS = 'in progress';
36
    // published and game finished
37
    const GAME_FINISHED   = 'finished';
38
    // closed
39
    const GAME_CLOSED = 'closed';
40
41
    /**
42
     * @Gedmo\Locale
43
     * Used locale to override Translation listener`s locale
44
     * this is not a mapped field of entity metadata, just a simple property
45
     */
46
    protected $locale;
47
48
    protected $inputFilter;
49
50
    /**
51
     * @ORM\Id
52
     * @ORM\Column(type="integer");
53
     * @ORM\GeneratedValue(strategy="AUTO")
54
     */
55
    protected $id;
56
57
    /**
58
     * @ORM\ManyToOne(targetEntity="\PlaygroundPartnership\Entity\Partner")
59
     */
60
    protected $partner;
61
62
    /**
63
     * Implementer ManyToOne(targetEntity="PrizeCategory") avec hydrator sur le formulaire
64
     * @ORM\Column(name="prize_category", type="integer", nullable=true)
65
     */
66
    protected $prizeCategory;
67
68
    /**
69
     * @Gedmo\Translatable
70
     * @ORM\Column(type="string", length=255, nullable=false)
71
     */
72
    protected $title;
73
74
    /**
75
     * @ORM\Column(type="string", length=255, unique=true, nullable=false)
76
     */
77
    protected $identifier;
78
79
    /**
80
     * @ORM\OneToOne(targetEntity="PlayerForm", mappedBy="game", cascade={"persist","remove"})
81
     **/
82
    protected $playerForm;
83
84
    /**
85
     * @Gedmo\Translatable
86
     * @ORM\Column(name="main_image", type="string", length=255, nullable=true)
87
     */
88
    protected $mainImage;
89
90
    /**
91
     * @Gedmo\Translatable
92
     * @ORM\Column(name="second_image", type="string", length=255, nullable=true)
93
     */
94
    protected $secondImage;
95
96
    /**
97
     * @ORM\Column(name="broadcast_facebook",type="boolean", nullable=true)
98
     */
99
    protected $broadcastFacebook = 0;
100
101
    /**
102
     * @ORM\Column(name="broadcast_platform",type="boolean", nullable=true)
103
     */
104
    protected $broadcastPlatform = 0;
105
106
    /**
107
     * @ORM\Column(type="string", length=255, nullable=true)
108
     */
109
    protected $domain = null;
110
111
    /**
112
     * @ORM\Column(name="broadcast_post_facebook",type="boolean", nullable=true)
113
     */
114
    protected $broadcastPostFacebook = 0;
115
116
    /**
117
     * @ORM\Column(name="push_home",type="boolean", nullable=true)
118
     */
119
    protected $pushHome = 0;
120
121
    /**
122
     * @ORM\Column(name="display_home",type="boolean", nullable=true)
123
     */
124
    protected $displayHome = 0;
125
126
    /**
127
     * @ORM\Column(name="mail_winner",type="boolean", nullable=true)
128
     */
129
    protected $mailWinner = 0;
130
131
    /**
132
     * @Gedmo\Translatable
133
     * @ORM\Column(name="mail_winner_block", type="text", nullable=true)
134
     */
135
    protected $mailWinnerBlock;
136
137
    /**
138
     * @ORM\Column(name="mail_looser",type="boolean", nullable=true)
139
     */
140
    protected $mailLooser = 0;
141
142
    /**
143
     * @Gedmo\Translatable
144
     * @ORM\Column(name="mail_looser_block", type="text", nullable=true)
145
     */
146
    protected $mailLooserBlock;
147
148
    /**
149
     * @ORM\Column(name="mail_entry",type="boolean", nullable=true)
150
     */
151
    protected $mailEntry = 0;
152
153
    /**
154
     * @ORM\Column(name="email_share",type="boolean", nullable=true)
155
     */
156
    protected $emailShare = 0;
157
158
    /**
159
     * @ORM\Column(name="fb_share",type="boolean", nullable=true)
160
     */
161
    protected $fbShare = 0;
162
163
    /**
164
     * @ORM\Column(name="tw_share",type="boolean", nullable=true)
165
     */
166
    protected $twShare = 0;
167
168
    /**
169
     * @ORM\Column(type="boolean", nullable=false)
170
     */
171
    protected $active = 0;
172
173
    /**
174
     * @ORM\Column(type="boolean", nullable=false)
175
     */
176
    protected $onInvitation = false;
177
178
    /**
179
     * @ORM\OneToMany(targetEntity="Invitation", mappedBy="game", cascade={"persist","remove"}, orphanRemoval=true)
180
     */
181
    private $invitations;
182
183
    /**
184
     * @ORM\Column(name="anonymous_allowed",type="boolean", nullable=true)
185
     */
186
    protected $anonymousAllowed = 0;
187
    
188
    /**
189
     * This column can be filled in when anonymousAllowed = 1.
190
     * If you put a value, it has to be a field key from playerdata. This key will
191
     * then be used to identify a player (generally 'email')
192
     *
193
     * @ORM\Column(name="anonymous_identifier", type="text", nullable=true)
194
     */
195
    protected $anonymousIdentifier;
196
197
    /**
198
     * @ORM\Column(name="publication_date", type="datetime", nullable=true)
199
     */
200
    protected $publicationDate;
201
202
    /**
203
     * @ORM\Column(name="start_date", type="datetime", nullable=true)
204
     */
205
    protected $startDate;
206
207
    /**
208
     * @ORM\Column(name="end_date", type="datetime", nullable=true)
209
     */
210
    protected $endDate;
211
212
    /**
213
     * @ORM\Column(name="close_date", type="datetime", nullable=true)
214
     */
215
    protected $closeDate;
216
217
    /**
218
     * play limitation. 0 : No limit
219
     *
220
     * @ORM\Column(name="play_limit", type="integer", nullable=false)
221
     */
222
    protected $playLimit = 0;
223
224
    /**
225
     * this field is taken into account only if playLimit<>0.
226
     * if 'always' only $playLimit play by person for this game
227
     * if 'day' only $playLimit play by person a day
228
     * if 'week' only $playLimit play by person a week
229
     * if 'month' only $playLimit play by person a month
230
     * if 'year' only $playLimit play by person a year
231
     *
232
     * @ORM\Column(name="play_limit_scale", type="string", nullable=true)
233
     */
234
    protected $playLimitScale;
235
236
    /**
237
     * this field is used for offering a complementary play entry
238
     * (for example, when the player share the game). The entries
239
     * of type 'bonus' won't be taken into account in the calaculation
240
     * of the authorized playLimit.
241
     *
242
     * if 'none' or null no play bonus is offered
243
     * if 'per_entry' a play bonus is offered for each entry
244
     * if 'one' only one play bonus is offered for every entries of the game
245
     *
246
     * @ORM\Column(name="play_bonus", type="string", nullable=true)
247
     */
248
    protected $playBonus;
249
250
    /**
251
     * @ORM\Column(type="string", length=255, nullable=true)
252
     */
253
    protected $layout;
254
255
    /**
256
     * @ORM\Column(type="string", length=255, nullable=true)
257
     */
258
    protected $stylesheet;
259
260
    /**
261
     * @Gedmo\Translatable
262
     * @ORM\Column(name="welcome_block", type="text", nullable=true)
263
     */
264
    protected $welcomeBlock;
265
266
    /**
267
     * @Gedmo\Translatable
268
     * @ORM\Column(type="text", nullable=true)
269
     */
270
    protected $termsBlock;
271
272
    /**
273
     * @ORM\Column(name="terms_optin", type="boolean", nullable=true)
274
     */
275
    protected $termsOptin = 0;
276
277
    /**
278
     * @Gedmo\Translatable
279
     * @ORM\Column(type="text", nullable=true)
280
     */
281
    protected $conditionsBlock;
282
283
    /**
284
     * @ORM\OneToMany(targetEntity="Prize", mappedBy="game", cascade={"persist","remove"}, orphanRemoval=true)
285
     */
286
    private $prizes;
287
288
    /**
289
     * @ORM\Column(name="fb_page_id", type="string", nullable=true)
290
     */
291
    protected $fbPageId;
292
293
    /**
294
     * @ORM\Column(name="fb_app_id", type="string", nullable=true)
295
     */
296
    protected $fbAppId;
297
298
    /**
299
     * @ORM\Column(name="fb_post_id", type="string", nullable=true)
300
     */
301
    protected $fbPostId;
302
303
    /**
304
     * @Gedmo\Translatable
305
     * @ORM\Column(name="fb_page_tab_title", type="string", length=255, nullable=true)
306
     */
307
    protected $fbPageTabTitle;
308
309
    /**
310
     * @ORM\Column(name="fb_page_tab_image", type="string", length=255, nullable=true)
311
     */
312
    protected $fbPageTabImage;
313
314
    /**
315
     * What is the tab's position. 0 : the highest
316
     *
317
     * @ORM\Column(name="fb_page_tab_position", type="integer", nullable=false)
318
     */
319
    protected $fbPageTabPosition = 0;
320
321
    /**
322
     * @Gedmo\Translatable
323
     * @ORM\Column(name="email_share_subject", type="text", nullable=true)
324
     */
325
    protected $emailShareSubject;
326
327
    /**
328
     * @Gedmo\Translatable
329
     * @ORM\Column(name="email_share_message", type="text", nullable=true)
330
     */
331
    protected $emailShareMessage;
332
333
    /**
334
     * @Gedmo\Translatable
335
     * @ORM\Column(name="fb_share_description", type="text", nullable=true)
336
     */
337
    protected $fbShareDescription;
338
339
    /**
340
     * @ORM\Column(name="fb_share_image", type="string", length=255, nullable=true)
341
     */
342
    protected $fbShareImage;
343
344
    /**
345
     * @Gedmo\Translatable
346
     * @ORM\Column(name="fb_request_message", type="text", nullable=true)
347
     */
348
    protected $fbRequestMessage;
349
350
    /**
351
     * @Gedmo\Translatable
352
     * @ORM\Column(name="tw_share_message", type="string", length=255, nullable=true)
353
     */
354
    protected $twShareMessage;
355
356
    /**
357
     * available steps : index, register, play, result, bounce
358
     * This string is transformed into an array and represents the workflow of the game
359
     * @ORM\Column(name="steps", type="string", length=255, nullable=true)
360
     */
361
    protected $steps = 'play,result';
362
363
    /**
364
     * @ORM\Column(name="steps_views", type="string", length=255, nullable=true)
365
     */
366
    protected $stepsViews = '{"index":{},"play":{},"result":{},"bounce":{}}';
367
368
    /**
369
     * If you enter a value, this will be the condition to enter the game
370
     * The cost will apply to the "wallet" of the player which correspond to a leaderboard
371
     * @ORM\Column(name="cost_to_play", type="integer", nullable=true)
372
     */
373
    protected $costToPlay = 0;
374
375
    /**
376
     * Doctrine accessible value of discriminator (field 'type' is not
377
     * accessible through query)
378
     * And I want to be able to sort game collection based on type
379
     * http://www.doctrine-project.org/jira/browse/DDC-707
380
     * @ORM\Column(name="class_type", type="string", length=255, nullable=false)
381
     */
382
    protected $classType;
383
384
    /**
385
     * @ORM\Column(name="created_at", type="datetime")
386
     */
387
    protected $createdAt;
388
389
    /**
390
     * @ORM\Column(name="updated_at", type="datetime")
391
     */
392
    protected $updatedAt;
393
394
    public function __construct()
395
    {
396
        $this->prizes = new ArrayCollection();
397
        $this->invitations = new ArrayCollection();
398
    }
399
400
    /**
401
     * @PrePersist
402
     */
403
    public function createChrono()
404
    {
405
        $this->createdAt = new \DateTime("now");
406
        $this->updatedAt = new \DateTime("now");
407
    }
408
409
    /**
410
     * @PreUpdate
411
     */
412
    public function updateChrono()
413
    {
414
        $this->updatedAt = new \DateTime("now");
415
    }
416
417
    /**
418
     *
419
     * @return the $id
420
     */
421
    public function getId()
422
    {
423
        return $this->id;
424
    }
425
426
    /**
427
     *
428
     * @param field_type $id
429
     */
430
    public function setId($id)
431
    {
432
        $this->id = $id;
433
434
        return $this;
435
    }
436
437
    /**
438
     * @return the $playerForm
439
     */
440
    public function getPlayerForm()
441
    {
442
        return $this->playerForm;
443
    }
444
445
    /**
446
     * @param field_type $playerForm
447
     */
448
    public function setPlayerForm($playerForm)
449
    {
450
        $this->playerForm = $playerForm;
451
452
        return $this;
453
    }
454
455
    /**
456
     *
457
     * @return the unknown_type
458
     */
459
    public function getPartner()
460
    {
461
        return $this->partner;
462
    }
463
464
    /**
465
     *
466
     * @param unknown_type $partner
467
     */
468
    public function setPartner($partner)
469
    {
470
        $this->partner = $partner;
471
472
        return $this;
473
    }
474
475
    /**
476
     *
477
     * @param unknown_type $prizeCategory
478
     */
479
    public function setPrizeCategory($prizeCategory)
480
    {
481
        $this->prizeCategory = $prizeCategory;
482
483
        return $this;
484
    }
485
486
    /**
487
     *
488
     * @return the unknown_type
489
     */
490
    public function getPrizeCategory()
491
    {
492
        return $this->prizeCategory;
493
    }
494
495
    /**
496
     *
497
     * @return the $title
498
     */
499
    public function getTitle()
500
    {
501
        return $this->title;
502
    }
503
504
    /**
505
     *
506
     * @param field_type $title
507
     */
508
    public function setTitle($title)
509
    {
510
        $this->title = $title;
511
512
        return $this;
513
    }
514
515
    /**
516
     *
517
     * @return the $identifier
518
     */
519
    public function getIdentifier()
520
    {
521
        return $this->identifier;
522
    }
523
524
    /**
525
     *
526
     * @param field_type $identifier
527
     */
528
    public function setIdentifier($identifier)
529
    {
530
        $this->identifier = $identifier;
531
532
        return $this;
533
    }
534
535
    /**
536
     * @return integer $anonymousAllowed
537
     */
538
    public function getAnonymousAllowed()
539
    {
540
        return $this->anonymousAllowed;
541
    }
542
543
    /**
544
     * @param number $anonymousAllowed
545
     */
546
    public function setAnonymousAllowed($anonymousAllowed)
547
    {
548
        $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...
549
550
        return $this;
551
    }
552
553
    /**
554
     * @return the $anonymousIdentifier
555
     */
556
    public function getAnonymousIdentifier()
557
    {
558
        return $this->anonymousIdentifier;
559
    }
560
561
    /**
562
     * @param field_type $anonymousIdentifier
563
     */
564
    public function setAnonymousIdentifier($anonymousIdentifier)
565
    {
566
        $this->anonymousIdentifier = $anonymousIdentifier;
567
    }
568
569
    /**
570
     *
571
     * @return the $mainImage
572
     */
573
    public function getMainImage()
574
    {
575
        return $this->mainImage;
576
    }
577
578
    /**
579
     *
580
     * @param field_type $mainImage
581
     */
582
    public function setMainImage($mainImage)
583
    {
584
        $this->mainImage = $mainImage;
585
586
        return $this;
587
    }
588
589
    /**
590
     *
591
     * @return the $secondImage
592
     */
593
    public function getSecondImage()
594
    {
595
        return $this->secondImage;
596
    }
597
598
    /**
599
     *
600
     * @param field_type $secondImage
601
     */
602
    public function setSecondImage($secondImage)
603
    {
604
        $this->secondImage = $secondImage;
605
606
        return $this;
607
    }
608
609
    /**
610
     *
611
     * @return integer $broadcastFacebook
612
     */
613
    public function getBroadcastFacebook()
614
    {
615
        return $this->broadcastFacebook;
616
    }
617
618
    /**
619
     *
620
     * @param field_type $broadcastFacebook
621
     */
622
    public function setBroadcastFacebook($broadcastFacebook)
623
    {
624
        $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...
625
626
        return $this;
627
    }
628
629
    /**
630
     *
631
     * @return integer $domain
632
     */
633
    public function getDomain()
634
    {
635
        return $this->domain;
636
    }
637
638
    /**
639
     *
640
     * @param field_type $domain
641
     */
642
    public function setDomain($domain)
643
    {
644
        $this->domain = $domain;
645
646
        return $this;
647
    }
648
649
    /**
650
     *
651
     * @return integer $broadcastPlatform
652
     */
653
    public function getBroadcastPlatform()
654
    {
655
        return $this->broadcastPlatform;
656
    }
657
658
    /**
659
     *
660
     * @param field_type $broadcastPlatform
661
     */
662
    public function setBroadcastPlatform($broadcastPlatform)
663
    {
664
        $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...
665
666
        return $this;
667
    }
668
669
    /**
670
     * @return integer $broadcastPostFacebook
671
     */
672
    public function getBroadcastPostFacebook()
673
    {
674
        return $this->broadcastPostFacebook;
675
    }
676
677
    /**
678
     * @param number $broadcastPostFacebook
679
     */
680
    public function setBroadcastPostFacebook($broadcastPostFacebook)
681
    {
682
        $this->broadcastPostFacebook = $broadcastPostFacebook;
0 ignored issues
show
Documentation Bug introduced by
It seems like $broadcastPostFacebook can also be of type double. However, the property $broadcastPostFacebook 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...
683
684
        return $this;
685
    }
686
687
    /**
688
     * @return integer $mailWinner
689
     */
690
    public function getMailWinner()
691
    {
692
        return $this->mailWinner;
693
    }
694
695
    /**
696
     * @param number $mailWinner
697
     */
698
    public function setMailWinner($mailWinner)
699
    {
700
        $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...
701
    }
702
703
    /**
704
     * @return the $mailWinnerBlock
705
     */
706
    public function getMailWinnerBlock()
707
    {
708
        return $this->mailWinnerBlock;
709
    }
710
711
    /**
712
     * @param field_type $mailWinnerBlock
713
     */
714
    public function setMailWinnerBlock($mailWinnerBlock)
715
    {
716
        $this->mailWinnerBlock = $mailWinnerBlock;
717
    }
718
719
    /**
720
     * @return integer $mailEntry
721
     */
722
    public function getMailEntry()
723
    {
724
        return $this->mailEntry;
725
    }
726
727
    /**
728
     * @param number $mailEntry
729
     */
730
    public function setMailEntry($mailEntry)
731
    {
732
        $this->mailEntry = $mailEntry;
0 ignored issues
show
Documentation Bug introduced by
It seems like $mailEntry can also be of type double. However, the property $mailEntry 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...
733
    }
734
735
    /**
736
     * @return boolean $emailShare
737
     */
738
    public function getEmailShare()
739
    {
740
        return $this->emailShare;
741
    }
742
743
    /**
744
     * @param boolean $emailShare
745
     */
746
    public function setEmailShare($emailShare)
747
    {
748
        $this->emailShare = $emailShare;
0 ignored issues
show
Documentation Bug introduced by
The property $emailShare was declared of type integer, but $emailShare is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
749
    }
750
751
    /**
752
     * @return boolean $fbShare
753
     */
754
    public function getFbShare()
755
    {
756
        return $this->fbShare;
757
    }
758
759
    /**
760
     * @param boolean $fbShare
761
     */
762
    public function setFbShare($fbShare)
763
    {
764
        $this->fbShare = $fbShare;
0 ignored issues
show
Documentation Bug introduced by
The property $fbShare was declared of type integer, but $fbShare is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
765
    }
766
767
    /**
768
     * @return boolean $twShare
769
     */
770
    public function getTwShare()
771
    {
772
        return $this->twShare;
773
    }
774
775
    /**
776
     * @param boolean $twShare
777
     */
778
    public function setTwShare($twShare)
779
    {
780
        $this->twShare = $twShare;
0 ignored issues
show
Documentation Bug introduced by
The property $twShare was declared of type integer, but $twShare is of type boolean. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
781
    }
782
783
    /**
784
     * @return integer $mailLooser
785
     */
786
    public function getMailLooser()
787
    {
788
        return $this->mailLooser;
789
    }
790
791
    /**
792
     * @param number $mailLooser
793
     */
794
    public function setMailLooser($mailLooser)
795
    {
796
        $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...
797
    }
798
799
    /**
800
     * @return the $mailLooserBlock
801
     */
802
    public function getMailLooserBlock()
803
    {
804
        return $this->mailLooserBlock;
805
    }
806
807
    /**
808
     * @param field_type $mailLooserBlock
809
     */
810
    public function setMailLooserBlock($mailLooserBlock)
811
    {
812
        $this->mailLooserBlock = $mailLooserBlock;
813
    }
814
815
    /**
816
     *
817
     * @return integer $pushHome
818
     */
819
    public function getPushHome()
820
    {
821
        return $this->pushHome;
822
    }
823
824
    /**
825
     *
826
     * @param field_type $pushHome
827
     */
828
    public function setPushHome($pushHome)
829
    {
830
        $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...
831
832
        return $this;
833
    }
834
835
    /**
836
     *
837
     * @return integer $displayHome
838
     */
839
    public function getDisplayHome()
840
    {
841
        return $this->displayHome;
842
    }
843
844
    /**
845
     *
846
     * @param field_type $displayHome
847
     */
848
    public function setDisplayHome($displayHome)
849
    {
850
        $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...
851
852
        return $this;
853
    }
854
855
    /**
856
     *
857
     * @return the $publicationDate
858
     */
859
    public function getPublicationDate()
860
    {
861
        return $this->publicationDate;
862
    }
863
864
    /**
865
     *
866
     * @param field_type $publicationDate
867
     */
868
    public function setPublicationDate($publicationDate)
869
    {
870
        $this->publicationDate = $publicationDate;
871
872
        return $this;
873
    }
874
875
    /**
876
     *
877
     * @return the $startDate
878
     */
879
    public function getStartDate()
880
    {
881
        return $this->startDate;
882
    }
883
884
    /**
885
     *
886
     * @param field_type $startDate
887
     */
888
    public function setStartDate($startDate)
889
    {
890
        $this->startDate = $startDate;
891
892
        return $this;
893
    }
894
895
    /**
896
     *
897
     * @return the $endDate
898
     */
899
    public function getEndDate()
900
    {
901
        return $this->endDate;
902
    }
903
904
    /**
905
     *
906
     * @param field_type $endDate
907
     */
908
    public function setEndDate($endDate)
909
    {
910
        $this->endDate = $endDate;
911
912
        return $this;
913
    }
914
915
    /**
916
     *
917
     * @return the $closeDate
918
     */
919
    public function getCloseDate()
920
    {
921
        return $this->closeDate;
922
    }
923
924
    /**
925
     *
926
     * @param field_type $closeDate
927
     */
928
    public function setCloseDate($closeDate)
929
    {
930
        $this->closeDate = $closeDate;
931
932
        return $this;
933
    }
934
935
    public function isClosed()
936
    {
937
        $today = new DateTime('now');
938
        if (($this->getCloseDate() && $this->getCloseDate() < $today)
939
            ||
940
            ($this->getPublicationDate() && $this->getPublicationDate() > $today)
941
        ) {
942
            return true;
943
        }
944
945
        return false;
946
    }
947
948
    public function isOpen()
949
    {
950
        return !$this->isClosed();
951
    }
952
953 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...
954
    {
955
        $today = new DateTime('now');
956
        if (((!$this->getStartDate() || $this->getStartDate() <= $today))
957
            && (!$this->getEndDate() || $this->getEndDate() > $today)
958
        ) {
959
            return true;
960
        }
961
962
        return false;
963
    }
964
965 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...
966
    {
967
        $today = new DateTime('now');
968
        if ($this->getEndDate() && $this->getEndDate() <= $today
969
            ||
970
            ($this->getCloseDate() && $this->getCloseDate() <= $today)
971
        ) {
972
            return true;
973
        }
974
975
        return false;
976
    }
977
978
    public function isOnline()
979
    {
980
        if ($this->getActive() && $this->getBroadcastPlatform()) {
981
            return true;
982
        }
983
984
        return false;
985
    }
986
987
    // json array : {"0":"index","1":"play","2":"result","3":"bounce"}
988
    public function getStepsArray()
989
    {
990
        $steps = null;
991
992
        if ($this->getSteps() && $this->getSteps()[0] === '{') {
993
            $steps = json_decode($this->getSteps(), true);
994
        } elseif ($this->getSteps()) {
995
            $steps = explode(',', $this->getSteps());
996
        }
997
        if (!$steps) {
998
            $steps = array('index','play','result','bounce');
999
        }
1000
        return $steps;
1001
    }
1002
1003
    public function getStepsViewsArray()
1004
    {
1005
        $viewSteps = null;
1006
1007
        if ($this->getStepsViews()) {
1008
            $viewSteps = json_decode($this->getStepsViews(), true);
1009
        }
1010
        if (!$viewSteps) {
1011
            $viewSteps = array('index','play','result','bounce');
1012
        }
1013
1014
        return $viewSteps;
1015
    }
1016
1017
    public function getSteps()
1018
    {
1019
        return $this->steps;
1020
    }
1021
1022
    public function setSteps($steps)
1023
    {
1024
        $this->steps = $steps;
1025
1026
        return $this;
1027
    }
1028
1029
    /**
1030
     * This method returns the first step in the game workflow
1031
     * @return string
1032
     */
1033
    public function firstStep()
1034
    {
1035
        $steps = $this->getStepsArray();
1036
1037
        return $steps[0];
1038
    }
1039
1040
    /**
1041
     * This method returns the last step in the game workflow
1042
     * @return string
1043
     */
1044
    public function lastStep()
1045
    {
1046
        $steps = $this->getStepsArray();
1047
        $nbSteps = count($steps);
1048
1049
        return $steps[$nbSteps-1];
1050
    }
1051
1052
    /**
1053
     * This method returns the previous step in the game workflow
1054
     * @param string $step
1055
     * @return string
1056
     */
1057 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...
1058
    {
1059
        $steps = $this->getStepsArray();
1060
        $key = array_search($step, $steps);
1061
1062
        if (is_int($key) && $key > 0) {
1063
            return $steps[$key-1];
1064
        }
1065
1066
        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...
1067
    }
1068
1069
    /**
1070
     * This method returns the next step in the game workflow
1071
     * @param string $step
1072
     * @return string
1073
     */
1074 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...
1075
    {
1076
        $steps = $this->getStepsArray();
1077
        $key = array_search($step, $steps);
1078
1079
        if (is_int($key) && $key < count($steps)-1) {
1080
            return $steps[$key+1];
1081
        }
1082
1083
        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...
1084
    }
1085
1086
    /**
1087
     * @return string $stepsViews
1088
     */
1089
    public function getStepsViews()
1090
    {
1091
        return $this->stepsViews;
1092
    }
1093
1094
    /**
1095
     * @param string $stepsViews
1096
     */
1097
    public function setStepsViews($stepsViews)
1098
    {
1099
        $this->stepsViews = $stepsViews;
1100
1101
        return $this;
1102
    }
1103
1104
    public function getState()
1105
    {
1106
        if ($this->isOpen()) {
1107
            if (!$this->isStarted() && !$this->isFinished()) {
1108
                return self::GAME_PUBLISHED;
1109
            } elseif ($this->isStarted()) {
1110
                return self::GAME_IN_PROGRESS;
1111
            } elseif ($this->isFinished()) {
1112
                return self::GAME_FINISHED;
1113
            }
1114
        } else {
1115
            if ($this->isFinished()) {
1116
                return self::GAME_CLOSED;
1117
            } else {
1118
                return self::GAME_SCHEDULE;
1119
            }
1120
        }
1121
    }
1122
1123
    /**
1124
     * @return integer unknown_type
1125
     */
1126
    public function getPlayLimit()
1127
    {
1128
        return $this->playLimit;
1129
    }
1130
1131
    /**
1132
     * @param unknown_type $playLimit
1133
     */
1134
    public function setPlayLimit($playLimit)
1135
    {
1136
        $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...
1137
1138
        return $this;
1139
    }
1140
1141
    /**
1142
     * @return the unknown_type
1143
     */
1144
    public function getPlayLimitScale()
1145
    {
1146
        return $this->playLimitScale;
1147
    }
1148
1149
    /**
1150
     * @param unknown_type $playLimitScale
1151
     */
1152
    public function setPlayLimitScale($playLimitScale)
1153
    {
1154
        $this->playLimitScale = $playLimitScale;
1155
1156
        return $this;
1157
    }
1158
1159
    /**
1160
     * @return the unknown_type
1161
     */
1162
    public function getPlayBonus()
1163
    {
1164
        return $this->playBonus;
1165
    }
1166
1167
    /**
1168
     * @param unknown_type $playBonus
1169
     */
1170
    public function setPlayBonus($playBonus)
1171
    {
1172
        $this->playBonus = $playBonus;
1173
1174
        return $this;
1175
    }
1176
1177
    /**
1178
     *
1179
     * @return the $layout
1180
     */
1181
    public function getLayout()
1182
    {
1183
        return $this->layout;
1184
    }
1185
1186
    /**
1187
     *
1188
     * @param field_type $layout
1189
     */
1190
    public function setLayout($layout)
1191
    {
1192
        $this->layout = $layout;
1193
1194
        return $this;
1195
    }
1196
1197
    /**
1198
     *
1199
     * @return the $stylesheet
1200
     */
1201
    public function getStylesheet()
1202
    {
1203
        return $this->stylesheet;
1204
    }
1205
1206
    /**
1207
     *
1208
     * @param field_type $stylesheet
1209
     */
1210
    public function setStylesheet($stylesheet)
1211
    {
1212
        $this->stylesheet = $stylesheet;
1213
1214
        return $this;
1215
    }
1216
1217
    /**
1218
     *
1219
     * @return the $welcomeBlock
1220
     */
1221
    public function getWelcomeBlock()
1222
    {
1223
        return $this->welcomeBlock;
1224
    }
1225
1226
    /**
1227
     *
1228
     * @param field_type $welcomeBlock
1229
     */
1230
    public function setWelcomeBlock($welcomeBlock)
1231
    {
1232
        $this->welcomeBlock = $welcomeBlock;
1233
1234
        return $this;
1235
    }
1236
1237
    /**
1238
     *
1239
     * @return the $termsBlock
1240
     */
1241
    public function getTermsBlock()
1242
    {
1243
        return $this->termsBlock;
1244
    }
1245
1246
    /**
1247
     *
1248
     * @param text $termsBlock
1249
     */
1250
    public function setTermsBlock($termsBlock)
1251
    {
1252
        $this->termsBlock = $termsBlock;
1253
1254
        return $this;
1255
    }
1256
1257
    /**
1258
     *
1259
     * @return integer $termsOptin
1260
     */
1261
    public function getTermsOptin()
1262
    {
1263
        return $this->termsOptin;
1264
    }
1265
1266
    /**
1267
     *
1268
     * @param text $termsOptin
1269
     */
1270
    public function setTermsOptin($termsOptin)
1271
    {
1272
        $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...
1273
1274
        return $this;
1275
    }
1276
1277
    /**
1278
     *
1279
     * @return the $conditionsBlock
1280
     */
1281
    public function getConditionsBlock()
1282
    {
1283
        return $this->conditionsBlock;
1284
    }
1285
1286
    /**
1287
     *
1288
     * @param text $conditionsBlock
1289
     */
1290
    public function setConditionsBlock($conditionsBlock)
1291
    {
1292
        $this->conditionsBlock = $conditionsBlock;
1293
1294
        return $this;
1295
    }
1296
1297
    /**
1298
     * @return ArrayCollection unknown_type
1299
     */
1300
    public function getPrizes()
1301
    {
1302
        return $this->prizes;
1303
    }
1304
1305
    /**
1306
     * frm collection solution
1307
     * @param ArrayCollection $prizes
1308
     */
1309
    public function setPrizes(ArrayCollection $prizes)
1310
    {
1311
        $this->prizes = $prizes;
1312
1313
        return $this;
1314
    }
1315
1316
    public function addPrizes(ArrayCollection $prizes)
1317
    {
1318
        foreach ($prizes as $prize) {
1319
            $prize->setGame($this);
1320
            $this->prizes->add($prize);
1321
        }
1322
    }
1323
1324
1325
    public function removePrizes(ArrayCollection $prizes)
1326
    {
1327
        foreach ($prizes as $prize) {
1328
            $prize->setGame(null);
1329
            $this->prizes->removeElement($prize);
1330
        }
1331
    }
1332
1333
    /**
1334
     * Add a prize to the game.
1335
     *
1336
     * @param Prize $prize
1337
     *
1338
     * @return void
1339
     */
1340
    public function addPrize($prize)
1341
    {
1342
        $this->prizes[] = $prize;
1343
    }
1344
1345
    /**
1346
     *
1347
     * @return string $classType
1348
     */
1349
    public function getClassType()
1350
    {
1351
        return $this->classType;
1352
    }
1353
1354
    /**
1355
     *
1356
     * @param string classType
1357
     * @param string $classType
1358
     */
1359
    public function setClassType($classType)
1360
    {
1361
        $this->classType = $classType;
1362
1363
        return $this;
1364
    }
1365
1366
    /**
1367
     *
1368
     * @return integer unknown_type
1369
     */
1370
    public function getActive()
1371
    {
1372
        return $this->active;
1373
    }
1374
1375
    /**
1376
     *
1377
     * @param unknown_type $active
1378
     */
1379
    public function setActive($active)
1380
    {
1381
        $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...
1382
1383
        return $this;
1384
    }
1385
1386
    /**
1387
     *
1388
     * @return the $costToPlay
1389
     */
1390
    public function getCostToPlay()
1391
    {
1392
        return $this->costToPlay;
1393
    }
1394
1395
    /**
1396
     *
1397
     * @param field_type $costToPlay
1398
     */
1399
    public function setCostToPlay($costToPlay)
1400
    {
1401
        $this->costToPlay = $costToPlay;
0 ignored issues
show
Documentation Bug introduced by
It seems like $costToPlay of type object<PlaygroundGame\Entity\field_type> is incompatible with the declared type integer of property $costToPlay.

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...
1402
1403
        return $this;
1404
    }
1405
1406
    /**
1407
     *
1408
     * @return boolean $onInvitation
1409
     */
1410
    public function getOnInvitation()
1411
    {
1412
        return $this->onInvitation;
1413
    }
1414
1415
    /**
1416
     *
1417
     * @param boolean $onInvitation
1418
     */
1419
    public function setOnInvitation($onInvitation)
1420
    {
1421
        $this->onInvitation = $onInvitation;
1422
1423
        return $this;
1424
    }
1425
1426
    /**
1427
     * @return ArrayCollection unknown_type
1428
     */
1429
    public function getInvitations()
1430
    {
1431
        return $this->invitations;
1432
    }
1433
1434
    /**
1435
     * @param ArrayCollection $invitations
1436
     */
1437
    public function setInvitations(ArrayCollection $invitations)
1438
    {
1439
        $this->invitations = $invitations;
1440
1441
        return $this;
1442
    }
1443
1444
    public function addInvitations(ArrayCollection $invitations)
1445
    {
1446
        foreach ($invitations as $invitation) {
1447
            $invitation->setGame($this);
1448
            $this->invitations->add($invitation);
1449
        }
1450
    }
1451
1452
    public function removeInvitations(ArrayCollection $invitations)
1453
    {
1454
        foreach ($invitations as $invitation) {
1455
            $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...
1456
            $this->invitations->removeElement($invitation);
1457
        }
1458
    }
1459
1460
    /**
1461
     * Add an invitation to the game.
1462
     *
1463
     * @param Invitation $invitation
1464
     *
1465
     * @return void
1466
     */
1467
    public function addInvitation($invitation)
1468
    {
1469
        $this->invitations[] = $invitation;
1470
    }
1471
1472
1473
    /**
1474
     *
1475
     * @return string the Facebook app_id
1476
     */
1477
    public function getFbPageId()
1478
    {
1479
        return $this->fbPageId;
1480
    }
1481
1482
    /**
1483
     *
1484
     * @param string $fbPageId
1485
     */
1486
    public function setFbPageId($fbPageId)
1487
    {
1488
        $this->fbPageId = $fbPageId;
1489
1490
        return $this;
1491
    }
1492
1493
    /**
1494
     *
1495
     * @return string the Facebook app_id
1496
     */
1497
    public function getFbAppId()
1498
    {
1499
        return $this->fbAppId;
1500
    }
1501
1502
    /**
1503
     *
1504
     * @param string $fbAppId
1505
     */
1506
    public function setFbAppId($fbAppId)
1507
    {
1508
        $this->fbAppId = $fbAppId;
1509
1510
        return $this;
1511
    }
1512
1513
    /**
1514
     *
1515
     * @return string the Facebook app_id
1516
     */
1517
    public function getFbPostId()
1518
    {
1519
        return $this->fbPostId;
1520
    }
1521
1522
    /**
1523
     *
1524
     * @param string $fbPostId
1525
     */
1526
    public function setFbPostId($fbPostId)
1527
    {
1528
        $this->fbPostId = $fbPostId;
1529
1530
        return $this;
1531
    }
1532
1533
    /**
1534
     *
1535
     * @return string the Facebook fbPageTabTitle
1536
     */
1537
    public function getFbPageTabTitle()
1538
    {
1539
        return $this->fbPageTabTitle;
1540
    }
1541
1542
    /**
1543
     *
1544
     * @param string $fbPageTabTitle
1545
     */
1546
    public function setFbPageTabTitle($fbPageTabTitle)
1547
    {
1548
        $this->fbPageTabTitle = $fbPageTabTitle;
1549
1550
        return $this;
1551
    }
1552
1553
    /**
1554
     *
1555
     * @return string the Facebook fbPageTabImage
1556
     */
1557
    public function getFbPageTabImage()
1558
    {
1559
        return $this->fbPageTabImage;
1560
    }
1561
1562
    /**
1563
     *
1564
     * @param string $fbPageTabImage
1565
     */
1566
    public function setFbPageTabImage($fbPageTabImage)
1567
    {
1568
        $this->fbPageTabImage = $fbPageTabImage;
1569
1570
        return $this;
1571
    }
1572
1573
    /**
1574
     *
1575
     * @return string the Facebook fbPageTabPosition
1576
     */
1577
    public function getFbPageTabPosition()
1578
    {
1579
        return $this->fbPageTabPosition;
1580
    }
1581
1582
    /**
1583
     *
1584
     * @param string $fbPageTabPosition
1585
     */
1586
    public function setFbPageTabPosition($fbPageTabPosition)
1587
    {
1588
        $this->fbPageTabPosition = $fbPageTabPosition;
0 ignored issues
show
Documentation Bug introduced by
The property $fbPageTabPosition was declared of type integer, but $fbPageTabPosition is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
1589
1590
        return $this;
1591
    }
1592
1593
    /**
1594
     *
1595
     * @return the string
1596
     */
1597
    public function getEmailShareSubject()
1598
    {
1599
        return $this->emailShareSubject;
1600
    }
1601
1602
    /**
1603
     *
1604
     * @param string $emailShareSubject
1605
     */
1606
    public function setEmailShareSubject($emailShareSubject)
1607
    {
1608
        $this->emailShareSubject = $emailShareSubject;
1609
1610
        return $this;
1611
    }
1612
1613
    /**
1614
     *
1615
     * @return the unknown_type
1616
     */
1617
    public function getEmailShareMessage()
1618
    {
1619
        return $this->emailShareMessage;
1620
    }
1621
1622
    /**
1623
     *
1624
     * @param unknown_type $emailShareMessage
1625
     */
1626
    public function setEmailShareMessage($emailShareMessage)
1627
    {
1628
        $this->emailShareMessage = $emailShareMessage;
1629
1630
        return $this;
1631
    }
1632
1633
    /**
1634
     *
1635
     * @return the string
1636
     */
1637
    public function getFbShareDescription()
1638
    {
1639
        return $this->fbShareDescription;
1640
    }
1641
1642
    /**
1643
     *
1644
     * @param string $fbShareDescription
1645
     */
1646
    public function setFbShareDescription($fbShareDescription)
1647
    {
1648
        $this->fbShareDescription = $fbShareDescription;
1649
1650
        return $this;
1651
    }
1652
1653
    /**
1654
     *
1655
     * @return the unknown_type
1656
     */
1657
    public function getFbShareImage()
1658
    {
1659
        return $this->fbShareImage;
1660
    }
1661
1662
    /**
1663
     *
1664
     * @param unknown_type $fbShareImage
1665
     */
1666
    public function setFbShareImage($fbShareImage)
1667
    {
1668
        $this->fbShareImage = $fbShareImage;
1669
1670
        return $this;
1671
    }
1672
1673
    /**
1674
     *
1675
     * @return string unknown_type
1676
     */
1677
    public function getFbRequestMessage()
1678
    {
1679
        return $this->fbRequestMessage;
1680
    }
1681
1682
    /**
1683
     *
1684
     * @param unknown_type $fbRequestMessage
1685
     */
1686
    public function setFbRequestMessage($fbRequestMessage)
1687
    {
1688
        $this->fbRequestMessage = $fbRequestMessage;
1689
1690
        return $this;
1691
    }
1692
1693
    /**
1694
     *
1695
     * @return the unknown_type
1696
     */
1697
    public function getTwShareMessage()
1698
    {
1699
        return $this->twShareMessage;
1700
    }
1701
1702
    /**
1703
     *
1704
     * @param unknown_type $twShareMessage
1705
     */
1706
    public function setTwShareMessage($twShareMessage)
1707
    {
1708
        $this->twShareMessage = $twShareMessage;
1709
1710
        return $this;
1711
    }
1712
1713
    /**
1714
     *
1715
     * @return DateTime $createdAt
1716
     */
1717
    public function getCreatedAt()
1718
    {
1719
        return $this->createdAt;
1720
    }
1721
1722
    /**
1723
     *
1724
     * @param \DateTime $createdAt
1725
     */
1726
    public function setCreatedAt($createdAt)
1727
    {
1728
        $this->createdAt = $createdAt;
1729
1730
        return $this;
1731
    }
1732
1733
    /**
1734
     *
1735
     * @return DateTime $updatedAt
1736
     */
1737
    public function getUpdatedAt()
1738
    {
1739
        return $this->updatedAt;
1740
    }
1741
1742
    /**
1743
     *
1744
     * @param \DateTime $updatedAt
1745
     */
1746
    public function setUpdatedAt($updatedAt)
1747
    {
1748
        $this->updatedAt = $updatedAt;
1749
1750
        return $this;
1751
    }
1752
1753
    /**
1754
     * Convert the object to an array.
1755
     *
1756
     * @return array
1757
     */
1758
    public function getArrayCopy()
1759
    {
1760
        $obj_vars = get_object_vars($this);
1761
1762 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...
1763
            $obj_vars['publicationDate'] = $obj_vars['publicationDate']->format('d/m/Y H:i:s');
1764
        }
1765 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...
1766
            $obj_vars['endDate'] = $obj_vars['endDate']->format('d/m/Y H:i:s');
1767
        }
1768 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...
1769
            $obj_vars['startDate'] = $obj_vars['startDate']->format('d/m/Y H:i:s');
1770
        }
1771
1772
        return $obj_vars;
1773
    }
1774
1775
    /**
1776
     * Convert the object to json.
1777
     *
1778
     * @return array
1779
     */
1780
    public function jsonSerialize()
1781
    {
1782
        return $this->getArrayCopy();
1783
    }
1784
1785
    /**
1786
     * Populate from an array.
1787
     *
1788
     * @param array $data
1789
     */
1790
    public function populate($data = array())
1791
    {
1792
        if (isset($data['partner']) && $data['partner'] !== null) {
1793
            $this->partner = $data['partner'];
1794
        }
1795
1796
        $this->title = (isset($data['title'])) ? $data['title'] : null;
1797
        $this->type = (isset($data['type']) && $data['type'] !== null) ? $data['type'] : null;
1798
1799
        if (isset($data['mainImage']) && $data['mainImage'] !== null) {
1800
            $this->mainImage = $data['mainImage'];
1801
        }
1802
1803
        if (isset($data['secondImage']) && $data['secondImage'] !== null) {
1804
            $this->secondImage = $data['secondImage'];
1805
        }
1806
1807 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...
1808
            $this->active = $data['active'];
1809
        }
1810
1811
        $this->layout           = (isset($data['layout'])) ? $data['layout'] : null;
1812
        $this->stylesheet       = (isset($data['stylesheet'])) ? $data['stylesheet'] : null;
1813
1814
        $this->pushHome         = (isset($data['pushHome']) && $data['pushHome'] !== null) ? $data['pushHome'] : 0;
1815
        $this->displayHome      = (isset($data['displayHome']) && $data['displayHome'] !== null) ?
1816
            $data['displayHome'] :
1817
            0;
1818
        $this->prizeCategory   = (isset($data['prizeCategory'])) ? $data['prizeCategory'] : null;
1819
1820
        $this->publicationDate  = (isset($data['publicationDate']) && $data['publicationDate'] !== null) ?
1821
            DateTime::createFromFormat('d/m/Y', $data['publicationDate']) :
1822
            null;
1823
        $this->endDate         = (isset($data['endDate']) && $data['endDate'] !== null) ?
1824
            DateTime::createFromFormat('d/m/Y', $data['endDate']) :
1825
            null;
1826
        $this->startDate       = (isset($data['startDate']) && $data['startDate'] !== null) ?
1827
            DateTime::createFromFormat('d/m/Y', $data['startDate']) :
1828
            null;
1829
1830
        $this->identifier       = (isset($data['identifier'])) ? $data['identifier'] : null;
1831
        $this->welcomeBlock    = (isset($data['welcomeBlock'])) ? $data['welcomeBlock'] : null;
1832
        $this->termsBlock       = (isset($data['termsBlock'])) ? $data['termsBlock'] : null;
1833
        $this->conditionsBlock  = (isset($data['conditionsBlock'])) ? $data['conditionsBlock'] : null;
1834
1835
        $this->fbShareDescription   = (isset($data['fbShareDescription'])) ? $data['fbShareDescription'] : null;
1836
        $this->fbShareImage     = (isset($data['fbShareImage'])) ? $data['fbShareImage'] : null;
1837
        $this->fbRequestMessage = (isset($data['fbRequestMessage'])) ? $data['fbRequestMessage'] : null;
1838
        $this->twShareMessage   = (isset($data['twShareMessage'])) ? $data['twShareMessage'] : null;
1839
        $this->emailSubjectMessage   = (isset($data['emailSubjectMessage'])) ? $data['emailSubjectMessage'] : null;
1840
        $this->emailShareMessage   = (isset($data['emailShareMessage'])) ? $data['emailShareMessage'] : null;
1841
    }
1842
1843
    public function setInputFilter(InputFilterInterface $inputFilter)
1844
    {
1845
        throw new \Exception("Not used");
1846
    }
1847
1848
    public function getInputFilter()
1849
    {
1850
        if (! $this->inputFilter) {
1851
            $inputFilter = new InputFilter();
1852
            $factory = new InputFactory();
1853
1854
            $inputFilter->add($factory->createInput(array(
1855
                'name' => 'id',
1856
                'required' => true,
1857
                'filters' => array(
1858
                    array(
1859
                        'name' => 'Int'
1860
                    )
1861
                )
1862
            )));
1863
1864
            $inputFilter->add($factory->createInput(array(
1865
                'name' => 'partner',
1866
                'required' => false
1867
            )));
1868
1869
            $inputFilter->add($factory->createInput(array(
1870
                'name' => 'fbAppId',
1871
                'required' => false
1872
            )));
1873
1874
            $inputFilter->add($factory->createInput(array(
1875
                'name' => 'fbPageId',
1876
                'required' => false
1877
            )));
1878
1879
            $inputFilter->add($factory->createInput(array(
1880
                'name' => 'fbPostId',
1881
                'required' => false
1882
            )));
1883
1884
            $inputFilter->add($factory->createInput(array(
1885
                'name' => 'prizes',
1886
                'required' => false
1887
            )));
1888
1889
            $inputFilter->add($factory->createInput(array(
1890
                'name' => 'invitations',
1891
                'required' => false
1892
            )));
1893
1894
            $inputFilter->add($factory->createInput(array(
1895
                'name' => 'title',
1896
                'required' => true,
1897
                'filters' => array(
1898
                    array(
1899
                        'name' => 'StripTags'
1900
                    ),
1901
                    array(
1902
                        'name' => 'StringTrim'
1903
                    )
1904
                ),
1905
                'validators' => array(
1906
                    array(
1907
                        'name' => 'StringLength',
1908
                        'options' => array(
1909
                            'encoding' => 'UTF-8',
1910
                            'min' => 5,
1911
                            'max' => 255
1912
                        )
1913
                    )
1914
                )
1915
            )));
1916
1917
            $inputFilter->add($factory->createInput(array(
1918
                'name' => 'publicationDate',
1919
                'required' => false,
1920
            )));
1921
1922
            $inputFilter->add($factory->createInput(array(
1923
                'name' => 'startDate',
1924
                'required' => false,
1925
            )));
1926
1927
            $inputFilter->add($factory->createInput(array(
1928
                'name' => 'endDate',
1929
                'required' => false,
1930
            )));
1931
1932
            $inputFilter->add($factory->createInput(array(
1933
                'name' => 'closeDate',
1934
                'required' => false,
1935
            )));
1936
1937
            $inputFilter->add($factory->createInput(array(
1938
                'name' => 'termsOptin',
1939
                'required' => false,
1940
            )));
1941
1942
            $inputFilter->add($factory->createInput(array(
1943
                'name' => 'identifier',
1944
                'required' => true,
1945
                'filters' => array(
1946
                    array(
1947
                        'name' => 'StripTags'
1948
                    ),
1949
                    array(
1950
                        'name' => 'StringTrim'
1951
                    ),
1952
                    array(
1953
                        'name' => 'PlaygroundCore\Filter\Slugify'
1954
                    )
1955
                ),
1956
                'validators' => array(
1957
                    array(
1958
                        'name' => 'StringLength',
1959
                        'options' => array(
1960
                            'encoding' => 'UTF-8',
1961
                            'min' => 3,
1962
                            'max' => 255
1963
                        )
1964
                    )
1965
                )
1966
            )));
1967
1968
            $inputFilter->add($factory->createInput(array(
1969
                'name'     => 'playLimit',
1970
                'required' => false,
1971
                'validators' => array(
1972
                    array(
1973
                        'name'    => 'Between',
1974
                        'options' => array(
1975
                            'min'      => 0,
1976
                            'max'      => 999999,
1977
                        ),
1978
                    ),
1979
                ),
1980
            )));
1981
1982
            $inputFilter->add($factory->createInput(array(
1983
                'name' => 'playLimitScale',
1984
                'required' => false,
1985
                'validators' => array(
1986
                    array(
1987
                        'name' => 'InArray',
1988
                        'options' => array(
1989
                            'haystack' => array('day', 'week', 'month', 'year', 'always'),
1990
                        ),
1991
                    ),
1992
                ),
1993
            )));
1994
1995
            $inputFilter->add($factory->createInput(array(
1996
                'name' => 'playBonus',
1997
                'required' => false,
1998
                'validators' => array(
1999
                    array(
2000
                        'name' => 'InArray',
2001
                        'options' => array(
2002
                            'haystack' => array('none', 'per_entry', 'one'),
2003
                        ),
2004
                    ),
2005
                ),
2006
            )));
2007
2008
            $inputFilter->add($factory->createInput(array(
2009
                'name' => 'active',
2010
                'required' => true
2011
            )));
2012
2013
            $inputFilter->add($factory->createInput(array(
2014
                'name' => 'onInvitation',
2015
                'required' => false
2016
            )));
2017
2018
            $inputFilter->add(
2019
                $factory->createInput(
2020
                    [
2021
                        'name' => 'costToPlay',
2022
                        'required' => false
2023
                    ]
2024
                )
2025
            );
2026
2027
            $inputFilter->add($factory->createInput(array(
2028
                'name' => 'displayHome',
2029
                'required' => false
2030
            )));
2031
2032
            $inputFilter->add($factory->createInput(array(
2033
                'name' => 'pushHome',
2034
                'required' => false
2035
            )));
2036
2037
            $inputFilter->add($factory->createInput(array(
2038
                'name' => 'anonymousAllowed',
2039
                'required' => false
2040
            )));
2041
2042
            $inputFilter->add($factory->createInput(array(
2043
                'name' => 'mailWinner',
2044
                'required' => false
2045
            )));
2046
2047
            $inputFilter->add($factory->createInput(array(
2048
                'name' => 'mailLooser',
2049
                'required' => false
2050
            )));
2051
2052
            $inputFilter->add($factory->createInput(array(
2053
                'name' => 'mailEntry',
2054
                'required' => false
2055
            )));
2056
2057
            $inputFilter->add($factory->createInput(array(
2058
                'name' => 'emailShare',
2059
                'required' => false
2060
            )));
2061
2062
            $inputFilter->add($factory->createInput(array(
2063
                'name' => 'fbShare',
2064
                'required' => false
2065
            )));
2066
2067
            $inputFilter->add($factory->createInput(array(
2068
                'name' => 'twShare',
2069
                'required' => false
2070
            )));
2071
2072
            $inputFilter->add($factory->createInput(array(
2073
                'name' => 'prizeCategory',
2074
                'required' => false,
2075
                'filters' => array(
2076
                    array(
2077
                        'name' => 'Int'
2078
                    )
2079
                )
2080
            )));
2081
2082
            $inputFilter->add($factory->createInput(array(
2083
                'name' => 'fbPageTabTitle',
2084
                'required' => false
2085
            )));
2086
2087
            $inputFilter->add($factory->createInput(array(
2088
                'name' => 'fbPageTabImage',
2089
                'required' => false
2090
            )));
2091
            $inputFilter->add($factory->createInput(array(
2092
                'name' => 'fbPageTabPosition',
2093
                'required' => false
2094
            )));
2095
2096
            $inputFilter->add($factory->createInput(array(
2097
                'name' => 'layout',
2098
                'required' => false,
2099
                'filters' => array(
2100
                    array(
2101
                        'name' => 'StripTags'
2102
                    ),
2103
                    array(
2104
                        'name' => 'StringTrim'
2105
                    )
2106
                ),
2107
                'validators' => array(
2108
                    array(
2109
                        'name' => 'StringLength',
2110
                        'options' => array(
2111
                            'encoding' => 'UTF-8',
2112
                            'min' => 0,
2113
                            'max' => 255
2114
                        )
2115
                    )
2116
                )
2117
            )));
2118
2119
            $inputFilter->add($factory->createInput(array(
2120
                'name' => 'stylesheet',
2121
                'required' => false,
2122
                'filters' => array(
2123
                    array(
2124
                        'name' => 'StripTags'
2125
                    ),
2126
                    array(
2127
                        'name' => 'StringTrim'
2128
                    )
2129
                ),
2130
                'validators' => array(
2131
                    array(
2132
                        'name' => 'StringLength',
2133
                        'options' => array(
2134
                            'encoding' => 'UTF-8',
2135
                            'min' => 0,
2136
                            'max' => 255
2137
                        )
2138
                    )
2139
                )
2140
            )));
2141
2142
            $inputFilter->add($factory->createInput(array(
2143
                'name' => 'fbShareImage',
2144
                'required' => false,
2145
                'filters' => array(
2146
                    array(
2147
                        'name' => 'StripTags'
2148
                    ),
2149
                    array(
2150
                        'name' => 'StringTrim'
2151
                    )
2152
                ),
2153
                'validators' => array(
2154
                    array(
2155
                        'name' => 'StringLength',
2156
                        'options' => array(
2157
                            'encoding' => 'UTF-8',
2158
                            'min' => 1,
2159
                            'max' => 255
2160
                        )
2161
                    )
2162
                )
2163
            )));
2164
2165
            $inputFilter->add($factory->createInput(array(
2166
                'name' => 'emailSubjectMessage',
2167
                'required' => false,
2168
                'filters' => array(
2169
                    array(
2170
                            'name' => 'StripTags'
2171
                    ),
2172
                    array(
2173
                            'name' => 'StringTrim'
2174
                    )
2175
                ),
2176
                'validators' => array(
2177
                    array(
2178
                        'name' => 'StringLength',
2179
                        'options' => array(
2180
                            'encoding' => 'UTF-8',
2181
                            'min' => 1,
2182
                            'max' => 500
2183
                        )
2184
                    )
2185
                )
2186
            )));
2187
2188
            $inputFilter->add($factory->createInput(array(
2189
                'name' => 'emailShareMessage',
2190
                'required' => false,
2191
                'filters' => array(
2192
                    array(
2193
                            'name' => 'StripTags'
2194
                    ),
2195
                    array(
2196
                            'name' => 'StringTrim'
2197
                    )
2198
                ),
2199
                'validators' => array(
2200
                    array(
2201
                        'name' => 'StringLength',
2202
                        'options' => array(
2203
                            'encoding' => 'UTF-8',
2204
                            'min' => 1,
2205
                            'max' => 500
2206
                        )
2207
                    )
2208
                )
2209
            )));
2210
2211
            $inputFilter->add($factory->createInput(array(
2212
                'name' => 'fbShareDescription',
2213
                'required' => false,
2214
                'filters' => array(
2215
                        array(
2216
                                'name' => 'StripTags'
2217
                        ),
2218
                        array(
2219
                                'name' => 'StringTrim'
2220
                        )
2221
                ),
2222
                'validators' => array(
2223
                    array(
2224
                        'name' => 'StringLength',
2225
                        'options' => array(
2226
                            'encoding' => 'UTF-8',
2227
                            'min' => 1,
2228
                            'max' => 500
2229
                            )
2230
                    )
2231
                )
2232
            )));
2233
2234
            $inputFilter->add($factory->createInput(array(
2235
                'name' => 'fbRequestMessage',
2236
                'required' => false,
2237
                'filters' => array(
2238
                    array(
2239
                        'name' => 'StripTags'
2240
                    ),
2241
                    array(
2242
                        'name' => 'StringTrim'
2243
                    )
2244
                ),
2245
                'validators' => array(
2246
                    array(
2247
                        'name' => 'StringLength',
2248
                        'options' => array(
2249
                            'encoding' => 'UTF-8',
2250
                            'min' => 1,
2251
                            'max' => 500
2252
                        )
2253
                    )
2254
                )
2255
            )));
2256
2257
            $inputFilter->add($factory->createInput(array(
2258
                'name' => 'twShareMessage',
2259
                'required' => false,
2260
                'filters' => array(
2261
                    array(
2262
                        'name' => 'StripTags'
2263
                    ),
2264
                    array(
2265
                        'name' => 'StringTrim'
2266
                    )
2267
                ),
2268
                'validators' => array(
2269
                    array(
2270
                        'name' => 'StringLength',
2271
                        'options' => array(
2272
                            'encoding' => 'UTF-8',
2273
                            'min' => 1,
2274
                            'max' => 255
2275
                        )
2276
                    )
2277
                )
2278
            )));
2279
            
2280
            $inputFilter->add($factory->createInput(array(
2281
                'name' => 'anonymousIdentifier',
2282
                'required' => false,
2283
                'filters' => array(
2284
                    array(
2285
                        'name' => 'StripTags'
2286
                    ),
2287
                    array(
2288
                        'name' => 'StringTrim'
2289
                    )
2290
                ),
2291
                'validators' => array(
2292
                    array(
2293
                        'name' => 'StringLength',
2294
                        'options' => array(
2295
                            'encoding' => 'UTF-8',
2296
                            'min' => 0,
2297
                            'max' => 255
2298
                        )
2299
                    )
2300
                )
2301
            )));
2302
2303
            $this->inputFilter = $inputFilter;
2304
        }
2305
2306
        return $this->inputFilter;
2307
    }
2308
2309
    public function setTranslatableLocale($locale)
2310
    {
2311
        $this->locale = $locale;
2312
    }
2313
}
2314