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 | 8 | public function __construct($value, $type = null, $dimension = 1) |
|
69 | |||
70 | /** |
||
71 | * @return null|string |
||
72 | * @see type |
||
73 | */ |
||
74 | 31 | public function getType() |
|
78 | |||
79 | /** |
||
80 | * @return array|mixed|QueryInterface |
||
81 | * @see value |
||
82 | */ |
||
83 | 31 | public function getValue() |
|
87 | |||
88 | /** |
||
89 | * @return int the number of indices needed to select an element |
||
90 | * @see dimensions |
||
91 | */ |
||
92 | 28 | public function getDimension() |
|
96 | |||
97 | /** |
||
98 | * Whether a offset exists |
||
99 | * |
||
100 | * @link http://php.net/manual/en/arrayaccess.offsetexists.php |
||
101 | * @param mixed $offset <p> |
||
102 | * An offset to check for. |
||
103 | * </p> |
||
104 | * @return bool true on success or false on failure. |
||
105 | * </p> |
||
106 | * <p> |
||
107 | * The return value will be casted to boolean if non-boolean was returned. |
||
108 | * @since 2.0.14 |
||
109 | */ |
||
110 | public function offsetExists($offset) |
||
114 | |||
115 | /** |
||
116 | * Offset to retrieve |
||
117 | * |
||
118 | * @link http://php.net/manual/en/arrayaccess.offsetget.php |
||
119 | * @param mixed $offset <p> |
||
120 | * The offset to retrieve. |
||
121 | * </p> |
||
122 | * @return mixed Can return all value types. |
||
123 | * @since 2.0.14 |
||
124 | */ |
||
125 | 4 | public function offsetGet($offset) |
|
129 | |||
130 | /** |
||
131 | * Offset to set |
||
132 | * |
||
133 | * @link http://php.net/manual/en/arrayaccess.offsetset.php |
||
134 | * @param mixed $offset <p> |
||
135 | * The offset to assign the value to. |
||
136 | * </p> |
||
137 | * @param mixed $value <p> |
||
138 | * The value to set. |
||
139 | * </p> |
||
140 | * @return void |
||
141 | * @since 2.0.14 |
||
142 | */ |
||
143 | public function offsetSet($offset, $value) |
||
147 | |||
148 | /** |
||
149 | * Offset to unset |
||
150 | * |
||
151 | * @link http://php.net/manual/en/arrayaccess.offsetunset.php |
||
152 | * @param mixed $offset <p> |
||
153 | * The offset to unset. |
||
154 | * </p> |
||
155 | * @return void |
||
156 | * @since 2.0.14 |
||
157 | */ |
||
158 | public function offsetUnset($offset) |
||
162 | |||
163 | /** |
||
164 | * Count elements of an object |
||
165 | * |
||
166 | * @link http://php.net/manual/en/countable.count.php |
||
167 | * @return int The custom count as an integer. |
||
168 | * </p> |
||
169 | * <p> |
||
170 | * The return value is cast to an integer. |
||
171 | * @since 2.0.14 |
||
172 | */ |
||
173 | public function count() |
||
177 | |||
178 | /** |
||
179 | * Retrieve an external iterator |
||
180 | * |
||
181 | * @link http://php.net/manual/en/iteratoraggregate.getiterator.php |
||
182 | * @return Traversable An instance of an object implementing <b>Iterator</b> or |
||
183 | * <b>Traversable</b> |
||
184 | * @since 2.0.14.1 |
||
185 | * @throws InvalidConfigException when ArrayExpression contains QueryInterface object |
||
186 | */ |
||
187 | 5 | public function getIterator() |
|
199 | } |
||
200 |