1 | <?php |
||
28 | class ArrayExpression implements ExpressionInterface, \ArrayAccess, \Countable, \IteratorAggregate |
||
29 | { |
||
30 | /** |
||
31 | * @var null|string the type of the array elements. Defaults to `null` which means the type is |
||
32 | * not explicitly specified. |
||
33 | * |
||
34 | * Note that in case when type is not specified explicitly and DBMS can not guess it from the context, |
||
35 | * SQL error will be raised. |
||
36 | */ |
||
37 | private $type; |
||
38 | /** |
||
39 | * @var array|QueryInterface the array's content. |
||
40 | * In can be represented as an array of values or a [[Query]] that returns these values. |
||
41 | */ |
||
42 | private $value; |
||
43 | /** |
||
44 | * @var int the number of indices needed to select an element |
||
45 | */ |
||
46 | private $dimension; |
||
47 | |||
48 | |||
49 | /** |
||
50 | * ArrayExpression constructor. |
||
51 | * |
||
52 | * @param array|QueryInterface|mixed $value the array content. Either represented as an array of values or a Query that |
||
53 | * returns these values. A single value will be considered as an array containing one element. |
||
54 | * @param string|null $type the type of the array elements. Defaults to `null` which means the type is |
||
55 | * not explicitly specified. In case when type is not specified explicitly and DBMS can not guess it from the context, |
||
56 | * SQL error will be raised. |
||
57 | * @param int $dimension the number of indices needed to select an element |
||
58 | */ |
||
59 | 14 | public function __construct($value, $type = null, $dimension = 1) |
|
65 | |||
66 | /** |
||
67 | * @return null|string |
||
68 | * @see type |
||
69 | */ |
||
70 | 25 | public function getType() |
|
74 | |||
75 | /** |
||
76 | * @return array|mixed|QueryInterface |
||
77 | * @see value |
||
78 | */ |
||
79 | 28 | public function getValue() |
|
83 | |||
84 | /** |
||
85 | * @return int the number of indices needed to select an element |
||
86 | * @see dimensions |
||
87 | */ |
||
88 | 25 | public function getDimension() |
|
92 | |||
93 | /** |
||
94 | * Whether a offset exists |
||
95 | * |
||
96 | * @link http://php.net/manual/en/arrayaccess.offsetexists.php |
||
97 | * @param mixed $offset <p> |
||
98 | * An offset to check for. |
||
99 | * </p> |
||
100 | * @return bool true on success or false on failure. |
||
101 | * </p> |
||
102 | * <p> |
||
103 | * The return value will be casted to boolean if non-boolean was returned. |
||
104 | * @since 2.0.14 |
||
105 | */ |
||
106 | public function offsetExists($offset) |
||
110 | |||
111 | /** |
||
112 | * Offset to retrieve |
||
113 | * |
||
114 | * @link http://php.net/manual/en/arrayaccess.offsetget.php |
||
115 | * @param mixed $offset <p> |
||
116 | * The offset to retrieve. |
||
117 | * </p> |
||
118 | * @return mixed Can return all value types. |
||
119 | * @since 2.0.14 |
||
120 | */ |
||
121 | 2 | public function offsetGet($offset) |
|
125 | |||
126 | /** |
||
127 | * Offset to set |
||
128 | * |
||
129 | * @link http://php.net/manual/en/arrayaccess.offsetset.php |
||
130 | * @param mixed $offset <p> |
||
131 | * The offset to assign the value to. |
||
132 | * </p> |
||
133 | * @param mixed $value <p> |
||
134 | * The value to set. |
||
135 | * </p> |
||
136 | * @return void |
||
137 | * @since 2.0.14 |
||
138 | */ |
||
139 | public function offsetSet($offset, $value) |
||
143 | |||
144 | /** |
||
145 | * Offset to unset |
||
146 | * |
||
147 | * @link http://php.net/manual/en/arrayaccess.offsetunset.php |
||
148 | * @param mixed $offset <p> |
||
149 | * The offset to unset. |
||
150 | * </p> |
||
151 | * @return void |
||
152 | * @since 2.0.14 |
||
153 | */ |
||
154 | public function offsetUnset($offset) |
||
158 | |||
159 | /** |
||
160 | * Count elements of an object |
||
161 | * |
||
162 | * @link http://php.net/manual/en/countable.count.php |
||
163 | * @return int The custom count as an integer. |
||
164 | * </p> |
||
165 | * <p> |
||
166 | * The return value is cast to an integer. |
||
167 | * @since 2.0.14 |
||
168 | */ |
||
169 | public function count() |
||
173 | |||
174 | /** |
||
175 | * Retrieve an external iterator |
||
176 | * |
||
177 | * @link http://php.net/manual/en/iteratoraggregate.getiterator.php |
||
178 | * @return Traversable An instance of an object implementing <b>Iterator</b> or |
||
179 | * <b>Traversable</b> |
||
180 | * @since 2.0.14.1 |
||
181 | * @throws InvalidConfigException when ArrayExpression contains QueryInterface object |
||
182 | */ |
||
183 | 2 | public function getIterator() |
|
191 | } |
||
192 |