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

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

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

        $href = $this->getHref();
        if ($href !== null) {
            $data['href'] = $href;
        }

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

        $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;
        }

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

        $href = $this->getHref();
        if ($href !== null) {
            $data['href'] = $href;
        }

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

        $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