@param $text

@return null|string
328223
private function parseDate($text)
    {
        if (empty($text) || '-' == $text) {
            return null;
        }

        $date = \DateTime::createFromFormat('d/m/Y', $text);

        return false === $date ? null : $date->format('Y-m-d').'T00:00:00.000Z';
    }
44703
public static function undent($text)
	{
		preg_match('/^\s+/', $text, $matches);
		list ($indent) = $matches;
		if ($indent)
		{
			$text = preg_replace("/^$indent/m", '', $text);
		}
		return $text;
	}
848528
public function getTitleFromFirstH1($text)
    {
        $matches = [];
        $title = null;

        if (preg_match("#<h1.*?>(.*)</h1>#", $text, $matches)) {
            $title = strip_tags($matches[1]);
        }

        return $title;
    }
303441
public static function getText($value)
    {
        $enumItem = EnumParser::getInstance()->getEnumItem(static::class, $value);
        if($enumItem)
        {
            return $enumItem->text;
        }
        else
        {
            return null;
        }
    }
278873
public function parser($text)
    {
        //Gets all current class methods, except for `parser()` and `remove()`
        $methods = array_diff(get_child_methods(get_class()), ['parser', 'remove']);

        //Calls dynamically each method
        foreach ($methods as $method) {
            $text = call_user_func([$this, $method], $text);
        }

        return $text;
    }
993608
public function getChoice($text)
    {
        $found = null;
        $text = trim($text);
        $iText = strtoupper(TextNormalizer::stripDiacritics($text));
        foreach ($this->choices as $choice) {
            /** @var CellChoice $choice */
            $tmpText = trim($choice->getText());
            if ($tmpText === $text
              || (
                  !$choice->isCaseSensitive() &&
                  strtoupper(TextNormalizer::stripDiacritics($tmpText)) === $iText)
          ) {
                $found = $choice;
                break;
            }
        }

        return $found;
    }
1313010
protected function sanitize_text( $text ) {
		// not fancy
		$text = strip_tags( $text );
		$text = esc_html( $text );
		$text = trim( $text );

		return $text;
	}
952876
public function apply($text)
    {
        $setCodes = array();
        $unsetCodes = array();
        if (null !== $this->foreground) {
            $setCodes[] = $this->foreground['set'];
            $unsetCodes[] = $this->foreground['unset'];
        }
        if (null !== $this->background) {
            $setCodes[] = $this->background['set'];
            $unsetCodes[] = $this->background['unset'];
        }
        if (count($this->options)) {
            foreach ($this->options as $option) {
                $setCodes[] = $option['set'];
                $unsetCodes[] = $option['unset'];
            }
        }
        if (0 === count($setCodes)) {
            return $text;
        }
        return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
    }
1236900
public function findLog($text)
    {
        foreach ($this->logs() as $Log) {
            if ($Log->content() == $text) {
                return $Log;
            }
        }
    }
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;
    }
261769
public function Tag($text = null)
    {
        $link = $this->Link();

        if ($link) {
            $target = !empty($this->targetBlank) ? 'target="_blank"' : '';

            return $text ? "<a href=\"{$link}\" {$target}>" . Convert::raw2xml(
                    $text
                ) . '</a>' : "<a href=\"{$link}\" {$target}>";
        }

        return '';
    }
866405
static function strtolower( $text )
    {
        //We need to detect our internal charset
        if ( self::$charset === null )
        {
            self::$charset = eZTextCodec::internalCharset();
        }

        //First try to use mbstring
        if ( extension_loaded( 'mbstring' ) )
        {
            return mb_strtolower( $text, self::$charset );
        }
        else
        {
            // Fall back if mbstring is not available
            $char = eZCharTransform::instance();
            return $char->transformByGroup( $text, 'lowercase' );
        }
    }
730823
protected function replaceTextTokens($text)
    {
        foreach ($this->tokens as $key => $val) {
            $text = str_replace('<' . $key . '>', $val, $text);
        }

        return $text;
    }
487534
public function send($text = null)
    {
        if ($text) {
            $this->withText($text);
        }

        $this->response = $this->client->sendMessage($this);

        return $this;
    }
923609
public function parse($text)
    {
        if (empty($text)) {
            return '';
        }

        return $this->driver->text(
            static::removeLeadingWhitespace($this->escape($text))
        );
    }
1198604
protected function _decode($text)
    {
        $restore = mb_internal_encoding();
        mb_internal_encoding($this->_appCharset);
        $return = mb_decode_mimeheader($text);
        mb_internal_encoding($restore);

        return $return;
    }
711619
static function parse($text)
    {
        $parser = new \Parsedown();

        $text = static::cleanLeadingSpace($text);

        return $parser->text($text);
    }