Parses the raw string input and returns the resulting root node.

@param string $input
@return Node
5462
public function parse($input)
    {
        if (strlen($input) == 0) {
            return null;
        }
        return $this->parser->parse(new TokenStream($this->tokenizer->getTokens($input)));
    }
1370375
public function decode(string $input)
    {
        // if (!is_string($input)) {
        //     throw new InvalidArgumentException('Input must be string when call decode.');
        // }
        $input = $this->toBuffer($input);
        $decoded = $this->decodeData($input);

        return $decoded['data'];
    }
1329149
protected function parse(string $input)
    {
        $prependedRandom = bin2hex(random_bytes(10));
        $appendedRandom = bin2hex(random_bytes(10));
        
        $html = "<!DOCTYPE html>
            <html>
                <head>
                    <title>Filter</title>
                </head>
                <body><!--$prependedRandom-->$input<!--$appendedRandom--></body>
            </html>
        ";
        
        $html5 = new html5\HTML5();
        $document = $html5->loadHTML($html);
        
        foreach ($html5->getErrors() as $error) {
            $this->logger->warning($error);
        }
        
        $body = $document->getElementsByTagNameNS('http://www.w3.org/1999/xhtml', 'body')->item(0);
        if ($body && $body->hasChildNodes()
            && $body->firstChild->nodeType === \XML_COMMENT_NODE && $body->firstChild->data === $prependedRandom
            && $body->lastChild->nodeType === \XML_COMMENT_NODE && $body->lastChild->data === $appendedRandom) {
            $body->removeChild($body->firstChild);
            $body->removeChild($body->lastChild);
            return $body;
        }
        
        $this->logger->error(_('HTMLの解析に失敗しました。'));
    }
457239
public function parse($input, array $aliases = array())
    {
        if (0 !== strpos(ltrim($input), '/**')) {
            return array();
        }

        if (false == ($position = strpos($input, '@'))) {
            return array();
        }

        if (0 < $position) {
            $position -= 1;
        }

        $input = substr($input, $position);
        $input = trim($input, '*/ ');

        $this->aliases = $aliases;

        $this->lexer->setInput($input);
        $this->lexer->moveNext();

        return $this->getAnnotations();
    }
365174
public function htmlEntities( string$input ):string
	{
		return htmlentities($input,$this->htsl->getConfig('ENT_flags',$this->docType),$this->htsl->getConfig('charset'),false);
	}
746889
public function tokenize($input)
	{
		$tokens = [];
		$exp = ltrim($input);
		
		for($length = strlen($exp), $i = 0; $i < $length; $i++)
		{
			if(trim($exp[$i]) == '')
			{
				continue;
			}
			
			if(NULL !== ($token = $this->getTerminalToken($exp, $i)))
			{
				$tokens[] = $token;
				
				continue;
			}
			
			if(NULL !== ($token = $this->getStringToken($exp, $length, $i)))
			{
				$tokens[] = $token;
				
				continue;
			}
			
			$sub = substr($exp, $i);
			$m = NULL;
			
			if(preg_match(self::PATTERN_DECIMAL, $sub, $m))
			{
				$tokens[] = $this->getDecimalToken($m);
				$i += strlen($m[1]) - 1;
				
				continue;
			}
			
			if(preg_match(self::PATTERN_INTEGER, $sub, $m))
			{
				$tokens[] = $this->getIntegerToken($m);	
				$i += strlen($m[1]) - 1;
				
				continue;
			}
			
			if(preg_match(self::PATTERN_IDENTIFIER, $sub, $m))
			{
				$tokens[] = $this->getIdentifierToken($m);
				$i += strlen($m[0]) - 1;
				
				continue;
			}
		}
		
		return new AnnotationTokenSequence($tokens);
	}
1065363
private function parseFields($input)
    {
        if (is_array($input)) {
            return $input;
        }

        $fields = [];
        foreach (explode(' ', $input) as $value) {
            $elements = explode(':', $value);
            $name = $elements[0];
            if (strlen($name)) {
                $type = isset($elements[1]) ? $elements[1] : 'string';
                preg_match_all('/(.*)\((.*)\)/', $type, $matches);
                $type = isset($matches[1][0]) ? $matches[1][0] : $type;
                $length = isset($matches[2][0]) ? $matches[2][0] : null;

                $fields[$name] = ['fieldName' => $name, 'type' => $type, 'length' => $length];
            }
        }

        return $fields;
    }
928031
public static function input(String $input) : Http
    {
        if( in_array($input, self::$types) )
        {
            self::$settings['input'] = $input;
        }
        else
        {
            throw new InvalidArgumentException('Error', 'invalidInput', $input.' : get, post, server, env, request');
        }

        return self::singleton();
    }
422547
public function doIndent($input)
    {
        $subject = $input;

        $output = '';

        $nextLineIndentationLevel = 0;

        do {
            $indentationLevel = $nextLineIndentationLevel;

            $patterns = $this->getTagPatterns();

            $rules = ['NO', 'DECREASE', 'INCREASE', 'DISCARD'];

            $match = [];

            foreach ($patterns as $pattern => $rule) {
                if ($match = preg_match($pattern, $subject, $matches)) {
                    $this->log[] = [
                        'rule' => $rules[$rule],
                        'pattern' => $pattern,
                        'subject' => $subject,
                        'match' => $matches[0],
                    ];

                    $subject = mb_substr($subject, mb_strlen($matches[0]));

                    if ($rule === static::MATCH_DISCARD) {
                        break;
                    }

                    if ($rule === static::MATCH_INDENT_NO) {
                    } else {
                        if ($rule === static::MATCH_INDENT_DECREASE) {
                            $nextLineIndentationLevel--;
                            $indentationLevel--;
                        } else {
                            $nextLineIndentationLevel++;
                        }
                    }

                    if ($indentationLevel < 0) {
                        $indentationLevel = 0;
                    }

                    $output .= str_repeat(
                        $this->options['indentation_character'],
                        $indentationLevel
                    ) . $matches[0] . "\n";

                    break;
                }
            }
        } while ($match);

        $interpretedInput = '';

        foreach ($this->log as $e) {
            $interpretedInput .= $e['match'];
        }

        if ($interpretedInput !== $input) {
            throw new \RuntimeException('Did not reproduce the exact input.');
        }

        $output = preg_replace('/(<(\w+)[^>]*>)\s*(<\/\2>)/', '\\1\\3', $output);

        return $output;
    }
986022
public function wrapInner($input): self {
        $this->wrapWithInputByCallback($input, function($node, $stackNodes) {
            foreach ($node->contents() as $child) {
                // Remove child from the current node
                $oldChild = $child->detach()->first();

                // Add it back as a child of the top (leaf) node on the stack
                $stackNodes->top()->append($oldChild);
            }

            // Add the bottom (root) node on the stack
            $node->append($stackNodes->bottom());
        });

        return $this;
    }
535937
public function parse(string $input): Type
    {
        $this->lexer->setInput($input);
        $this->lexer->moveNext();

        return $this->parseInternal();
    }
799497
protected function _outputXML($input) {
		$attributes = '';
		$output = '';
		
		// get attributes
		foreach ($input as $key => $value) {
			$attribute = [];

			if ($key[0] == $this->attribute_tag) {
				$newkey = substr($key, 1);
				foreach ($value as $pkey => $pvalue) {
					$attribute[] = $pkey.'="'.htmlspecialchars($pvalue).'"';
				}
				$attributes[$newkey] = implode(' ', $attribute);
				unset($input[$key]);
			}
		}

		// run through all keys
		foreach ($input as $key => $value) {
			// set attribs
			if (isset($attributes[$key])) $attr = ' '.$attributes[$key]; else $attr = '';

			// process numeric indices
			if (is_numeric($key)) $key = $this->numeric_prefix.$key;

			if (is_array($value) && count($value) > 0) {
				$body = $this -> _outputXML($value);
			} else {
				// process value
				if (is_array($value)) $value = '';
				elseif ($value === true) $value = 'true';
				elseif ($value === false) $value = 'false';
				elseif ($value === null) $value = 'null';
				else {
					$value = trim(stripslashes($value));

					if (strpos($value, '<') !== false OR strpos($value, '>') !== false OR strpos($value, '&') !== false) {
						$value = '<![CDATA['.$value.']]>';
					}
				}

				$body = $value;
			}

			// process equal named tags
			$key = explode($this->strip_tag, $key);
			$key = $key[0];

			// Start-Tag setzen
			if (!isset($output)) $output = '';
			$output .= '<'.$key.$attr.'>';
			$output .= $body;
			// End-Tag setzen
			$output .= '</'.$key.'>';
		}
		return $output;
	}
922539
public function wrap($input): self {
        $this->wrapWithInputByCallback($input, function($node, $stackNodes) {
            // Add the new bottom (root) node after the current node
            $node->after($stackNodes->bottom());

            // Remove the current node
            $oldNode = $node->detach()->first();

            // Add the 'current node' back inside the new top (leaf) node.
            $stackNodes->top()->append($oldNode);
        });

        return $this;
    }
1081847
public static function parseFormData($input)
    {
        $boundary = substr($input, 0, strpos($input, "\r\n"));

        // Fetch each part
        $parts = array_slice(explode($boundary, $input), 1);
        $data = [];
        $files = [];

        foreach ($parts as $part) {
            // If this is the last part, break
            if (strpos($part, '--') === 0) {
                break;
            }

            // Separate content from headers
            $part = ltrim($part, "\r\n");

            list($rawHeaders, $content) = explode("\r\n\r\n", $part, 2);

            $content = substr($content, 0, strlen($content) - 2);

            // Parse the headers list
            $rawHeaders = explode("\r\n", $rawHeaders);
            $headers = [];

            foreach ($rawHeaders as $header) {
                list($name, $value) = explode(':', $header, 2);

                $headers[strtolower($name)] = ltrim($value, ' ');
            }

            // Parse the Content-Disposition to get the field name, etc.
            if (isset($headers['content-disposition'])) {
                $filename = null;

                preg_match(
                    '/^form-data; *name="([^"]+)"(?:; *filename="([^"]+)")?/',
                    $headers['content-disposition'],
                    $matches
                );

                $field = $matches[1];
                $fileName = (isset($matches[2]) ? $matches[2] : null);

                $fieldName = str_replace(['[', '][', ']'], ['.', '.', ''], $field);

                // If we have no filename, save the data. Otherwise, save the file.
                if ($fileName === null) {
                    static::setByPath($data, $fieldName, $content);
                } else {
                    $tempFile = tempnam(sys_get_temp_dir(), 'sfy');

                    file_put_contents($tempFile, $content);

                    $content = [
                        'name' => $fileName,
                        'type' => $headers['content-type'],
                        'tmp_name' => $tempFile,
                        'error' => 0,
                        'size' => filesize($tempFile),
                    ];

                    static::setByPath($files, $fieldName, $content);

                    register_shutdown_function(
                        function () use ($tempFile) {
                            @unlink($tempFile);
                        }
                    );
                }
            }
        }

        return [
            'data' => $data,
            'files' => $files,
        ];
    }
1317404
public static function convert($input = STDIN)
    {
        $stream = fopen('php://temp', 'rw');

        foreach ($_SERVER as $key => $value) {
            if (0 === strpos($key, 'HTTP_')) {
                $key = str_replace('_', '-', strtolower(substr($key, 5)));
                fwrite($stream, "$key: $value\r\n");
            } elseif (in_array($key, ['CONTENT_LENGTH', 'CONTENT_MD5', 'CONTENT_TYPE'])) {
                $key = str_replace('_', '-', strtolower($key));
                fwrite($stream, "$key: $value\r\n");
            }
        }

        fwrite($stream, "\r\n");

        stream_copy_to_stream($input, $stream);

        rewind($stream);

        return new StreamedPart($stream);
    }
1111990
public function load($input)
    {
        return array_map(
            function (SplFileInfo $file) {
                return $file->getContents();
            },
            array_values(iterator_to_array($this->getFinder($input)))
        );
    }
757313
public function parse($input)
    {
        if (is_null($input) || empty($input)) {
            return $input;
        }
        $character = $this->getOption('character');
        $regex = strtr($this->getOption('regex'), $this->getOption('regex_replacement'));

        preg_match_all($regex, $input, $matches);

        $matches = array_map([$this, 'mapper'], $matches[0]);

        $matches = $this->removeNullKeys($matches);
        $matches = $this->prepareArray($matches);

        $output = preg_replace_callback($matches, [$this, 'replace'], $input);

        return $output;
    }