@param $content

@return DOMDocument
@throws \FastFeed\Exception\RuntimeException
197833
protected function createDocumentFromXML($content)
    {
        $previousValue = libxml_use_internal_errors(true);

        $document = new DOMDocument();
        $document->strictErrorChecking = false;
        $document->loadXML(trim($content));

        libxml_use_internal_errors($previousValue);

        return $document;
    }
674529
public static function fromString(string $content)
    {
        $arr = \json_decode($content, JSON_PRETTY_PRINT);
        $arr = attrToArray($arr);
        return fromArray($arr);
    }
377809
public function wrapInner($content)
    {
        foreach ($this as $i => $node) {
            /** @var \DOMNode $node */
            self::create($node->childNodes)->wrapAll($content);
        }
        return $this;
    }
1180851
public function addCDATASection($content)
    {
        switch (true) {
            case is_string($content):
                break;
            case ($content instanceof \SimpleXMLElement):
                $dom = dom_import_simplexml($content);
                $content = $dom->ownerDocument->saveXML($dom->ownerDocument->documentElement);
                break;
            case ($content instanceof \DOMDocument):
                $content = $content->saveXML($content->childNodes->item(0));
                break;
            case ($content instanceof \DOMNode):
                $dom = new \DOMDocument();
                $import = $dom->importNode($content, true);
                $dom->appendChild($import);
                $content = $dom->saveXML($dom->firstChild);
                break;
            default:
                throw new \InvalidArgumentException(
                    sprintf(
                        'expected arguement 1 to be String, SimpleXMLElement, DOMNode, or DOMDocument, instead saw %s',
                        gettype($content)
                    )
                );
        }

        $import = dom_import_simplexml($this);
        $node   = $import->ownerDocument;
        $import->appendChild($node->createCDATASection($content));
    }
875955
protected function renderElement($content = null)
    {
        // Get element parts
        $element    = $this->getElement();
        $attributes = $this->getAttributesAsString();

        // Create html
        $html = '<' . $element;
        if ($attributes) {
            $html .= $attributes;
        }

        // Create closing tag
        if (is_string($content)) {
            $html .= '>' . $content . '</' . $element;
        }
        $html .= $this->getClosingBracket();

        return $html;
    }
191853
public function create($uri, $content)
    {
        $uri = '/' . trim($uri, '/');

        foreach ($this->patterns as $pattern => $key) {
            if (preg_match($pattern, $uri)) {
                return call_user_func($this->builders[$key], (array) $content);
            }
        }

        throw new RuntimeException(sprintf('Cannot create resource by URI "%s"', $uri));
    }
564785
public function getSerializedContent($content)
    {
        $serializationContext = clone $this->serializationContext;

        return $this->serializer->serialize(
            $content,
            'json',
            $serializationContext
        );
    }
439336
protected final function loadHTML(DOMDocument $dom, string $html)
   {
       try {
           $dom->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
       } catch (Throwable $e) {
           throw new RuntimeException("Can't load HTML: " . $e->getMessage());
       }
   }
187042
public function setXmlContent($content)
    {
        $context = $this->_context;

        $this->setContentType('text/xml');

        $writer = new \XMLWriter();

        $writer->openMemory();
        $writer->startDocument();
        $this->_toXml($writer, (count($content) !== 1) ? ['xml' => $content] : $content);
        $context->content = $writer->outputMemory();

        return $this;
    }
219002
public function parse($contents, $includeDefaults = false)
    {
        $old_libxml_error = libxml_use_internal_errors(true);
        
        $dom = new DOMDocument;
        
        if(@$dom->loadHTML($contents) === false) {
            throw new RuntimeException("Contents is empty");
        }
        
        libxml_use_internal_errors($old_libxml_error);

        foreach($dom->getElementsByTagName('meta') as $tag) {
            if($includeDefaults && $tag->hasAttribute('name') && $tag->hasAttribute('content') && $tag->getAttribute('name') == 'description') {
                $this->addMeta('non-og-description', $tag->getAttribute('content'), self::APPEND);
            } else if($tag->hasAttribute('property') && $tag->hasAttribute('content')) {
                $this->addMeta($tag->getAttribute('property'), $tag->getAttribute('content'), self::APPEND);
            }
        }

        if($includeDefaults) {
            $titles = $dom->getElementsByTagName('title');
            if ($titles->length > 0) {
                $this->addMeta('non-og-title', $titles->item(0)->textContent, self::APPEND);
            }
        }

        unset($dom);
        
        return $this;
    }
849742
public function html($content) {
        if (func_num_args() == 1) {
            $this->_data['fields'][] = $content;
            return $this;
        }
        $this->__attributes['fields'][$content] = func_get_arg(1);
        return $this;
    }
195699
public function setContent($content)
    {
        $context = $this->_context;

        $context->content = (string)$content;

        return $this;
    }
963870
public static function buildAndGetDocument(array $content) :string {
		// if !class_exists... a little help for the developer
		if(!class_exists('\PhpOffice\PhpSpreadsheet\Spreadsheet')) {
			Throw new \Polyfony\Exception(
				'Responses of type XLS(X) depend on phpoffice/spreadsheet', 
				500
			);
		}
		// create a new spreadsheet 
		$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet;
		// to to the current sheet
		($spreadsheet->getActiveSheet())
			// and import our array
			->fromArray(Query\Convert::convertArrayOfObjectsToPlainArray($content), NULL, 'A1');
		// create a singleton to generate an actual file
		$writer = new \PhpOffice\PhpSpreadsheet\Writer\Xls($spreadsheet);
		// as dirty as it may be, we have to buffer it, since phpoffice 
		// doesn't even support gettint the document without saving or outputing it
		ob_start();
		// generate it
		$writer->save('php://output');
		// return the formatted document
		return ob_get_clean();
	}
665640
public function coreScriptFilter($content) {

        $attributes = [];

        $attributes["type"] = "text/javascript";

        $innerHTML = null !== $content ? implode("", ["\n", $content, "\n"]) : "";

        return static::coreHTMLElement("script", $innerHTML, $attributes);
    }
387517
public function parse($content)
    {
        $processor = new Processor(new RegexParser(), $this->handlers);

        return $processor->process($content);
    }
774657
public function parse($content)
    {
        if (strpos($content, '@ORM') === false) {
            return null;
        }

        if (preg_match(self::PATTERN, $content, $matches)) {
            return (new \SplFixedArray(2))->fromArray([$matches[1], $matches[2]]);
        }

        return null;
    }
1261046
public function setContent($content)
    {
        if (null !== $content && !is_string($content) && !is_numeric($content) &&
            ! is_callable(array($content, '__toString'))) {
            throw new \Exception(sprintf(
                'The Response content must be a string or object implementing __toString(), "%s" given.',
                gettype($content)
            ));
        }

        $this->content = $content;

        return $this;
    }