src/Micrometa/Infrastructure/Parser/JsonLD.php
protected function parseRootNode($jsonLDRoot)
    {
        $item = null;

        try {
            $jsonDLDocument = JsonLDParser::getDocument($jsonLDRoot, ['documentLoader' => $this->contextLoader]);

            // Run through all nodes to parse the first one
            /** @var Node $node */
            foreach ($jsonDLDocument->getGraph()->getNodes() as $node) {
                $item = $this->parseNode($node);
                break;
            }
        } catch (JsonLdException $exception) {
            $this->logger->error($exception->getMessage(), ['exception' => $exception]);
        }

        return $item;
    }
protected function parseRootNode($jsonLDRoot)
    {
        $item = null;

        try {
            $jsonDLDocument = JsonLDParser::getDocument($jsonLDRoot, ['documentLoader' => $this->contextLoader]);

            // Run through all nodes to parse the first one
            /** @var Node $node */
            foreach ($jsonDLDocument->getGraph()->getNodes() as $node) {
                $item = $this->parseNode($node);
                break;
            }
        } catch (JsonLdException $exception) {
            $this->logger->error($exception->getMessage(), ['exception' => $exception]);
        }

        return $item;
    }
protected function parseRootNode ( $ jsonLDRoot ) { $ item = null ; try { $ jsonDLDocument = JsonLDParser :: getDocument ( $ jsonLDRoot , [ 'documentLoader' => $ this -> contextLoader ] ) ; // Run through all nodes to parse the first one /** @var Node $node */ foreach ( $ jsonDLDocument -> getGraph ( ) -> getNodes ( ) as $ node ) { $ item = $ this -> parseNode ( $ node ) ; break ; } } catch ( JsonLdException $ exception ) { $ this -> logger -> error ( $ exception -> getMessage ( ) , [ 'exception' => $ exception ] ) ; } return $ item ; }
Parse a JSON-LD root node

@param \stdClass $jsonLDRoot JSON-LD root node
Parse a JSON - LD root node