1 | <?php |
||
19 | class Slot implements SlotInterface |
||
20 | { |
||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $name; |
||
25 | |||
26 | /** |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $keys; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $reel; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $nested = array(); |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $aliases = array(); |
||
45 | |||
46 | /** |
||
47 | * @var integer |
||
48 | */ |
||
49 | protected $undefinedCardResolution = UndefinedCardResolution::NO_CARD_FOUND_EXCEPTION; |
||
50 | |||
51 | /** |
||
52 | * @param array |
||
53 | */ |
||
54 | public function __construct(array $data) |
||
65 | |||
66 | public function getUcr() |
||
70 | |||
71 | /** |
||
72 | * Get a value of a card by its index. |
||
73 | * If the card does not exist, resolve based on the slot's resolve_undefined setting. |
||
74 | * |
||
75 | * @param integer $index |
||
76 | * @return mixed |
||
77 | * @throws SlotMachine\Exception\NoCardFoundException if the key does not exist and |
||
78 | * the undefinedCardResolution property is set to NO_CARD_FOUND_EXCEPTION. |
||
79 | */ |
||
80 | public function getCard($index = 0, $failOnNoCardFound = false) |
||
110 | |||
111 | /** |
||
112 | * Get a card from the reel by an alias. |
||
113 | * |
||
114 | * @param string $alias |
||
115 | * @return mixed |
||
116 | */ |
||
117 | public function getCardByAlias($alias) |
||
125 | |||
126 | /** |
||
127 | * @return string |
||
128 | */ |
||
129 | public function getDefaultCard() |
||
137 | |||
138 | /** |
||
139 | * @return string |
||
140 | */ |
||
141 | public function getFallbackCard() |
||
149 | |||
150 | /** |
||
151 | * @return integer|null |
||
152 | */ |
||
153 | public function getDefaultIndex() |
||
157 | |||
158 | /** |
||
159 | * @return integer|null |
||
160 | */ |
||
161 | public function getFallbackIndex() |
||
165 | |||
166 | /** |
||
167 | * @return integer |
||
168 | */ |
||
169 | public function getResolvableIndex() |
||
179 | |||
180 | /** |
||
181 | * @return array |
||
182 | */ |
||
183 | public function getNested() |
||
187 | |||
188 | /** |
||
189 | * @return string |
||
190 | */ |
||
191 | public function getKey() |
||
195 | |||
196 | /** |
||
197 | * @return array |
||
198 | */ |
||
199 | public function getKeys() |
||
203 | |||
204 | /** |
||
205 | * @return string |
||
206 | */ |
||
207 | public function __toString() |
||
215 | } |
||
216 |
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.
Unreachable code is most often the result of
return
,die
orexit
statements that have been added for debug purposes.In the above example, the last
return false
will never be executed, because a return statement has already been met in every possible execution path.