src/Document.php
public function toArray()
    {
        $data = array();

        $class = $this->getClass();
        if (!empty($class)) {
            $data['class'] = $class;
        }

        $properties = $this->getProperties();
        if (!empty($properties)) {
            $data['properties'] = $properties;
        }

        $entities = $this->getEntities();
        if (!empty($entities)) {
            $data['entities'] = array();
            foreach ($entities as $entity) {
                $data['entities'][] = $entity->toArray();
            }
        }

        $actions = $this->getActions();
        if (!empty($actions)) {
            $data['actions'] = array();
            foreach ($actions as $action) {
                $data['actions'][] = $action->toArray();
            }
        }

        $links = $this->getLinks();
        if (!empty($links)) {
            $data['links'] = array();
            foreach ($links as $link) {
                $data['links'][] = $link->toArray();
            }
        }

        return $data;
    }
public function toArray()
    {
        $data = array();

        $class = $this->getClass();
        if (!empty($class)) {
            $data['class'] = $class;
        }

        $properties = $this->getProperties();
        if (!empty($properties)) {
            $data['properties'] = $properties;
        }

        $entities = $this->getEntities();
        if (!empty($entities)) {
            $data['entities'] = array();
            foreach ($entities as $entity) {
                $data['entities'][] = $entity->toArray();
            }
        }

        $actions = $this->getActions();
        if (!empty($actions)) {
            $data['actions'] = array();
            foreach ($actions as $action) {
                $data['actions'][] = $action->toArray();
            }
        }

        $links = $this->getLinks();
        if (!empty($links)) {
            $data['links'] = array();
            foreach ($links as $link) {
                $data['links'][] = $link->toArray();
            }
        }

        return $data;
    }
Convert object to array

@return array