Cast definition to an array

@return array
480846
public function toArray()
    {
        $methods = array();
        foreach ($this->getMethods() as $key => $method) {
            $methods[$key] = $method->toArray();
        }
        return $methods;
    }
784298
public function toArray() {

        $properties = get_object_vars($this);

        foreach($properties as $var => &$value) {
            if(gettype($value)  === 'object') {
                unset($properties[$var]);
            }
        }

        return $properties;
    }
1317678
public function toArray()
    {
        $types = [];
        foreach ($this->collection as $type) {
            $types[$type->getName()] = $type->toArray();
        }

        return $types;
    }
775360
public function getAsArray(): array
    {
        $result = array();

        foreach ($this->_definition as $key => $def) {
            $result[$key] = $this->getFieldAsArray($key);
        }

        return $result;
    }
13145
public function toArray()
    {
        $ret = [ ];
        foreach ($this as $key => $value) {
            $ret[ $key ] = $value;
        }
        return $ret;
    }
1139896
public function toArray()
    {
        $result = [];
        foreach ($this as $key => $value) {
            $result[$key] = $value;
        }
        return $result;
    }
97289
public function toArray(): array
    {
        $type = $this->getType();

        if (empty($type)) {
            throw new InvalidException('Type has to be set');
        }

        return [$type->getName() => $this->_mapping];
    }
1350008
public function toArray() {
        $r = [
            'from' => $this->from,
            'where' => $this->where,
            'order' => $this->order,
            'limit' => $this->limit,
            'offset' => $this->offset
        ];

        return $r;
    }
350673
public function toArray()
    {
        return (isset($_SESSION[$this->_namespace]) && is_array($_SESSION[$this->_namespace])) ? $_SESSION[$this->_namespace] : [];
    }
1136891
public function __toArray()
    {
        $result = array();
        $idx = 0;
        foreach ($this->var as $idx => $line) {
            $result[] = $line->__toFields();
        }
        return $result;
    }
1265363
public function toArray(): array
    {
        return array_map(function ($value) {
            if (method_exists($value, 'toArray')) {
                return $value->toArray();
            }

            return $value;
        }, $this->items);
    }
912289
public function toArray()
    {
        $data = [];
        foreach ($this->items as $key => $value) {
            if ($value instanceof BaseObjectInterface) {
                $value = $value->toArray();
            }
            $data[$key] = $value;
        }

        return $data;
    }
226079
public function toArray()
	{
		$this->data = $this->transformer->transformBack($this->data);

		return $this->data;
	}
714954
public function toArray(): array
    {
        $return = [];
        foreach ($this as $row) {
            if (is_array($row)) {
                $return[] = $row;
            } elseif (method_exists($row, 'toArray')) {
                $return[] = $row->toArray();
            } elseif (method_exists($row, 'getArrayCopy')) {
                $return[] = $row->getArrayCopy();
            } else {
                throw new Exception\RuntimeException(
                    __METHOD__ . ': Rows as part of this DataSource, with type ' . gettype($row) . ' cannot be cast to an array'
                );
            }
        }

        return $return;
    }
819542
public function __toArray()
    {
        $result = [];
        foreach ($this->errors as $idx => $oneError) {
            $result[] = $oneError->__toArray();
        }
        return $result;
    }
323713
public function __toArray() {
        $array = array();
        foreach ($this->__getSerialisablePropertyMap() as $key => $value) {
            if ($value instanceof SerialisableObject) {
                $array[$key] = $value->__toArray();
            } else if (is_array($value)) {
                $array[$key] = SerialisableArrayUtils::convertSerialisableObjectsToAssociativeArrays($value);
            } else {
                $array[$key] = $value;
            }
        }

        return $array;
    }
27230
public function __toArray()
    {
        $dto = array();
        try {
            $reflectionClass = new \ReflectionClass($this);
            $properties = $reflectionClass->getProperties(\ReflectionProperty::IS_PUBLIC);
            if (count($properties) > 0) {
                /** @var \ReflectionProperty $property */
                foreach ($properties as $property) {
                    $value = $property->getValue($this);
                    if(is_object($value) && method_exists($value, 'toArray')) {
                        $dto[$property->getName()] = $value->toArray();
                    } elseif(is_array($value)) {
                        foreach($value as &$arrValue) {
                            if($arrValue instanceof Dto) {
                                $arrValue = $arrValue->toArray();
                            }
                        }
                        $dto[$property->getName()] = $value;
                    } else {
                        $dto[$property->getName()] = $property->getValue($this);
                    }
                }
            }
        } catch (\Exception $e) {
            Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR);
        }
        return $dto;
    }