src/Handler.php
public function toDocument($json)
    {
        $data = json_decode($json, true);

        $document = new Document();

        if (isset($data['class']) && is_array($data['class'])) {
            $document->setClass($data['class']);
        }

        if (isset($data['properties']) && is_array($data['properties'])) {
            $document->setProperties($data['properties']);
        }

        if (isset($data['entities']) && is_array($data['entities'])) {
            $entities = $this->getEntitiesFromDataArray($data['entities']);
            $document->setEntities($entities);
        }

        if (isset($data['actions']) && is_array($data['actions'])) {
            $actions = $this->getActionsFromDataArray($data['actions']);
            $document->setActions($actions);
        }

        if (isset($data['links']) && is_array($data['links'])) {
            $links = $this->getLinksFromDataArray($data['links']);
            $document->setLinks($links);
        }

        return $document;
    }
public function toDocument($json)
    {
        $data = json_decode($json, true);

        $document = new Document();

        if (isset($data['class']) && is_array($data['class'])) {
            $document->setClass($data['class']);
        }

        if (isset($data['properties']) && is_array($data['properties'])) {
            $document->setProperties($data['properties']);
        }

        if (isset($data['entities']) && is_array($data['entities'])) {
            $entities = $this->getEntitiesFromDataArray($data['entities']);
            $document->setEntities($entities);
        }

        if (isset($data['actions']) && is_array($data['actions'])) {
            $actions = $this->getActionsFromDataArray($data['actions']);
            $document->setActions($actions);
        }

        if (isset($data['links']) && is_array($data['links'])) {
            $links = $this->getLinksFromDataArray($data['links']);
            $document->setLinks($links);
        }

        return $document;
    }
Method to convert a siren JSON string into a Siren document object

@param string $json
@return Document