Completed
Push — develop ( 365d8c...a11766 )
by greg
02:35
created

Game::getCostToPlay()   A

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
 * @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(type="string", length=255, nullable=true)
105
     */
106
    protected $domain = null;
107
108
    /**
109
     * @ORM\Column(name="broadcast_post_facebook",type="boolean", nullable=true)
110
     */
111
    protected $broadcastPostFacebook = 0;
112
113
    /**
114
     * @ORM\Column(name="push_home",type="boolean", nullable=true)
115
     */
116
    protected $pushHome = 0;
117
118
    /**
119
     * @ORM\Column(name="display_home",type="boolean", nullable=true)
120
     */
121
    protected $displayHome = 0;
122
123
    /**
124
     * @ORM\Column(name="mail_winner",type="boolean", nullable=true)
125
     */
126
    protected $mailWinner = 0;
127
128
    /**
129
     * @Gedmo\Translatable
130
     * @ORM\Column(name="mail_winner_block", type="text", nullable=true)
131
     */
132
    protected $mailWinnerBlock;
133
134
    /**
135
     * @ORM\Column(name="mail_looser",type="boolean", nullable=true)
136
     */
137
    protected $mailLooser = 0;
138
139
    /**
140
     * @Gedmo\Translatable
141
     * @ORM\Column(name="mail_looser_block", type="text", nullable=true)
142
     */
143
    protected $mailLooserBlock;
144
145
    /**
146
     * @ORM\Column(name="mail_entry",type="boolean", nullable=true)
147
     */
148
    protected $mailEntry = 0;
149
150
    /**
151
     * @ORM\Column(name="email_share",type="boolean", nullable=true)
152
     */
153
    protected $emailShare = 0;
154
155
    /**
156
     * @ORM\Column(name="fb_share",type="boolean", nullable=true)
157
     */
158
    protected $fbShare = 0;
159
160
    /**
161
     * @ORM\Column(name="tw_share",type="boolean", nullable=true)
162
     */
163
    protected $twShare = 0;
164
165
    /**
166
     * @ORM\Column(type="boolean", nullable=false)
167
     */
168
    protected $active = 0;
169
170
    /**
171
     * @ORM\Column(type="boolean", nullable=false)
172
     */
173
    protected $onInvitation = false;
174
175
    /**
176
     * @ORM\OneToMany(targetEntity="Invitation", mappedBy="game", cascade={"persist","remove"}, orphanRemoval=true)
177
     */
178
    private $invitations;
179
180
    /**
181
     * @ORM\Column(name="anonymous_allowed",type="boolean", nullable=true)
182
     */
183
    protected $anonymousAllowed = 0;
184
    
185
    /**
186
     * This column can be filled in when anonymousAllowed = 1.
187
     * If you put a value, it has to be a field key from playerdata. This key will
188
     * then be used to identify a player (generally 'email')
189
     *
190
     * @ORM\Column(name="anonymous_identifier", type="text", nullable=true)
191
     */
192
    protected $anonymousIdentifier;
193
194
    /**
195
     * @ORM\Column(name="publication_date", type="datetime", nullable=true)
196
     */
197
    protected $publicationDate;
198
199
    /**
200
     * @ORM\Column(name="start_date", type="datetime", nullable=true)
201
     */
202
    protected $startDate;
203
204
    /**
205
     * @ORM\Column(name="end_date", type="datetime", nullable=true)
206
     */
207
    protected $endDate;
208
209
    /**
210
     * @ORM\Column(name="close_date", type="datetime", nullable=true)
211
     */
212
    protected $closeDate;
213
214
    /**
215
     * play limitation. 0 : No limit
216
     *
217
     * @ORM\Column(name="play_limit", type="integer", nullable=false)
218
     */
219
    protected $playLimit = 0;
220
221
    /**
222
     * this field is taken into account only if playLimit<>0.
223
     * if 'always' only $playLimit play by person for this game
224
     * if 'day' only $playLimit play by person a day
225
     * if 'week' only $playLimit play by person a week
226
     * if 'month' only $playLimit play by person a month
227
     * if 'year' only $playLimit play by person a year
228
     *
229
     * @ORM\Column(name="play_limit_scale", type="string", nullable=true)
230
     */
231
    protected $playLimitScale;
232
233
    /**
234
     * this field is used for offering a complementary play entry
235
     * (for example, when the player share the game). The entries
236
     * of type 'bonus' won't be taken into account in the calaculation
237
     * of the authorized playLimit.
238
     *
239
     * if 'none' or null no play bonus is offered
240
     * if 'per_entry' a play bonus is offered for each entry
241
     * if 'one' only one play bonus is offered for every entries of the game
242
     *
243
     * @ORM\Column(name="play_bonus", type="string", nullable=true)
244
     */
245
    protected $playBonus;
246
247
    /**
248
     * @ORM\Column(type="string", length=255, nullable=true)
249
     */
250
    protected $layout;
251
252
    /**
253
     * @ORM\Column(type="string", length=255, nullable=true)
254
     */
255
    protected $stylesheet;
256
257
    /**
258
     * @Gedmo\Translatable
259
     * @ORM\Column(name="welcome_block", type="text", nullable=true)
260
     */
261
    protected $welcomeBlock;
262
263
    /**
264
     * @Gedmo\Translatable
265
     * @ORM\Column(type="text", nullable=true)
266
     */
267
    protected $termsBlock;
268
269
    /**
270
     * @ORM\Column(name="terms_optin", type="boolean", nullable=true)
271
     */
272
    protected $termsOptin = 0;
273
274
    /**
275
     * @Gedmo\Translatable
276
     * @ORM\Column(type="text", nullable=true)
277
     */
278
    protected $conditionsBlock;
279
280
    /**
281
     * @ORM\OneToMany(targetEntity="Prize", mappedBy="game", cascade={"persist","remove"}, orphanRemoval=true)
282
     */
283
    private $prizes;
284
285
    /**
286
     * @ORM\Column(name="fb_page_id", type="string", nullable=true)
287
     */
288
    protected $fbPageId;
289
290
    /**
291
     * @ORM\Column(name="fb_app_id", type="string", nullable=true)
292
     */
293
    protected $fbAppId;
294
295
    /**
296
     * @ORM\Column(name="fb_post_id", type="string", nullable=true)
297
     */
298
    protected $fbPostId;
299
300
    /**
301
     * @Gedmo\Translatable
302
     * @ORM\Column(name="fb_page_tab_title", type="string", length=255, nullable=true)
303
     */
304
    protected $fbPageTabTitle;
305
306
    /**
307
     * @ORM\Column(name="fb_page_tab_image", type="string", length=255, nullable=true)
308
     */
309
    protected $fbPageTabImage;
310
311
    /**
312
     * What is the tab's position. 0 : the highest
313
     *
314
     * @ORM\Column(name="fb_page_tab_position", type="integer", nullable=false)
315
     */
316
    protected $fbPageTabPosition = 0;
317
318
    /**
319
     * @Gedmo\Translatable
320
     * @ORM\Column(name="email_share_subject", type="text", nullable=true)
321
     */
322
    protected $emailShareSubject;
323
324
    /**
325
     * @Gedmo\Translatable
326
     * @ORM\Column(name="email_share_message", type="text", nullable=true)
327
     */
328
    protected $emailShareMessage;
329
330
    /**
331
     * @Gedmo\Translatable
332
     * @ORM\Column(name="fb_share_description", type="text", nullable=true)
333
     */
334
    protected $fbShareDescription;
335
336
    /**
337
     * @ORM\Column(name="fb_share_image", type="string", length=255, nullable=true)
338
     */
339
    protected $fbShareImage;
340
341
    /**
342
     * @Gedmo\Translatable
343
     * @ORM\Column(name="fb_request_message", type="text", nullable=true)
344
     */
345
    protected $fbRequestMessage;
346
347
    /**
348
     * @Gedmo\Translatable
349
     * @ORM\Column(name="tw_share_message", type="string", length=255, nullable=true)
350
     */
351
    protected $twShareMessage;
352
353
    /**
354
     * available steps : index, register, play, result, bounce
355
     * This string is transformed into an array and represents the workflow of the game
356
     * @ORM\Column(name="steps", type="string", length=255, nullable=true)
357
     */
358
    protected $steps = 'play,result';
359
360
    /**
361
     * @ORM\Column(name="steps_views", type="string", length=255, nullable=true)
362
     */
363
    protected $stepsViews = '{"index":{},"play":{},"result":{},"bounce":{}}';
364
365
    /**
366
     * If you enter a value, this will be the condition to enter the game
367
     * The cost will apply to the "wallet" of the player which correspond to a leaderboard
368
     * @ORM\Column(name="cost_to_play", type="integer", nullable=true)
369
     */
370
    protected $costToPlay = 0;
371
372
    /**
373
     * Doctrine accessible value of discriminator (field 'type' is not
374
     * accessible through query)
375
     * And I want to be able to sort game collection based on type
376
     * http://www.doctrine-project.org/jira/browse/DDC-707
377
     * @ORM\Column(name="class_type", type="string", length=255, nullable=false)
378
     */
379
    protected $classType;
380
381
    /**
382
     * @ORM\Column(name="created_at", type="datetime")
383
     */
384
    protected $createdAt;
385
386
    /**
387
     * @ORM\Column(name="updated_at", type="datetime")
388
     */
389
    protected $updatedAt;
390
391
    public function __construct()
392
    {
393
        $this->prizes = new ArrayCollection();
394
        $this->invitations = new ArrayCollection();
395
    }
396
397
    /**
398
     * @PrePersist
399
     */
400
    public function createChrono()
401
    {
402
        $this->createdAt = new \DateTime("now");
403
        $this->updatedAt = new \DateTime("now");
404
    }
405
406
    /**
407
     * @PreUpdate
408
     */
409
    public function updateChrono()
410
    {
411
        $this->updatedAt = new \DateTime("now");
412
    }
413
414
    /**
415
     *
416
     * @return the $id
417
     */
418
    public function getId()
419
    {
420
        return $this->id;
421
    }
422
423
    /**
424
     *
425
     * @param field_type $id
426
     */
427
    public function setId($id)
428
    {
429
        $this->id = $id;
430
431
        return $this;
432
    }
433
434
    /**
435
     * @return the $playerForm
436
     */
437
    public function getPlayerForm()
438
    {
439
        return $this->playerForm;
440
    }
441
442
    /**
443
     * @param field_type $playerForm
444
     */
445
    public function setPlayerForm($playerForm)
446
    {
447
        $this->playerForm = $playerForm;
448
449
        return $this;
450
    }
451
452
    /**
453
     *
454
     * @return the unknown_type
455
     */
456
    public function getPartner()
457
    {
458
        return $this->partner;
459
    }
460
461
    /**
462
     *
463
     * @param unknown_type $partner
464
     */
465
    public function setPartner($partner)
466
    {
467
        $this->partner = $partner;
468
469
        return $this;
470
    }
471
472
    /**
473
     *
474
     * @param unknown_type $prizeCategory
475
     */
476
    public function setPrizeCategory($prizeCategory)
477
    {
478
        $this->prizeCategory = $prizeCategory;
479
480
        return $this;
481
    }
482
483
    /**
484
     *
485
     * @return the unknown_type
486
     */
487
    public function getPrizeCategory()
488
    {
489
        return $this->prizeCategory;
490
    }
491
492
    /**
493
     *
494
     * @return the $title
495
     */
496
    public function getTitle()
497
    {
498
        return $this->title;
499
    }
500
501
    /**
502
     *
503
     * @param field_type $title
504
     */
505
    public function setTitle($title)
506
    {
507
        $this->title = $title;
508
509
        return $this;
510
    }
511
512
    /**
513
     *
514
     * @return the $identifier
515
     */
516
    public function getIdentifier()
517
    {
518
        return $this->identifier;
519
    }
520
521
    /**
522
     *
523
     * @param field_type $identifier
524
     */
525
    public function setIdentifier($identifier)
526
    {
527
        $this->identifier = $identifier;
528
529
        return $this;
530
    }
531
532
    /**
533
     * @return integer $anonymousAllowed
534
     */
535
    public function getAnonymousAllowed()
536
    {
537
        return $this->anonymousAllowed;
538
    }
539
540
    /**
541
     * @param number $anonymousAllowed
542
     */
543
    public function setAnonymousAllowed($anonymousAllowed)
544
    {
545
        $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...
546
547
        return $this;
548
    }
549
550
    /**
551
     * @return the $anonymousIdentifier
552
     */
553
    public function getAnonymousIdentifier()
554
    {
555
        return $this->anonymousIdentifier;
556
    }
557
558
    /**
559
     * @param field_type $anonymousIdentifier
560
     */
561
    public function setAnonymousIdentifier($anonymousIdentifier)
562
    {
563
        $this->anonymousIdentifier = $anonymousIdentifier;
564
    }
565
566
    /**
567
     *
568
     * @return the $mainImage
569
     */
570
    public function getMainImage()
571
    {
572
        return $this->mainImage;
573
    }
574
575
    /**
576
     *
577
     * @param field_type $mainImage
578
     */
579
    public function setMainImage($mainImage)
580
    {
581
        $this->mainImage = $mainImage;
582
583
        return $this;
584
    }
585
586
    /**
587
     *
588
     * @return the $secondImage
589
     */
590
    public function getSecondImage()
591
    {
592
        return $this->secondImage;
593
    }
594
595
    /**
596
     *
597
     * @param field_type $secondImage
598
     */
599
    public function setSecondImage($secondImage)
600
    {
601
        $this->secondImage = $secondImage;
602
603
        return $this;
604
    }
605
606
    /**
607
     *
608
     * @return integer $broadcastFacebook
609
     */
610
    public function getBroadcastFacebook()
611
    {
612
        return $this->broadcastFacebook;
613
    }
614
615
    /**
616
     *
617
     * @param field_type $broadcastFacebook
618
     */
619
    public function setBroadcastFacebook($broadcastFacebook)
620
    {
621
        $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...
622
623
        return $this;
624
    }
625
626
    /**
627
     *
628
     * @return integer $domain
629
     */
630
    public function getDomain()
631
    {
632
        return $this->domain;
633
    }
634
635
    /**
636
     *
637
     * @param field_type $domain
638
     */
639
    public function setDomain($domain)
640
    {
641
        $this->domain = $domain;
642
643
        return $this;
644
    }
645
646
    /**
647
     *
648
     * @return integer $broadcastPlatform
649
     */
650
    public function getBroadcastPlatform()
651
    {
652
        return $this->broadcastPlatform;
653
    }
654
655
    /**
656
     *
657
     * @param field_type $broadcastPlatform
658
     */
659
    public function setBroadcastPlatform($broadcastPlatform)
660
    {
661
        $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...
662
663
        return $this;
664
    }
665
666
    /**
667
     * @return integer $broadcastPostFacebook
668
     */
669
    public function getBroadcastPostFacebook()
670
    {
671
        return $this->broadcastPostFacebook;
672
    }
673
674
    /**
675
     * @param number $broadcastPostFacebook
676
     */
677
    public function setBroadcastPostFacebook($broadcastPostFacebook)
678
    {
679
        $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...
680
681
        return $this;
682
    }
683
684
    /**
685
     * @return integer $mailWinner
686
     */
687
    public function getMailWinner()
688
    {
689
        return $this->mailWinner;
690
    }
691
692
    /**
693
     * @param number $mailWinner
694
     */
695
    public function setMailWinner($mailWinner)
696
    {
697
        $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...
698
    }
699
700
    /**
701
     * @return the $mailWinnerBlock
702
     */
703
    public function getMailWinnerBlock()
704
    {
705
        return $this->mailWinnerBlock;
706
    }
707
708
    /**
709
     * @param field_type $mailWinnerBlock
710
     */
711
    public function setMailWinnerBlock($mailWinnerBlock)
712
    {
713
        $this->mailWinnerBlock = $mailWinnerBlock;
714
    }
715
716
    /**
717
     * @return integer $mailEntry
718
     */
719
    public function getMailEntry()
720
    {
721
        return $this->mailEntry;
722
    }
723
724
    /**
725
     * @param number $mailEntry
726
     */
727
    public function setMailEntry($mailEntry)
728
    {
729
        $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...
730
    }
731
732
    /**
733
     * @return boolean $emailShare
734
     */
735
    public function getEmailShare()
736
    {
737
        return $this->emailShare;
738
    }
739
740
    /**
741
     * @param boolean $emailShare
742
     */
743
    public function setEmailShare($emailShare)
744
    {
745
        $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...
746
    }
747
748
    /**
749
     * @return boolean $fbShare
750
     */
751
    public function getFbShare()
752
    {
753
        return $this->fbShare;
754
    }
755
756
    /**
757
     * @param boolean $fbShare
758
     */
759
    public function setFbShare($fbShare)
760
    {
761
        $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...
762
    }
763
764
    /**
765
     * @return boolean $twShare
766
     */
767
    public function getTwShare()
768
    {
769
        return $this->twShare;
770
    }
771
772
    /**
773
     * @param boolean $twShare
774
     */
775
    public function setTwShare($twShare)
776
    {
777
        $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...
778
    }
779
780
    /**
781
     * @return integer $mailLooser
782
     */
783
    public function getMailLooser()
784
    {
785
        return $this->mailLooser;
786
    }
787
788
    /**
789
     * @param number $mailLooser
790
     */
791
    public function setMailLooser($mailLooser)
792
    {
793
        $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...
794
    }
795
796
    /**
797
     * @return the $mailLooserBlock
798
     */
799
    public function getMailLooserBlock()
800
    {
801
        return $this->mailLooserBlock;
802
    }
803
804
    /**
805
     * @param field_type $mailLooserBlock
806
     */
807
    public function setMailLooserBlock($mailLooserBlock)
808
    {
809
        $this->mailLooserBlock = $mailLooserBlock;
810
    }
811
812
    /**
813
     *
814
     * @return integer $pushHome
815
     */
816
    public function getPushHome()
817
    {
818
        return $this->pushHome;
819
    }
820
821
    /**
822
     *
823
     * @param field_type $pushHome
824
     */
825
    public function setPushHome($pushHome)
826
    {
827
        $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...
828
829
        return $this;
830
    }
831
832
    /**
833
     *
834
     * @return integer $displayHome
835
     */
836
    public function getDisplayHome()
837
    {
838
        return $this->displayHome;
839
    }
840
841
    /**
842
     *
843
     * @param field_type $displayHome
844
     */
845
    public function setDisplayHome($displayHome)
846
    {
847
        $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...
848
849
        return $this;
850
    }
851
852
    /**
853
     *
854
     * @return the $publicationDate
855
     */
856
    public function getPublicationDate()
857
    {
858
        return $this->publicationDate;
859
    }
860
861
    /**
862
     *
863
     * @param field_type $publicationDate
864
     */
865
    public function setPublicationDate($publicationDate)
866
    {
867
        $this->publicationDate = $publicationDate;
868
869
        return $this;
870
    }
871
872
    /**
873
     *
874
     * @return the $startDate
875
     */
876
    public function getStartDate()
877
    {
878
        return $this->startDate;
879
    }
880
881
    /**
882
     *
883
     * @param field_type $startDate
884
     */
885
    public function setStartDate($startDate)
886
    {
887
        $this->startDate = $startDate;
888
889
        return $this;
890
    }
891
892
    /**
893
     *
894
     * @return the $endDate
895
     */
896
    public function getEndDate()
897
    {
898
        return $this->endDate;
899
    }
900
901
    /**
902
     *
903
     * @param field_type $endDate
904
     */
905
    public function setEndDate($endDate)
906
    {
907
        $this->endDate = $endDate;
908
909
        return $this;
910
    }
911
912
    /**
913
     *
914
     * @return the $closeDate
915
     */
916
    public function getCloseDate()
917
    {
918
        return $this->closeDate;
919
    }
920
921
    /**
922
     *
923
     * @param field_type $closeDate
924
     */
925
    public function setCloseDate($closeDate)
926
    {
927
        $this->closeDate = $closeDate;
928
929
        return $this;
930
    }
931
932
    public function isClosed()
933
    {
934
        $today = new DateTime('now');
935
        if (($this->getCloseDate() && $this->getCloseDate() < $today)
936
            ||
937
            ($this->getPublicationDate() && $this->getPublicationDate() > $today)
938
        ) {
939
            return true;
940
        }
941
942
        return false;
943
    }
944
945
    public function isOpen()
946
    {
947
        return !$this->isClosed();
948
    }
949
950 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...
951
    {
952
        $today = new DateTime('now');
953
        if (((!$this->getStartDate() || $this->getStartDate() <= $today))
954
            && (!$this->getEndDate() || $this->getEndDate() > $today)
955
        ) {
956
            return true;
957
        }
958
959
        return false;
960
    }
961
962 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...
963
    {
964
        $today = new DateTime('now');
965
        if ($this->getEndDate() && $this->getEndDate() <= $today
966
            ||
967
            ($this->getCloseDate() && $this->getCloseDate() <= $today)
968
        ) {
969
            return true;
970
        }
971
972
        return false;
973
    }
974
975
    public function isOnline()
976
    {
977
        if ($this->getActive() && $this->getBroadcastPlatform()) {
978
            return true;
979
        }
980
981
        return false;
982
    }
983
984
    // json array : {"0":"index","1":"play","2":"result","3":"bounce"}
985
    public function getStepsArray()
986
    {
987
        $steps = null;
988
989
        if ($this->getSteps() && $this->getSteps()[0] === '{') {
990
            $steps = json_decode($this->getSteps(), true);
991
        } else if ($this->getSteps()) {
992
            $steps = explode(',', $this->getSteps());
993
        }
994
        if (!$steps) {
995
            $steps = array('index','play','result','bounce');
996
        }
997
        return $steps;
998
    }
999
1000
    public function getStepsViewsArray()
1001
    {
1002
        $viewSteps = null;
1003
1004
        if ($this->getStepsViews()) {
1005
            $viewSteps = json_decode($this->getStepsViews(), true);
1006
        }
1007
        if (!$viewSteps) {
1008
            $viewSteps = array('index','play','result','bounce');
1009
        }
1010
1011
        return $viewSteps;
1012
    }
1013
1014
    public function getSteps()
1015
    {
1016
        return $this->steps;
1017
    }
1018
1019
    public function setSteps($steps)
1020
    {
1021
        $this->steps = $steps;
1022
1023
        return $this;
1024
    }
1025
1026
    /**
1027
     * This method returns the first step in the game workflow
1028
     * @return string
1029
     */
1030
    public function firstStep()
1031
    {
1032
        $steps = $this->getStepsArray();
1033
1034
        return $steps[0];
1035
    }
1036
1037
    /**
1038
     * This method returns the last step in the game workflow
1039
     * @return string
1040
     */
1041
    public function lastStep()
1042
    {
1043
        $steps = $this->getStepsArray();
1044
        $nbSteps = count($steps);
1045
1046
        return $steps[$nbSteps-1];
1047
    }
1048
1049
    /**
1050
     * This method returns the previous step in the game workflow
1051
     * @param string $step
1052
     * @return string
1053
     */
1054 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...
1055
    {
1056
        $steps = $this->getStepsArray();
1057
        $key = array_search($step, $steps);
1058
1059
        if (is_int($key) && $key > 0) {
1060
            return $steps[$key-1];
1061
        }
1062
1063
        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...
1064
    }
1065
1066
    /**
1067
     * This method returns the next step in the game workflow
1068
     * @param string $step
1069
     * @return string
1070
     */
1071 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...
1072
    {
1073
        $steps = $this->getStepsArray();
1074
        $key = array_search($step, $steps);
1075
1076
        if (is_int($key) && $key < count($steps)-1) {
1077
            return $steps[$key+1];
1078
        }
1079
1080
        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...
1081
    }
1082
1083
    /**
1084
     * @return string $stepsViews
1085
     */
1086
    public function getStepsViews()
1087
    {
1088
        return $this->stepsViews;
1089
    }
1090
1091
    /**
1092
     * @param string $stepsViews
1093
     */
1094
    public function setStepsViews($stepsViews)
1095
    {
1096
        $this->stepsViews = $stepsViews;
1097
1098
        return $this;
1099
    }
1100
1101
    public function getState()
1102
    {
1103
        if ($this->isOpen()) {
1104
            if (!$this->isStarted() && !$this->isFinished()) {
1105
                return self::GAME_PUBLISHED;
1106
            } elseif ($this->isStarted()) {
1107
                return self::GAME_IN_PROGRESS;
1108
            } elseif ($this->isFinished()) {
1109
                return self::GAME_FINISHED;
1110
            }
1111
        } else {
1112
            if ($this->isFinished()) {
1113
                return self::GAME_CLOSED;
1114
            } else {
1115
                return self::GAME_SCHEDULE;
1116
            }
1117
        }
1118
    }
1119
1120
    /**
1121
     * @return integer unknown_type
1122
     */
1123
    public function getPlayLimit()
1124
    {
1125
        return $this->playLimit;
1126
    }
1127
1128
    /**
1129
     * @param unknown_type $playLimit
1130
     */
1131
    public function setPlayLimit($playLimit)
1132
    {
1133
        $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...
1134
1135
        return $this;
1136
    }
1137
1138
    /**
1139
     * @return the unknown_type
1140
     */
1141
    public function getPlayLimitScale()
1142
    {
1143
        return $this->playLimitScale;
1144
    }
1145
1146
    /**
1147
     * @param unknown_type $playLimitScale
1148
     */
1149
    public function setPlayLimitScale($playLimitScale)
1150
    {
1151
        $this->playLimitScale = $playLimitScale;
1152
1153
        return $this;
1154
    }
1155
1156
    /**
1157
     * @return the unknown_type
1158
     */
1159
    public function getPlayBonus()
1160
    {
1161
        return $this->playBonus;
1162
    }
1163
1164
    /**
1165
     * @param unknown_type $playBonus
1166
     */
1167
    public function setPlayBonus($playBonus)
1168
    {
1169
        $this->playBonus = $playBonus;
1170
1171
        return $this;
1172
    }
1173
1174
    /**
1175
     *
1176
     * @return the $layout
1177
     */
1178
    public function getLayout()
1179
    {
1180
        return $this->layout;
1181
    }
1182
1183
    /**
1184
     *
1185
     * @param field_type $layout
1186
     */
1187
    public function setLayout($layout)
1188
    {
1189
        $this->layout = $layout;
1190
1191
        return $this;
1192
    }
1193
1194
    /**
1195
     *
1196
     * @return the $stylesheet
1197
     */
1198
    public function getStylesheet()
1199
    {
1200
        return $this->stylesheet;
1201
    }
1202
1203
    /**
1204
     *
1205
     * @param field_type $stylesheet
1206
     */
1207
    public function setStylesheet($stylesheet)
1208
    {
1209
        $this->stylesheet = $stylesheet;
1210
1211
        return $this;
1212
    }
1213
1214
    /**
1215
     *
1216
     * @return the $welcomeBlock
1217
     */
1218
    public function getWelcomeBlock()
1219
    {
1220
        return $this->welcomeBlock;
1221
    }
1222
1223
    /**
1224
     *
1225
     * @param field_type $welcomeBlock
1226
     */
1227
    public function setWelcomeBlock($welcomeBlock)
1228
    {
1229
        $this->welcomeBlock = $welcomeBlock;
1230
1231
        return $this;
1232
    }
1233
1234
    /**
1235
     *
1236
     * @return the $termsBlock
1237
     */
1238
    public function getTermsBlock()
1239
    {
1240
        return $this->termsBlock;
1241
    }
1242
1243
    /**
1244
     *
1245
     * @param text $termsBlock
1246
     */
1247
    public function setTermsBlock($termsBlock)
1248
    {
1249
        $this->termsBlock = $termsBlock;
1250
1251
        return $this;
1252
    }
1253
1254
    /**
1255
     *
1256
     * @return integer $termsOptin
1257
     */
1258
    public function getTermsOptin()
1259
    {
1260
        return $this->termsOptin;
1261
    }
1262
1263
    /**
1264
     *
1265
     * @param text $termsOptin
1266
     */
1267
    public function setTermsOptin($termsOptin)
1268
    {
1269
        $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...
1270
1271
        return $this;
1272
    }
1273
1274
    /**
1275
     *
1276
     * @return the $conditionsBlock
1277
     */
1278
    public function getConditionsBlock()
1279
    {
1280
        return $this->conditionsBlock;
1281
    }
1282
1283
    /**
1284
     *
1285
     * @param text $conditionsBlock
1286
     */
1287
    public function setConditionsBlock($conditionsBlock)
1288
    {
1289
        $this->conditionsBlock = $conditionsBlock;
1290
1291
        return $this;
1292
    }
1293
1294
    /**
1295
     * @return ArrayCollection unknown_type
1296
     */
1297
    public function getPrizes()
1298
    {
1299
        return $this->prizes;
1300
    }
1301
1302
    /**
1303
     * frm collection solution
1304
     * @param ArrayCollection $prizes
1305
     */
1306
    public function setPrizes(ArrayCollection $prizes)
1307
    {
1308
        $this->prizes = $prizes;
1309
1310
        return $this;
1311
    }
1312
1313
    public function addPrizes(ArrayCollection $prizes)
1314
    {
1315
        foreach ($prizes as $prize) {
1316
            $prize->setGame($this);
1317
            $this->prizes->add($prize);
1318
        }
1319
    }
1320
1321
1322
    public function removePrizes(ArrayCollection $prizes)
1323
    {
1324
        foreach ($prizes as $prize) {
1325
            $prize->setGame(null);
1326
            $this->prizes->removeElement($prize);
1327
        }
1328
    }
1329
1330
    /**
1331
     * Add a prize to the game.
1332
     *
1333
     * @param Prize $prize
1334
     *
1335
     * @return void
1336
     */
1337
    public function addPrize($prize)
1338
    {
1339
        $this->prizes[] = $prize;
1340
    }
1341
1342
    /**
1343
     *
1344
     * @return string $classType
1345
     */
1346
    public function getClassType()
1347
    {
1348
        return $this->classType;
1349
    }
1350
1351
    /**
1352
     *
1353
     * @param string classType
1354
     * @param string $classType
1355
     */
1356
    public function setClassType($classType)
1357
    {
1358
        $this->classType = $classType;
1359
1360
        return $this;
1361
    }
1362
1363
    /**
1364
     *
1365
     * @return integer unknown_type
1366
     */
1367
    public function getActive()
1368
    {
1369
        return $this->active;
1370
    }
1371
1372
    /**
1373
     *
1374
     * @param unknown_type $active
1375
     */
1376
    public function setActive($active)
1377
    {
1378
        $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...
1379
1380
        return $this;
1381
    }
1382
1383
    /**
1384
     *
1385
     * @return the $costToPlay
1386
     */
1387
    public function getCostToPlay()
1388
    {
1389
        return $this->costToPlay;
1390
    }
1391
1392
    /**
1393
     *
1394
     * @param field_type $costToPlay
1395
     */
1396
    public function setCostToPlay($costToPlay)
1397
    {
1398
        $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...
1399
1400
        return $this;
1401
    }
1402
1403
    /**
1404
     *
1405
     * @return boolean $onInvitation
1406
     */
1407
    public function getOnInvitation()
1408
    {
1409
        return $this->onInvitation;
1410
    }
1411
1412
    /**
1413
     *
1414
     * @param boolean $onInvitation
1415
     */
1416
    public function setOnInvitation($onInvitation)
1417
    {
1418
        $this->onInvitation = $onInvitation;
1419
1420
        return $this;
1421
    }
1422
1423
    /**
1424
     * @return ArrayCollection unknown_type
1425
     */
1426
    public function getInvitations()
1427
    {
1428
        return $this->invitations;
1429
    }
1430
1431
    /**
1432
     * @param ArrayCollection $invitations
1433
     */
1434
    public function setInvitations(ArrayCollection $invitations)
1435
    {
1436
        $this->invitations = $invitations;
1437
1438
        return $this;
1439
    }
1440
1441
    public function addInvitations(ArrayCollection $invitations)
1442
    {
1443
        foreach ($invitations as $invitation) {
1444
            $invitation->setGame($this);
1445
            $this->invitations->add($invitation);
1446
        }
1447
    }
1448
1449
    public function removeInvitations(ArrayCollection $invitations)
1450
    {
1451
        foreach ($invitations as $invitation) {
1452
            $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...
1453
            $this->invitations->removeElement($invitation);
1454
        }
1455
    }
1456
1457
    /**
1458
     * Add an invitation to the game.
1459
     *
1460
     * @param Invitation $invitation
1461
     *
1462
     * @return void
1463
     */
1464
    public function addInvitation($invitation)
1465
    {
1466
        $this->invitations[] = $invitation;
1467
    }
1468
1469
1470
    /**
1471
     *
1472
     * @return string the Facebook app_id
1473
     */
1474
    public function getFbPageId()
1475
    {
1476
        return $this->fbPageId;
1477
    }
1478
1479
    /**
1480
     *
1481
     * @param string $fbPageId
1482
     */
1483
    public function setFbPageId($fbPageId)
1484
    {
1485
        $this->fbPageId = $fbPageId;
1486
1487
        return $this;
1488
    }
1489
1490
    /**
1491
     *
1492
     * @return string the Facebook app_id
1493
     */
1494
    public function getFbAppId()
1495
    {
1496
        return $this->fbAppId;
1497
    }
1498
1499
    /**
1500
     *
1501
     * @param string $fbAppId
1502
     */
1503
    public function setFbAppId($fbAppId)
1504
    {
1505
        $this->fbAppId = $fbAppId;
1506
1507
        return $this;
1508
    }
1509
1510
    /**
1511
     *
1512
     * @return string the Facebook app_id
1513
     */
1514
    public function getFbPostId()
1515
    {
1516
        return $this->fbPostId;
1517
    }
1518
1519
    /**
1520
     *
1521
     * @param string $fbPostId
1522
     */
1523
    public function setFbPostId($fbPostId)
1524
    {
1525
        $this->fbPostId = $fbPostId;
1526
1527
        return $this;
1528
    }
1529
1530
    /**
1531
     *
1532
     * @return string the Facebook fbPageTabTitle
1533
     */
1534
    public function getFbPageTabTitle()
1535
    {
1536
        return $this->fbPageTabTitle;
1537
    }
1538
1539
    /**
1540
     *
1541
     * @param string $fbPageTabTitle
1542
     */
1543
    public function setFbPageTabTitle($fbPageTabTitle)
1544
    {
1545
        $this->fbPageTabTitle = $fbPageTabTitle;
1546
1547
        return $this;
1548
    }
1549
1550
    /**
1551
     *
1552
     * @return string the Facebook fbPageTabImage
1553
     */
1554
    public function getFbPageTabImage()
1555
    {
1556
        return $this->fbPageTabImage;
1557
    }
1558
1559
    /**
1560
     *
1561
     * @param string $fbPageTabImage
1562
     */
1563
    public function setFbPageTabImage($fbPageTabImage)
1564
    {
1565
        $this->fbPageTabImage = $fbPageTabImage;
1566
1567
        return $this;
1568
    }
1569
1570
    /**
1571
     *
1572
     * @return string the Facebook fbPageTabPosition
1573
     */
1574
    public function getFbPageTabPosition()
1575
    {
1576
        return $this->fbPageTabPosition;
1577
    }
1578
1579
    /**
1580
     *
1581
     * @param string $fbPageTabPosition
1582
     */
1583
    public function setFbPageTabPosition($fbPageTabPosition)
1584
    {
1585
        $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...
1586
1587
        return $this;
1588
    }
1589
1590
    /**
1591
     *
1592
     * @return the string
1593
     */
1594
    public function getEmailShareSubject()
1595
    {
1596
        return $this->emailShareSubject;
1597
    }
1598
1599
    /**
1600
     *
1601
     * @param string $emailShareSubject
1602
     */
1603
    public function setEmailShareSubject($emailShareSubject)
1604
    {
1605
        $this->emailShareSubject = $emailShareSubject;
1606
1607
        return $this;
1608
    }
1609
1610
    /**
1611
     *
1612
     * @return the unknown_type
1613
     */
1614
    public function getEmailShareMessage()
1615
    {
1616
        return $this->emailShareMessage;
1617
    }
1618
1619
    /**
1620
     *
1621
     * @param unknown_type $emailShareMessage
1622
     */
1623
    public function setEmailShareMessage($emailShareMessage)
1624
    {
1625
        $this->emailShareMessage = $emailShareMessage;
1626
1627
        return $this;
1628
    }
1629
1630
    /**
1631
     *
1632
     * @return the string
1633
     */
1634
    public function getFbShareDescription()
1635
    {
1636
        return $this->fbShareDescription;
1637
    }
1638
1639
    /**
1640
     *
1641
     * @param string $fbShareDescription
1642
     */
1643
    public function setFbShareDescription($fbShareDescription)
1644
    {
1645
        $this->fbShareDescription = $fbShareDescription;
1646
1647
        return $this;
1648
    }
1649
1650
    /**
1651
     *
1652
     * @return the unknown_type
1653
     */
1654
    public function getFbShareImage()
1655
    {
1656
        return $this->fbShareImage;
1657
    }
1658
1659
    /**
1660
     *
1661
     * @param unknown_type $fbShareImage
1662
     */
1663
    public function setFbShareImage($fbShareImage)
1664
    {
1665
        $this->fbShareImage = $fbShareImage;
1666
1667
        return $this;
1668
    }
1669
1670
    /**
1671
     *
1672
     * @return string unknown_type
1673
     */
1674
    public function getFbRequestMessage()
1675
    {
1676
        return $this->fbRequestMessage;
1677
    }
1678
1679
    /**
1680
     *
1681
     * @param unknown_type $fbRequestMessage
1682
     */
1683
    public function setFbRequestMessage($fbRequestMessage)
1684
    {
1685
        $this->fbRequestMessage = $fbRequestMessage;
1686
1687
        return $this;
1688
    }
1689
1690
    /**
1691
     *
1692
     * @return the unknown_type
1693
     */
1694
    public function getTwShareMessage()
1695
    {
1696
        return $this->twShareMessage;
1697
    }
1698
1699
    /**
1700
     *
1701
     * @param unknown_type $twShareMessage
1702
     */
1703
    public function setTwShareMessage($twShareMessage)
1704
    {
1705
        $this->twShareMessage = $twShareMessage;
1706
1707
        return $this;
1708
    }
1709
1710
    /**
1711
     *
1712
     * @return DateTime $createdAt
1713
     */
1714
    public function getCreatedAt()
1715
    {
1716
        return $this->createdAt;
1717
    }
1718
1719
    /**
1720
     *
1721
     * @param \DateTime $createdAt
1722
     */
1723
    public function setCreatedAt($createdAt)
1724
    {
1725
        $this->createdAt = $createdAt;
1726
1727
        return $this;
1728
    }
1729
1730
    /**
1731
     *
1732
     * @return DateTime $updatedAt
1733
     */
1734
    public function getUpdatedAt()
1735
    {
1736
        return $this->updatedAt;
1737
    }
1738
1739
    /**
1740
     *
1741
     * @param \DateTime $updatedAt
1742
     */
1743
    public function setUpdatedAt($updatedAt)
1744
    {
1745
        $this->updatedAt = $updatedAt;
1746
1747
        return $this;
1748
    }
1749
1750
    /**
1751
     * Convert the object to an array.
1752
     *
1753
     * @return array
1754
     */
1755
    public function getArrayCopy()
1756
    {
1757
        $obj_vars = get_object_vars($this);
1758
1759 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...
1760
            $obj_vars['publicationDate'] = $obj_vars['publicationDate']->format('d/m/Y H:i:s');
1761
        }
1762 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...
1763
            $obj_vars['endDate'] = $obj_vars['endDate']->format('d/m/Y H:i:s');
1764
        }
1765 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...
1766
            $obj_vars['startDate'] = $obj_vars['startDate']->format('d/m/Y H:i:s');
1767
        }
1768
1769
        return $obj_vars;
1770
    }
1771
1772
    /**
1773
     * Convert the object to json.
1774
     *
1775
     * @return array
1776
     */
1777
    public function jsonSerialize()
1778
    {
1779
        return $this->getArrayCopy();
1780
    }
1781
1782
    /**
1783
     * Populate from an array.
1784
     *
1785
     * @param array $data
1786
     */
1787
    public function populate($data = array())
1788
    {
1789
        if (isset($data['partner']) && $data['partner'] !== null) {
1790
            $this->partner = $data['partner'];
1791
        }
1792
1793
        $this->title = (isset($data['title'])) ? $data['title'] : null;
1794
        $this->type = (isset($data['type']) && $data['type'] !== null) ? $data['type'] : null;
0 ignored issues
show
Bug introduced by
The property type does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1795
1796
        if (isset($data['mainImage']) && $data['mainImage'] !== null) {
1797
            $this->mainImage = $data['mainImage'];
1798
        }
1799
1800
        if (isset($data['secondImage']) && $data['secondImage'] !== null) {
1801
            $this->secondImage = $data['secondImage'];
1802
        }
1803
1804 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...
1805
            $this->active = $data['active'];
1806
        }
1807
1808
        $this->layout           = (isset($data['layout'])) ? $data['layout'] : null;
1809
        $this->stylesheet       = (isset($data['stylesheet'])) ? $data['stylesheet'] : null;
1810
1811
        $this->pushHome         = (isset($data['pushHome']) && $data['pushHome'] !== null) ? $data['pushHome'] : 0;
1812
        $this->displayHome      = (isset($data['displayHome']) && $data['displayHome'] !== null) ?
1813
            $data['displayHome'] :
1814
            0;
1815
        $this->prizeCategory   = (isset($data['prizeCategory'])) ? $data['prizeCategory'] : null;
1816
1817
        $this->publicationDate  = (isset($data['publicationDate']) && $data['publicationDate'] !== null) ?
1818
            DateTime::createFromFormat('d/m/Y', $data['publicationDate']) :
1819
            null;
1820
        $this->endDate         = (isset($data['endDate']) && $data['endDate'] !== null) ?
1821
            DateTime::createFromFormat('d/m/Y', $data['endDate']) :
1822
            null;
1823
        $this->startDate       = (isset($data['startDate']) && $data['startDate'] !== null) ?
1824
            DateTime::createFromFormat('d/m/Y', $data['startDate']) :
1825
            null;
1826
1827
        $this->identifier       = (isset($data['identifier'])) ? $data['identifier'] : null;
1828
        $this->welcomeBlock    = (isset($data['welcomeBlock'])) ? $data['welcomeBlock'] : null;
1829
        $this->termsBlock       = (isset($data['termsBlock'])) ? $data['termsBlock'] : null;
1830
        $this->conditionsBlock  = (isset($data['conditionsBlock'])) ? $data['conditionsBlock'] : null;
1831
1832
        $this->fbShareDescription   = (isset($data['fbShareDescription'])) ? $data['fbShareDescription'] : null;
1833
        $this->fbShareImage     = (isset($data['fbShareImage'])) ? $data['fbShareImage'] : null;
1834
        $this->fbRequestMessage = (isset($data['fbRequestMessage'])) ? $data['fbRequestMessage'] : null;
1835
        $this->twShareMessage   = (isset($data['twShareMessage'])) ? $data['twShareMessage'] : null;
1836
        $this->emailSubjectMessage   = (isset($data['emailSubjectMessage'])) ? $data['emailSubjectMessage'] : null;
0 ignored issues
show
Bug introduced by
The property emailSubjectMessage does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
1837
        $this->emailShareMessage   = (isset($data['emailShareMessage'])) ? $data['emailShareMessage'] : null;
1838
    }
1839
1840
    public function setInputFilter(InputFilterInterface $inputFilter)
1841
    {
1842
        throw new \Exception("Not used");
1843
    }
1844
1845
    public function getInputFilter()
1846
    {
1847
        if (! $this->inputFilter) {
1848
            $inputFilter = new InputFilter();
1849
            $factory = new InputFactory();
1850
1851
            $inputFilter->add($factory->createInput(array(
1852
                'name' => 'id',
1853
                'required' => true,
1854
                'filters' => array(
1855
                    array(
1856
                        'name' => 'Int'
1857
                    )
1858
                )
1859
            )));
1860
1861
            $inputFilter->add($factory->createInput(array(
1862
                'name' => 'partner',
1863
                'required' => false
1864
            )));
1865
1866
            $inputFilter->add($factory->createInput(array(
1867
                'name' => 'fbAppId',
1868
                'required' => false
1869
            )));
1870
1871
            $inputFilter->add($factory->createInput(array(
1872
                'name' => 'fbPageId',
1873
                'required' => false
1874
            )));
1875
1876
            $inputFilter->add($factory->createInput(array(
1877
                'name' => 'fbPostId',
1878
                'required' => false
1879
            )));
1880
1881
            $inputFilter->add($factory->createInput(array(
1882
                'name' => 'prizes',
1883
                'required' => false
1884
            )));
1885
1886
            $inputFilter->add($factory->createInput(array(
1887
                'name' => 'invitations',
1888
                'required' => false
1889
            )));
1890
1891
            $inputFilter->add($factory->createInput(array(
1892
                'name' => 'title',
1893
                'required' => true,
1894
                'filters' => array(
1895
                    array(
1896
                        'name' => 'StripTags'
1897
                    ),
1898
                    array(
1899
                        'name' => 'StringTrim'
1900
                    )
1901
                ),
1902
                'validators' => array(
1903
                    array(
1904
                        'name' => 'StringLength',
1905
                        'options' => array(
1906
                            'encoding' => 'UTF-8',
1907
                            'min' => 5,
1908
                            'max' => 255
1909
                        )
1910
                    )
1911
                )
1912
            )));
1913
1914
            $inputFilter->add($factory->createInput(array(
1915
                'name' => 'publicationDate',
1916
                'required' => false,
1917
            )));
1918
1919
            $inputFilter->add($factory->createInput(array(
1920
                'name' => 'startDate',
1921
                'required' => false,
1922
            )));
1923
1924
            $inputFilter->add($factory->createInput(array(
1925
                'name' => 'endDate',
1926
                'required' => false,
1927
            )));
1928
1929
            $inputFilter->add($factory->createInput(array(
1930
                'name' => 'closeDate',
1931
                'required' => false,
1932
            )));
1933
1934
            $inputFilter->add($factory->createInput(array(
1935
                'name' => 'termsOptin',
1936
                'required' => false,
1937
            )));
1938
1939
            $inputFilter->add($factory->createInput(array(
1940
                'name' => 'identifier',
1941
                'required' => true,
1942
                'filters' => array(
1943
                    array(
1944
                        'name' => 'StripTags'
1945
                    ),
1946
                    array(
1947
                        'name' => 'StringTrim'
1948
                    ),
1949
                    array(
1950
                        'name' => 'PlaygroundCore\Filter\Slugify'
1951
                    )
1952
                ),
1953
                'validators' => array(
1954
                    array(
1955
                        'name' => 'StringLength',
1956
                        'options' => array(
1957
                            'encoding' => 'UTF-8',
1958
                            'min' => 3,
1959
                            'max' => 255
1960
                        )
1961
                    )
1962
                )
1963
            )));
1964
1965
            $inputFilter->add($factory->createInput(array(
1966
                'name'     => 'playLimit',
1967
                'required' => false,
1968
                'validators' => array(
1969
                    array(
1970
                        'name'    => 'Between',
1971
                        'options' => array(
1972
                            'min'      => 0,
1973
                            'max'      => 999999,
1974
                        ),
1975
                    ),
1976
                ),
1977
            )));
1978
1979
            $inputFilter->add($factory->createInput(array(
1980
                'name' => 'playLimitScale',
1981
                'required' => false,
1982
                'validators' => array(
1983
                    array(
1984
                        'name' => 'InArray',
1985
                        'options' => array(
1986
                            'haystack' => array('day', 'week', 'month', 'year', 'always'),
1987
                        ),
1988
                    ),
1989
                ),
1990
            )));
1991
1992
            $inputFilter->add($factory->createInput(array(
1993
                'name' => 'playBonus',
1994
                'required' => false,
1995
                'validators' => array(
1996
                    array(
1997
                        'name' => 'InArray',
1998
                        'options' => array(
1999
                            'haystack' => array('none', 'per_entry', 'one'),
2000
                        ),
2001
                    ),
2002
                ),
2003
            )));
2004
2005
            $inputFilter->add($factory->createInput(array(
2006
                'name' => 'active',
2007
                'required' => true
2008
            )));
2009
2010
            $inputFilter->add($factory->createInput(array(
2011
                'name' => 'onInvitation',
2012
                'required' => false
2013
            )));
2014
2015
            $inputFilter->add(
2016
                $factory->createInput(
2017
                    [
2018
                        'name' => 'costToPlay',
2019
                        'required' => false
2020
                    ]
2021
                )
2022
            );
2023
2024
            $inputFilter->add($factory->createInput(array(
2025
                'name' => 'displayHome',
2026
                'required' => false
2027
            )));
2028
2029
            $inputFilter->add($factory->createInput(array(
2030
                'name' => 'pushHome',
2031
                'required' => false
2032
            )));
2033
2034
            $inputFilter->add($factory->createInput(array(
2035
                'name' => 'anonymousAllowed',
2036
                'required' => false
2037
            )));
2038
2039
            $inputFilter->add($factory->createInput(array(
2040
                'name' => 'mailWinner',
2041
                'required' => false
2042
            )));
2043
2044
            $inputFilter->add($factory->createInput(array(
2045
                'name' => 'mailLooser',
2046
                'required' => false
2047
            )));
2048
2049
            $inputFilter->add($factory->createInput(array(
2050
                'name' => 'mailEntry',
2051
                'required' => false
2052
            )));
2053
2054
            $inputFilter->add($factory->createInput(array(
2055
                'name' => 'emailShare',
2056
                'required' => false
2057
            )));
2058
2059
            $inputFilter->add($factory->createInput(array(
2060
                'name' => 'fbShare',
2061
                'required' => false
2062
            )));
2063
2064
            $inputFilter->add($factory->createInput(array(
2065
                'name' => 'twShare',
2066
                'required' => false
2067
            )));
2068
2069
            $inputFilter->add($factory->createInput(array(
2070
                'name' => 'prizeCategory',
2071
                'required' => false,
2072
                'filters' => array(
2073
                    array(
2074
                        'name' => 'Int'
2075
                    )
2076
                )
2077
            )));
2078
2079
            $inputFilter->add($factory->createInput(array(
2080
                'name' => 'fbPageTabTitle',
2081
                'required' => false
2082
            )));
2083
2084
            $inputFilter->add($factory->createInput(array(
2085
                'name' => 'fbPageTabImage',
2086
                'required' => false
2087
            )));
2088
            $inputFilter->add($factory->createInput(array(
2089
                'name' => 'fbPageTabPosition',
2090
                'required' => false
2091
            )));
2092
2093
            $inputFilter->add($factory->createInput(array(
2094
                'name' => 'layout',
2095
                'required' => false,
2096
                'filters' => array(
2097
                    array(
2098
                        'name' => 'StripTags'
2099
                    ),
2100
                    array(
2101
                        'name' => 'StringTrim'
2102
                    )
2103
                ),
2104
                'validators' => array(
2105
                    array(
2106
                        'name' => 'StringLength',
2107
                        'options' => array(
2108
                            'encoding' => 'UTF-8',
2109
                            'min' => 0,
2110
                            'max' => 255
2111
                        )
2112
                    )
2113
                )
2114
            )));
2115
2116
            $inputFilter->add($factory->createInput(array(
2117
                'name' => 'stylesheet',
2118
                'required' => false,
2119
                'filters' => array(
2120
                    array(
2121
                        'name' => 'StripTags'
2122
                    ),
2123
                    array(
2124
                        'name' => 'StringTrim'
2125
                    )
2126
                ),
2127
                'validators' => array(
2128
                    array(
2129
                        'name' => 'StringLength',
2130
                        'options' => array(
2131
                            'encoding' => 'UTF-8',
2132
                            'min' => 0,
2133
                            'max' => 255
2134
                        )
2135
                    )
2136
                )
2137
            )));
2138
2139
            $inputFilter->add($factory->createInput(array(
2140
                'name' => 'fbShareImage',
2141
                'required' => false,
2142
                'filters' => array(
2143
                    array(
2144
                        'name' => 'StripTags'
2145
                    ),
2146
                    array(
2147
                        'name' => 'StringTrim'
2148
                    )
2149
                ),
2150
                'validators' => array(
2151
                    array(
2152
                        'name' => 'StringLength',
2153
                        'options' => array(
2154
                            'encoding' => 'UTF-8',
2155
                            'min' => 1,
2156
                            'max' => 255
2157
                        )
2158
                    )
2159
                )
2160
            )));
2161
2162
            $inputFilter->add($factory->createInput(array(
2163
                'name' => 'emailSubjectMessage',
2164
                'required' => false,
2165
                'filters' => array(
2166
                    array(
2167
                            'name' => 'StripTags'
2168
                    ),
2169
                    array(
2170
                            'name' => 'StringTrim'
2171
                    )
2172
                ),
2173
                'validators' => array(
2174
                    array(
2175
                        'name' => 'StringLength',
2176
                        'options' => array(
2177
                            'encoding' => 'UTF-8',
2178
                            'min' => 1,
2179
                            'max' => 500
2180
                        )
2181
                    )
2182
                )
2183
            )));
2184
2185
            $inputFilter->add($factory->createInput(array(
2186
                'name' => 'emailShareMessage',
2187
                'required' => false,
2188
                'filters' => array(
2189
                    array(
2190
                            'name' => 'StripTags'
2191
                    ),
2192
                    array(
2193
                            'name' => 'StringTrim'
2194
                    )
2195
                ),
2196
                'validators' => array(
2197
                    array(
2198
                        'name' => 'StringLength',
2199
                        'options' => array(
2200
                            'encoding' => 'UTF-8',
2201
                            'min' => 1,
2202
                            'max' => 500
2203
                        )
2204
                    )
2205
                )
2206
            )));
2207
2208
            $inputFilter->add($factory->createInput(array(
2209
                'name' => 'fbShareDescription',
2210
                'required' => false,
2211
                'filters' => array(
2212
                        array(
2213
                                'name' => 'StripTags'
2214
                        ),
2215
                        array(
2216
                                'name' => 'StringTrim'
2217
                        )
2218
                ),
2219
                'validators' => array(
2220
                    array(
2221
                        'name' => 'StringLength',
2222
                        'options' => array(
2223
                            'encoding' => 'UTF-8',
2224
                            'min' => 1,
2225
                            'max' => 500
2226
                            )
2227
                    )
2228
                )
2229
            )));
2230
2231
            $inputFilter->add($factory->createInput(array(
2232
                'name' => 'fbRequestMessage',
2233
                'required' => false,
2234
                'filters' => array(
2235
                    array(
2236
                        'name' => 'StripTags'
2237
                    ),
2238
                    array(
2239
                        'name' => 'StringTrim'
2240
                    )
2241
                ),
2242
                'validators' => array(
2243
                    array(
2244
                        'name' => 'StringLength',
2245
                        'options' => array(
2246
                            'encoding' => 'UTF-8',
2247
                            'min' => 1,
2248
                            'max' => 500
2249
                        )
2250
                    )
2251
                )
2252
            )));
2253
2254
            $inputFilter->add($factory->createInput(array(
2255
                'name' => 'twShareMessage',
2256
                'required' => false,
2257
                'filters' => array(
2258
                    array(
2259
                        'name' => 'StripTags'
2260
                    ),
2261
                    array(
2262
                        'name' => 'StringTrim'
2263
                    )
2264
                ),
2265
                'validators' => array(
2266
                    array(
2267
                        'name' => 'StringLength',
2268
                        'options' => array(
2269
                            'encoding' => 'UTF-8',
2270
                            'min' => 1,
2271
                            'max' => 255
2272
                        )
2273
                    )
2274
                )
2275
            )));
2276
            
2277
            $inputFilter->add($factory->createInput(array(
2278
                'name' => 'anonymousIdentifier',
2279
                'required' => false,
2280
                'filters' => array(
2281
                    array(
2282
                        'name' => 'StripTags'
2283
                    ),
2284
                    array(
2285
                        'name' => 'StringTrim'
2286
                    )
2287
                ),
2288
                'validators' => array(
2289
                    array(
2290
                        'name' => 'StringLength',
2291
                        'options' => array(
2292
                            'encoding' => 'UTF-8',
2293
                            'min' => 0,
2294
                            'max' => 255
2295
                        )
2296
                    )
2297
                )
2298
            )));
2299
2300
            $this->inputFilter = $inputFilter;
2301
        }
2302
2303
        return $this->inputFilter;
2304
    }
2305
2306
    public function setTranslatableLocale($locale)
2307
    {
2308
        $this->locale = $locale;
2309
    }
2310
}
2311