1 | <?php |
||
12 | class StaticArrayy |
||
13 | { |
||
14 | /** |
||
15 | * A mapping of method names to the numbers of arguments it accepts. Each |
||
16 | * should be two more than the equivalent Arrayy method. Necessary as |
||
17 | * static methods place the optional $encoding as the last parameter. |
||
18 | * |
||
19 | * @var string[] |
||
20 | */ |
||
21 | protected static $methodArgs = null; |
||
22 | |||
23 | /** |
||
24 | * Creates an instance of Arrayy and invokes the given method |
||
25 | * |
||
26 | * @param string $name |
||
27 | * @param mixed[] $arguments |
||
28 | * |
||
29 | * @return Arrayy |
||
30 | */ |
||
31 | 5 | public static function __callStatic($name, $arguments) |
|
59 | |||
60 | //////////////////////////////////////////////////////////////////// |
||
61 | ///////////////////////////// GENERATE ///////////////////////////// |
||
62 | //////////////////////////////////////////////////////////////////// |
||
63 | |||
64 | /** |
||
65 | * Generate an array from a range. |
||
66 | * |
||
67 | * @param int $base The base number |
||
68 | * @param int|null $stop The stopping point |
||
69 | * @param int $step How many to increment of |
||
70 | * |
||
71 | * @return Arrayy |
||
72 | */ |
||
73 | 4 | public static function range($base, $stop = null, $step = 1) |
|
92 | |||
93 | /** |
||
94 | * Fill an array with $times times some $data. |
||
95 | * |
||
96 | * @param mixed $data |
||
97 | * @param int $times |
||
98 | * |
||
99 | * @return Arrayy |
||
100 | */ |
||
101 | 3 | public static function repeat($data, $times) |
|
110 | } |
||
111 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.