1 | <?php |
||
52 | class IsArray implements Check |
||
53 | { |
||
54 | /** |
||
55 | * do we have something that is an array? |
||
56 | * |
||
57 | * by array, we mean something that you can pass to any of PHP's |
||
58 | * array_xxx() functions |
||
59 | * |
||
60 | * @param mixed $fieldOrVar |
||
61 | * the item to be checked |
||
62 | * @return bool |
||
63 | * TRUE if the item is an array |
||
64 | * FALSE otherwise |
||
65 | */ |
||
66 | public static function check($fieldOrVar) |
||
67 | { |
||
68 | // general cases |
||
69 | if (is_array($fieldOrVar)) { |
||
70 | return true; |
||
71 | } |
||
72 | |||
73 | // if we get here, we have run out of ideas |
||
74 | return false; |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * do we have something that is an array? |
||
79 | * |
||
80 | * by array, we mean something that you can pass to any of PHP's |
||
81 | * array_xxx() functions |
||
82 | * |
||
83 | * @param mixed $fieldOrVar |
||
84 | * the item to be checked |
||
85 | * @return bool |
||
86 | * TRUE if the item is an array |
||
87 | * FALSE otherwise |
||
88 | */ |
||
89 | public function inspect($fieldOrVar) |
||
90 | { |
||
91 | return static::check($fieldOrVar); |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * creates a new IsArray check, ready for use |
||
96 | * |
||
97 | * we do not support any customisations |
||
98 | * |
||
99 | * @return IsArray |
||
100 | */ |
||
101 | public static function using() |
||
105 | } |
||
106 |