FluentDOM\Loader\Json\JsonDOM::load PHP Method

load() public method

Load the json string into an DOMDocument
public load ( mixed $source, string $contentType, array | Traversable | Options $options = [] ) : Document | Result | null
$source mixed
$contentType string
$options array | Traversable | Options
return FluentDOM\Document | FluentDOM\Loader\Result | null
    public function load($source, $contentType, $options = [])
    {
        if (FALSE !== ($json = $this->getJson($source, $contentType))) {
            $dom = new Document('1.0', 'UTF-8');
            $dom->appendChild($root = $dom->createElementNS(self::XMLNS, 'json:json'));
            $onMapKey = $this->_onMapKey;
            if (isset($options[self::ON_MAP_KEY]) && is_callable($options[self::ON_MAP_KEY])) {
                $this->onMapKey($options[self::ON_MAP_KEY]);
            }
            $this->transferTo($root, $json, $this->_recursions);
            $this->_onMapKey = $onMapKey;
            return $dom;
        }
        return NULL;
    }