src/DataListToArrayTrait.php
public function toArray(): array
    {
        $this->internalDataListUpdate();

        // Copied from DataObjectToArrayTrait. Do not modify here !!!
        $toArray = function($object) use (&$toArray) {
            $result = [];
            $vars = get_object_vars($object);
            foreach ($vars as $name => $value) {
                if ($name !== 'internalDataObjectData') {
                    $reflectionProperty = new \ReflectionProperty($object, $name);
                    if ($reflectionProperty->isPublic()) {
                        $result[$name] = null;
                    }
                }
            }
            if (isset($object->internalDataObjectData)) {
                foreach ($object->internalDataObjectData as $name => $value) {
                    $result[substr($name, 1)] = null;
                }
            }
            ksort($result);
            foreach ($result as $name => $null) {
                $value = $object instanceof \ArrayAccess ? $object[$name] : (isset($object->$name) ? $object->$name : null);
                if (is_object($value)) {
                    if (method_exists($value, 'toArray')) {
                        $result[$name] = $value->toArray();
                    } else {
                        if ($value instanceof \DateTime) {
                            $result[$name] = $value->format('c');
                        } else {
                            $propertyVars = $toArray($value);
                            foreach ($propertyVars as $propertyVarName => $propertyVarValue) {
                                if (is_object($propertyVarValue)) {
                                    $propertyVars[$propertyVarName] = $toArray($propertyVarValue);
                                }
                            }
                            $result[$name] = $propertyVars;
                        }
                    }
                } else {
                    $result[$name] = $value;
                }
            }
            return $result;
        };

        $result = [];
        foreach ($this->internalDataListData as $index => $object) {
            $object = $this->internalDataListUpdateValueIfNeeded($this->internalDataListData, $index);
            if (method_exists($object, 'toArray')) {
                $result[] = $object->toArray();
            } else {
                $result[] = $toArray($object);
            }
        }
        return $result;
    }
public function toArray(): array
    {
        $this->internalDataListUpdate();

        // Copied from DataObjectToArrayTrait. Do not modify here !!!
        $toArray = function($object) use (&$toArray) {
            $result = [];
            $vars = get_object_vars($object);
            foreach ($vars as $name => $value) {
                if ($name !== 'internalDataObjectData') {
                    $reflectionProperty = new \ReflectionProperty($object, $name);
                    if ($reflectionProperty->isPublic()) {
                        $result[$name] = null;
                    }
                }
            }
            if (isset($object->internalDataObjectData)) {
                foreach ($object->internalDataObjectData as $name => $value) {
                    $result[substr($name, 1)] = null;
                }
            }
            ksort($result);
            foreach ($result as $name => $null) {
                $value = $object instanceof \ArrayAccess ? $object[$name] : (isset($object->$name) ? $object->$name : null);
                if (is_object($value)) {
                    if (method_exists($value, 'toArray')) {
                        $result[$name] = $value->toArray();
                    } else {
                        if ($value instanceof \DateTime) {
                            $result[$name] = $value->format('c');
                        } else {
                            $propertyVars = $toArray($value);
                            foreach ($propertyVars as $propertyVarName => $propertyVarValue) {
                                if (is_object($propertyVarValue)) {
                                    $propertyVars[$propertyVarName] = $toArray($propertyVarValue);
                                }
                            }
                            $result[$name] = $propertyVars;
                        }
                    }
                } else {
                    $result[$name] = $value;
                }
            }
            return $result;
        };

        $result = [];
        foreach ($this->internalDataListData as $index => $object) {
            $object = $this->internalDataListUpdateValueIfNeeded($this->internalDataListData, $index);
            if (method_exists($object, 'toArray')) {
                $result[] = $object->toArray();
            } else {
                $result[] = $toArray($object);
            }
        }
        return $result;
    }
public function toArray ( ) : array { $ this -> internalDataListUpdate ( ) ; // Copied from DataObjectToArrayTrait. Do not modify here !!! $ toArray = function ( $ object ) use ( & $ toArray ) { $ result = [ ] ; $ vars = get_object_vars ( $ object ) ; foreach ( $ vars as $ name => $ value ) { if ( $ name !== 'internalDataObjectData' ) { $ reflectionProperty = new \ ReflectionProperty ( $ object , $ name ) ; if ( $ reflectionProperty -> isPublic ( ) ) { $ result [ $ name ] = null ; } } } if ( isset ( $ object -> internalDataObjectData ) ) { foreach ( $ object -> internalDataObjectData as $ name => $ value ) { $ result [ substr ( $ name , 1 ) ] = null ; } } ksort ( $ result ) ; foreach ( $ result as $ name => $ null ) { $ value = $ object instanceof \ ArrayAccess ? $ object [ $ name ] : ( isset ( $ object -> $ name ) ? $ object -> $ name : null ) ; if ( is_object ( $ value ) ) { if ( method_exists ( $ value , 'toArray' ) ) { $ result [ $ name ] = $ value -> toArray ( ) ; } else { if ( $ value instanceof \ DateTime ) { $ result [ $ name ] = $ value -> format ( 'c' ) ; } else { $ propertyVars = $ toArray ( $ value ) ; foreach ( $ propertyVars as $ propertyVarName => $ propertyVarValue ) { if ( is_object ( $ propertyVarValue ) ) { $ propertyVars [ $ propertyVarName ] = $ toArray ( $ propertyVarValue ) ; } } $ result [ $ name ] = $ propertyVars ; } } } else { $ result [ $ name ] = $ value ; } } return $ result ; } ; $ result = [ ] ; foreach ( $ this -> internalDataListData as $ index => $ object ) { $ object = $ this -> internalDataListUpdateValueIfNeeded ( $ this -> internalDataListData , $ index ) ; if ( method_exists ( $ object , 'toArray' ) ) { $ result [ ] = $ object -> toArray ( ) ; } else { $ result [ ] = $ toArray ( $ object ) ; } } return $ result ; }
Returns the list data converted as an array.

@return array The list data converted as an array.
@throws \InvalidArgumentException
Returns the list data converted as an array .