Completed
Push — develop ( 29e92f...f35b7e )
by greg
05:15
created

MissionGameCondition::getComparison()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace PlaygroundGame\Entity;
3
4
use Doctrine\ORM\Mapping as ORM;
5
use Doctrine\ORM\Mapping\HasLifecycleCallbacks;
6
use Doctrine\ORM\Mapping\PrePersist;
7
use Doctrine\ORM\Mapping\PreUpdate;
8
use Zend\InputFilter\InputFilter;
9
use Zend\InputFilter\InputFilterAwareInterface;
10
use Zend\InputFilter\InputFilterInterface;
11
12
/**
13
 * @ORM\Entity @HasLifecycleCallbacks
14
 * @ORM\Table(name="game_mission_game_condition")
15
 */
16
class MissionGameCondition implements InputFilterAwareInterface
17
{
18
19
    const NONE    = 0;
20
    const VICTORY = 1;
21
    const DEFEAT  = 2;
22
    const GREATER = 3;
23
    const LESS    = 4;
24
    /**
25
    * var $conditions
26
    * Tableau des types de conditions du jeu précendant pour passer au suivant.
27
    */
28
    public static $conditions = array(self::NONE     => 'none', // On passe directement au jeu suivant
29
                                      self::VICTORY  => 'victory', // Il faut une victoire pour passer au suivant
30
                                      self::DEFEAT   => 'defeat', // Il  faut une defaite pour passer au suivant
31
                                      self::GREATER  => 'greater than x points', // Il faut un nombre de points supérieur à x points pour passer au suivant 
32
                                      self::LESS     => 'less than x points'
33
                                ); // Il faut un nombre de points inférieur à x points pour passer au suivant
34
    protected $inputFilter;
35
    
36
    /**
37
     * @ORM\Id
38
     * @ORM\Column(type="integer");
39
     * @ORM\GeneratedValue(strategy="AUTO")
40
     */
41
    protected $id;
42
43
    /**
44
     * @ORM\ManyToOne(targetEntity="MissionGame", inversedBy="conditions")
45
     * 
46
     **/
47
    protected $missionGame;
48
    
49
     /**
50
     * @ORM\Column(name="attribute", type="string", nullable=true)
51
     */
52
    protected $attribute;
53
54
    /**
55
     * @ORM\Column(name="comparison", type="string", nullable=true)
56
     */
57
    protected $comparison;
58
59
    /**
60
     * @ORM\Column(name="value", type="string", nullable=true)
61
     */
62
    protected $value;
63
64
    /**
65
     * @ORM\Column(name="created_at", type="datetime", nullable=true)
66
     */
67
    protected $createdAt;
68
69
    /**
70
     * @ORM\Column(name="updated_at", type="datetime", nullable=true)
71
     */
72
    protected $updatedAt;
73
74
    /**
75
     * Constructor
76
     */
77
    public function __construct() {
78
    }
79
80
     /**
81
     * @return the $id
82
     */
83
    public function getId()
84
    {
85
        return $this->id;
86
    }
87
88
	/**
89
     * @param field_type $id
90
     */
91
    public function setId($id)
92
    {
93
        $this->id = $id;
94
        
95
        return $this;
96
    }
97
98
	/**
99
     * @param $id
100
     * @return MissionGameCondition
101
     */
102
    public function setMissionGame($missionGame)
103
    {
104
        $this->missionGame = $missionGame;
105
106
        return $this;
107
    }
108
109
    /**
110
     * @return mixed
111
     */
112
    public function getMissionGame()
113
    {
114
        return $this->missionGame;
115
    }
116
117
     /**
118
     * @param $id
119
     * @return MissionGameCondition
120
     */
121
    public function setAttribute($attribute)
122
    {
123
        $this->attribute = $attribute;
124
125
        return $this;
126
    }
127
128
    /**
129
     * @return mixed
130
     */
131
    public function getAttribute()
132
    {
133
        return $this->attribute;
134
    }
135
136
     /**
137
     * @param $id
138
     * @return MissionGameCondition
139
     */
140
    public function setComparison($comparison)
141
    {
142
        $this->comparison = $comparison;
143
144
        return $this;
145
    }
146
147
    /**
148
     * @return mixed
149
     */
150
    public function getComparison()
151
    {
152
        return $this->comparison;
153
    }
154
155
     /**
156
     * @param $id
157
     * @return MissionGameCondition
158
     */
159
    public function setValue($value)
160
    {
161
        $this->value = $value;
162
163
        return $this;
164
    }
165
166
    /**
167
     * @return mixed
168
     */
169
    public function getValue()
170
    {
171
        return $this->value;
172
    }
173
174
    /** @PrePersist */
175
    public function createChrono()
176
    {
177
        $this->createdAt = new \DateTime("now");
178
        $this->updatedAt = new \DateTime("now");
179
    }
180
181
    /** @PreUpdate */
182
    public function updateChrono()
183
    {
184
        $this->updatedAt = new \DateTime("now");
185
    }
186
187
    public function setInputFilter (InputFilterInterface $inputFilter)
188
    {
189
        throw new \Exception("Not used");
190
    }
191
   
192
    public function getInputFilter ()
193
    {
194
        if (! $this->inputFilter) {
195
            $inputFilter = new InputFilter();
196
            $this->inputFilter = $inputFilter;
197
        }
198
    
199
        return $this->inputFilter;
200
    }
201
}
202