mikehaertl\wkhtmlto\Pdf::processInput PHP Method

processInput() protected method

protected processInput ( string $input, string | null $type = null ) : mikehaertl\tmp\File | string
$input string
$type string | null a type hint if the input is a string of known type. This can either be `TYPE_HTML` or `TYPE_XML`. If `null` (default) the type is auto detected from the string content.
return mikehaertl\tmp\File | string a File object if the input is a HTML or XML string. The unchanged input otherwhise.
    protected function processInput($input, $type = null)
    {
        if ($type === self::TYPE_HTML || $type === null && preg_match(self::REGEX_HTML, $input)) {
            return $this->_tmpFiles[] = new File($input, '.html', self::TMP_PREFIX, $this->tmpDir);
        } elseif ($type === self::TYPE_XML || preg_match(self::REGEX_XML, $input)) {
            return $this->_tmpFiles[] = new File($input, '.xml', self::TMP_PREFIX, $this->tmpDir);
        } else {
            return $input;
        }
    }