Fetches the lines of a text and serializes them to an array of key value pairs
@param string $text The text representation of the array
@return array Returns the array representation as associative array
166699
function LinesToArray($text)
    {
        $result = array();
        $lines = Str::SplitLines($text);
        foreach ($lines as $line)
        {
            $line = trim($line);
            if (!$line)
            {
                continue;
            }
            $pos = strpos($line, $this->separator);
            $key = $line;
            $value = '';
            if ($pos !== false)
            {
                $key = substr($line, 0, $pos);
                $value = substr($line, $pos + strlen($this->separator));
            }
            $result[trim($key)] = trim($value);
        }
        return $result;
    }
879997
static private function leetify( $text )
    {
        $searchMap = array( '/to/i', '/for/i', '/ate/i', '/your/i', '/you/i', '/l/i', '/e/i', '/o/i', '/a/i', '/t/i' );
        $replaceMap = array( '2', '4', '8', 'ur', 'u', '1', '3', '0', '4', '7' );

        $textBlocks = preg_split( '/(%[^ ]+)/', $text, -1, PREG_SPLIT_DELIM_CAPTURE );
        $newTextBlocks = array();
        foreach ( $textBlocks as $text )
        {
            if ( strlen( $text ) && $text[0] == '%' )
            {
                $newTextBlocks[] = (string) $text;
                continue;
            }
            $text = preg_replace( $searchMap, $replaceMap, $text );

            $newTextBlocks[] = (string) $text;
        }
        $text = implode( '', $newTextBlocks );
        return $text;
    }
692610
public function read(&$text)
    {
        if (preg_match_all('#@template\(\'(.*)\'#siU', $text, $matches)) {
            foreach ($matches[1] as $key => $match) {
                if (is_string($match) && strpos($match, '.') === false) {
                    $path =  dirname($this->getTemplate()->getPath()).DS.$match.'.php';
                    $text = str_replace($matches[0][$key], '$this->loadFile('."'".$path."'", $text);
                }
            }
        }

        return $this;
    }
8848
private function initPayload($text)
    {
        $payload = new Payload();
        $payload->setOptions($this->getOptions());
        $payload->setQueryText($text);
        return $payload->createPayload();
    }
241589
public static function parseInlineOperator($text)
    {
        $operator_name = 'contains';
        $operator = Arr::get($text, 0, '');
        $value = Arr::get($text, 1, false);

        self::checkInlineOperator($operator, $value);

        if (!empty($operator)) {
            $operator_name = Arr::get(self::getOperator('string', $operator), 'inline', 'contains');
        }

        return [
            $operator_name,
            $operator,
            $value,
        ];
    }
1272664
public function parse(string $text) : string
    {
        if ($text === '')
            throw new ParseException($this, $text, 0, self::NO_EMPTY);
        return $text;
    }
559172
protected function getMatches($text)
    {
        $matches = [];
        if (!$found = preg_match_all($this->buildRegex(), $text, $matches)) {
            return [];
        }

        return $matches[0];
    }
538895
public function getTextFromArray(array $keys = [])
    {
        $values = [];
        foreach ($keys as $key) {
            $values[$key] = $this->getText($key);
        }
        return $values;
    }
586851
public static function parse($text) {
		
		self::setLineEndings();
		
		// set-up defaults
		$yaml     = array();
		$markdown = "";
		
		// read in the content
		// based on: https://github.com/mnapoli/FrontYAML/blob/master/src/Parser.php
		$lines = explode(PHP_EOL, $text);
		
		if (count($lines) <= 1) {
			$markdown = self::convertMarkdown($text);
			return array($yaml,$markdown);
		}
		
		if (rtrim($lines[0]) !== '---') {
			$markdown = self::convertMarkdown($text);
			return array($yaml,$markdown);
		}
		
		$head = array();
		unset($lines[0]);
		$i = 1;
		foreach ($lines as $line) {
			if ($line === '---') {
				break;
			}
			$head[] = $line;
			$i++;
		}
		
		$head = implode(PHP_EOL, $head);
		$body = implode(PHP_EOL, array_slice($lines, $i));
		
		$yaml     = self::convertYAML($head);
		$markdown = self::convertMarkdown($body);
		
		return array($yaml,$markdown);
		
	}
877601
public function parse(string $text) : array
    {
        $index = 0;
        $items = Text::split($text, $this->separator);
        $array = [];
        try {
            foreach ($items as $item) {
                $array[] = $this->syntax->parse($item);
                $index += strlen($item) + 1;
            }
        } catch (ParseException $e) {
            $extra = [
                'type' => 'invalid-item',
                'item' => $item,
                'position' => $e->position()
            ];
            throw new ParseException($this, $text, $index + $e->position(),
                "Unable to parse the item '{$item}'", $extra, $e
            );
        }

        return $array;
    }
1022106
public function line( string $text ): string
	{
		$line = $this->lang->item($text, $this->getThen(), $text);
		return is_array($line) ? reset($line) : (string) $line;
	}
957508
private function _convertTagsToEscapeSequences ( $text ) {
        list($patterns, $replacements) = $this->_getConvertingDictionary();
        $convertedText = preg_replace($patterns, $replacements, $text);
        return $convertedText;
    }
1203016
public function writeRawData($text)
    {
        if (is_array($text)) {
            $text = implode("\n", $text);
        }

        if (method_exists($this, 'writeRaw')) {
            return $this->writeRaw(htmlspecialchars($text));
        }

        return $this->text($text);
    }
1163588
public function tokenize(string $text) : array
    {
        $pattern =
'/(\[
    \/?
    \w+
    (?:
        =
        (?:
            "[^"]+"
            |\'[^\']+\'
            |[^]]+
        )
    )?
\])/x';

        $flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE;
        $tokens = preg_split($pattern, $text, -1, $flags);
        $tokens = array_map(function ($text) use ($pattern) {
            $matches = [];
            if (preg_match($pattern, $text, $matches)) {
                $token = new TagToken($text);

                // Fallback to a text token if tag is not valid.
                if (!$this->validateTagToken($token)) {
                    return new TextToken($text);
                }

                return $token;
            } else {
                return new TextToken($text);
            }
        }, $tokens);
        return $this->processRawContentTagTokens($tokens);
    }
935971
public function split($text) {
        if (count($this->patterns) === 0) {
            return false;
        }
        if ($this->concatenatedPatterns === null) {
            $this->concatenatedPatterns = '/' . implode('|', array_map(function ($pattern) {
                    return $pattern['pattern'];
                }, $this->patterns)) . '/msSi';
        }

        if (!preg_match($this->concatenatedPatterns, $text, $matches)) {
            return false;
        }

        $match = array_shift($matches);
        $patternNo = count($matches) - 1;
        $childRuleName = $this->patterns[$patternNo]['childRuleName'];
        list($first, $end) = preg_split($this->patterns[$patternNo]['pattern'] . 'msSi', $text, 2);

        return [$first, $match, $end, $childRuleName];
    }
334564
protected function parseEscape($text)
	{
		if (isset($text[1]) && in_array($text[1], $this->escapeCharacters)) {
			if ($text[1] === '\\') {
				return [['backslash'], 2];
			}
			return [['text', $text[1]], 2];
		}
		return [['text', $text[0]], 1];
	}
379080
public static function parse($text)
	{
		if (isset(static::$beforeParse))
		{
			$text = call_user_func(static::$beforeParse, $text);
		}

		$xml = static::getCachedParser()->parse($text);

		if (isset(static::$afterParse))
		{
			$xml = call_user_func(static::$afterParse, $xml);
		}

		return $xml;
	}