1 | <?php |
||
28 | class SlotMachine extends \Pimple implements \Countable |
||
29 | { |
||
30 | const VERSION = '2.0.0'; |
||
31 | const MAJOR_VERSION = 2; |
||
32 | const MINOR_VERSION = 0; |
||
33 | const PATCH_VERSION = 0; |
||
34 | |||
35 | /** |
||
36 | * @var array |
||
37 | */ |
||
38 | protected $config; |
||
39 | |||
40 | /** |
||
41 | * @var array |
||
42 | */ |
||
43 | protected $reels; |
||
44 | |||
45 | /** |
||
46 | * @var Request |
||
47 | */ |
||
48 | protected $request; |
||
49 | |||
50 | /** |
||
51 | * @var array |
||
52 | */ |
||
53 | protected $delimiter = array('{', '}'); |
||
54 | |||
55 | /** |
||
56 | * @var integer |
||
57 | */ |
||
58 | protected $undefinedCardResolution = UndefinedCardResolution::DEFAULT_CARD; |
||
59 | |||
60 | const NOT_SET_PARAMETER = "not_set"; |
||
61 | |||
62 | /** |
||
63 | * @param array $config The SlotMachine configuration data |
||
64 | * @param Request|null $request The Request object |
||
65 | */ |
||
66 | public function __construct(array $config = array(), Request $request = null) |
||
75 | |||
76 | /** |
||
77 | * Set up the SlotMachine in a ready to use state |
||
78 | */ |
||
79 | private function initialize() |
||
109 | |||
110 | /** |
||
111 | * @param string $option The name of the constant |
||
112 | * |
||
113 | * @return integer |
||
114 | * |
||
115 | * @throws \InvalidArgumentException |
||
116 | */ |
||
117 | public static function translateUndefinedCardResolution($option) |
||
125 | |||
126 | /** |
||
127 | * Interpolates cards values into the cards nested slot placeholders. |
||
128 | * Based on the example given in the PSR-3 specification. |
||
129 | * |
||
130 | * @link https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md PSR-3 specification |
||
131 | * @param string $card |
||
132 | * @param array $nestedCards |
||
133 | * @param array $delimiter |
||
134 | * @throws \LengthException if less than two delimiter tokens are giving. |
||
135 | * @return string |
||
136 | */ |
||
137 | public static function interpolate($card, array $nestedCards = array(), array $delimiter = array('{', '}')) |
||
158 | |||
159 | /** |
||
160 | * @param string $slot |
||
161 | * @param integer $default |
||
162 | * @return string |
||
163 | */ |
||
164 | public function get($slot, $default = null) |
||
202 | |||
203 | /** |
||
204 | * @param string $slot |
||
205 | * @param integer $default |
||
206 | * @return integer |
||
207 | */ |
||
208 | protected function resolveIndex($slot, $default = 0) |
||
227 | |||
228 | /** |
||
229 | * @param Request $request |
||
230 | */ |
||
231 | public function setRequest(Request $request) |
||
235 | |||
236 | /** |
||
237 | * @return Request |
||
238 | */ |
||
239 | public function getRequest() |
||
243 | |||
244 | /** |
||
245 | * @return array |
||
246 | */ |
||
247 | public function getConfig() |
||
251 | |||
252 | /** |
||
253 | * The number of Slots in the machine |
||
254 | * |
||
255 | * @return integer |
||
256 | */ |
||
257 | public function count() |
||
269 | |||
270 | /** |
||
271 | * Return all the slots. |
||
272 | * |
||
273 | * @return array |
||
274 | */ |
||
275 | public function all() |
||
286 | |||
287 | /** |
||
288 | * Export current values for all slots in JSON format. |
||
289 | * |
||
290 | * @return string |
||
291 | */ |
||
292 | public function toJson() |
||
296 | |||
297 | /** |
||
298 | * Export to JSON by treating the object as a string. |
||
299 | * |
||
300 | * @return string |
||
301 | */ |
||
302 | public function __toString() |
||
306 | } |
||
307 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.