49 return JArray::moveElementTo($this->
values, $from, $to);
94 $value = JReflection::callMethod($this->
instance, $this->
values[
"identifier"], []);
114 $property->setAccessible(
true);
143 return $this->_postGetValue($index, $propertyName, $value);
147 if (isset($this->values[$index])) {
148 $value = $this->values[$index]($value, $this->instance, $index, self::$index);
150 $value = $this->_getDefaultValue($propertyName, $value, $index);
152 if (isset($this->afterCompile[$index])) {
153 if (\is_callable($this->afterCompile[$index])) {
154 $this->afterCompile[$index]($value, $this->instance, self::$index);
162 array_splice($this->visibleProperties, $index, 0, [
166 array_splice($this->visibleProperties, $index, 0, $field);
172 if (isset($this->visibleProperties[$index])) {
173 if (is_array($this->visibleProperties[$index])) {
174 $this->visibleProperties[$index] = JArray::sortAssociative($this->visibleProperties[$index], $array);
181 $vb = $this->visibleProperties;
182 if (isset($vb[$index])) {
184 if (\is_array($vb[$index])) {
185 $this->visibleProperties[$index][$key] = $field;
187 $this->visibleProperties[$index] = [
193 if (\is_array($vb[$index])) {
194 $this->visibleProperties[$index][] = $field;
196 $this->visibleProperties[$index] = [
203 return $this->insertField($index, $field);
210 $this->visibleProperties[] = [
214 $this->visibleProperties[] = $field;
220 $this->visibleProperties = \array_merge($this->visibleProperties, $fields);
225 return \sizeof($this->properties);
229 return \sizeof($this->visibleProperties);
233 return $this->properties[$index];
237 $property = $this->getProperty($index);
238 if ($property instanceof \ReflectionProperty) {
239 $result = $property->getName();
240 } elseif (\is_callable($property)) {
241 $result = $this->visibleProperties[$index];
249 return JString::startswith($rProperty->getName(),
"_") ===
false;
253 if (\is_string($instance) && \class_exists($instance)) {
254 $instance =
new $instance();
256 $this->instance = $instance;
257 $this->properties = [];
259 $this->reflect = new \ReflectionClass($instance);
260 if (JArray::count($this->visibleProperties) === 0) {
261 $this->properties = $this->getDefaultProperties();
263 foreach ($this->visibleProperties as $property) {
264 $this->setInstanceProperty($property);
267 }
catch (\Throwable $th){
274 if (\is_callable($property)) {
275 $this->properties[] = $property;
276 } elseif (\is_string($property)) {
278 $this->_beforeAddProperty(\
sizeof($this->properties), $property);
279 $rProperty = $this->reflect->getProperty($property);
280 $this->properties[] = $rProperty;
281 }
catch (\Exception $e) {
282 $this->_beforeAddProperty(\
sizeof($this->properties), $property);
283 $this->properties[] = $property;
285 } elseif (\is_int($property)) {
286 $props = $this->getDefaultProperties();
287 if (isset($props[$property]))
288 $this->properties[] = $props[$property];
290 $this->properties[] = $property;
292 $this->properties[] = $property;
298 $properties = $this->reflect->getProperties();
299 foreach ($properties as $property) {
300 $showable = $this->showableProperty($property);
301 if ($showable !==
false) {
302 $result[] = $property;
309 $this->visibleProperties = $visibleProperties;
314 $this->values[$index] = $callback;
319 $this->values[
"identifier"] = $callback;
324 self::$index = $index;
328 return $this->properties;
332 if (isset($this->captions[$index])) {
333 return $this->captions[$index];
335 if ($this->properties[$index] instanceof \ReflectionProperty)
336 return $this->properties[$index]->getName();
337 elseif (\is_callable($this->properties[$index]))
340 return $this->properties[$index];
344 $hasGroupby = is_array($this->groupByFields);
345 $count = $this->count();
347 if (isset($this->captions)) {
348 $captions = \array_values($this->captions);
349 $gbSize = $hasGroupby ?
sizeof($this->groupByFields) : 0;
350 $captionsSize = \sizeof($captions);
351 for ($i = $captionsSize; $i < $count - $gbSize; $i ++) {
358 while ($index < $count) {
359 $captions[] = $this->getCaption($index ++);
362 if ($hasGroupby &&
sizeof($captions) >= $count && ! $moreAdded) {
363 $captions = JArray::removeByKeys($captions, $this->groupByFields);
365 if (isset($this->captionCallback) && \is_callable($this->captionCallback)) {
366 $callback = $this->captionCallback;
367 $callback($captions, $this->instance);
373 if (isset($this->captions) ===
false)
374 $this->captions = [];
375 $this->captions[$index] = $caption;
380 $this->captions = $captions;
395 $this->afterCompile[$index] = $callback;
407 $this->captionCallback = $captionCallback;
419 $this->defaultValueFunction = $defaultValueFunction;
424 return $this->visibleProperties;
428 return array_filter($this->visibleProperties,
function ($item) {
429 return ! (is_array($item) || is_object($item));
438 return $this->defaultValueFunction;
446 return $this->groupByFields;
454 $this->groupByFields = $groupByFields;
458 $this->groupByFields[]=$groupByField;
462 if (is_array($this->groupByFields)) {
463 return sizeof($this->groupByFields);