src/Micrometa/Infrastructure/Parser/JsonLD.php
protected function parse($jsonLD)
    {
        // If it's a node object
        if ($jsonLD instanceof NodeInterface) {
            return $this->parseNode($jsonLD);

            // Else if it's a language tagged string
        } elseif ($jsonLD instanceof LanguageTaggedString) {
            return $this->parseLanguageTaggedString($jsonLD);

            // Else if it's a typed value
        } elseif ($jsonLD instanceof TypedValue) {
            return $this->parseTypedValue($jsonLD);
        }

        // Else if it's a list of items
        return array_map([$this, 'parse'], $jsonLD);
    }
protected function parse($jsonLD)
    {
        // If it's a node object
        if ($jsonLD instanceof NodeInterface) {
            return $this->parseNode($jsonLD);

            // Else if it's a language tagged string
        } elseif ($jsonLD instanceof LanguageTaggedString) {
            return $this->parseLanguageTaggedString($jsonLD);

            // Else if it's a typed value
        } elseif ($jsonLD instanceof TypedValue) {
            return $this->parseTypedValue($jsonLD);
        }

        // Else if it's a list of items
        return array_map([$this, 'parse'], $jsonLD);
    }
protected function parse ( $ jsonLD ) { // If it's a node object if ( $ jsonLD instanceof NodeInterface ) { return $ this -> parseNode ( $ jsonLD ) ; // Else if it's a language tagged string } elseif ( $ jsonLD instanceof LanguageTaggedString ) { return $ this -> parseLanguageTaggedString ( $ jsonLD ) ; // Else if it's a typed value } elseif ( $ jsonLD instanceof TypedValue ) { return $ this -> parseTypedValue ( $ jsonLD ) ; } // Else if it's a list of items return array_map ( [ $ this , 'parse' ] , $ jsonLD ) ; }
Parse a JSON-LD fragment

@param NodeInterface|LanguageTaggedString|TypedValue|array $jsonLD JSON-LD fragment

@return \stdClass|string|array Parsed fragment
Parse a JSON - LD fragment