@param string $text

@return string
763655
private function formatAsTitle($text)
    {
        $titleLines = array();

        $titleLines[] = str_repeat('#', $this->maxLineLength);
        $titleLines[] = rtrim($this->formatAsSubtitle($text), PHP_EOL);
        $titleLines[] = str_repeat('#', $this->maxLineLength);

        return implode(PHP_EOL, $titleLines).PHP_EOL;
    }
689199
public function convertToUrl($text)
    {
        $text =$this->convertToCode($text);
        $text = str_replace("_", "-", $text);
        return $text;
    }
269336
private function _relToAbs($text)
	{
		$base = \App::get('request')->base();
		$text = preg_replace("/(href|src)=\"(?!http|ftp|https)([^\"]*)\"/", "$1=\"$base\$2\"", $text);

		return $text;
	}
154169
public static function normalizeText($text)
    {
        $text = strtolower($text);
        $text = preg_replace('/[^a-z0-9 -]/im', ' ', $text);
        $text = preg_replace('/( +)/im', ' ', $text);

        return trim($text);
    }
638715
public function noSpec($text = "")
    {
        $text = preg_replace("#[" . preg_quote("'`\\|>!`~^<%)(&") . "]#", "", $text);
        $text = str_replace('"', '\"', $text);

        return $text;
    }
1317703
public function decrypt($text): string
    {
        $length = strlen($text);
        $plain = '';
        for ($iteration = 0; $iteration < $length; $iteration += 8) {
            $aBlock = $this->asc2int(substr($text, $iteration, 4));
            $bBlock = $this->asc2int(substr($text, $iteration + 4, 4));
            list($aBlock, $bBlock) = $this->bfDecrypt($aBlock, $bBlock);
            $plain .= $this->int2asc($aBlock) . $this->int2asc($bBlock);
        }
        return $plain;
    }
1289491
public static function cleanText(string $text)
    {
        $text = preg_replace('/<script[^>]*>.*?</script>/si', '', $text);
        $text = preg_replace('/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text);
        $text = preg_replace('/<!--.+?-->/', '', $text);
        $text = preg_replace('/{.+?}/', '', $text);
        $text = preg_replace('/&nbsp;/', ' ', $text);
        $text = preg_replace('/&amp;/', ' ', $text);
        $text = preg_replace('/&quot;/', ' ', $text);
        $text = strip_tags($text);
        $text = htmlspecialchars($text);

        return $text;
    }
313432
public static function strip(string $text): string
    {
        if (false === \strpos($text, '</')) {
            return $text;
        }

        // $text = \strip_tags($text);
        return \preg_replace(self::STRIP_TAG, '', $text);
    }
998213
public function format(string $text) : string
    {
        if ($text === '') {
            return $text;
        }

        $startCodes = [];
        $endCodes = [];

        if ($this->foregroundColor !== null) {
            $startCodes[] = self::$supportedForegroundColors[$this->foregroundColor][0];
            $endCodes[] = self::$supportedForegroundColors[$this->foregroundColor][1];
        }

        if ($this->backgroundColor !== null) {
            $startCodes[] = self::$supportedBackgroundColors[$this->backgroundColor][0];
            $endCodes[] = self::$supportedBackgroundColors[$this->backgroundColor][1];
        }

        foreach ($this->textStyles as $style) {
            $startCodes[] = self::$supportedTextStyles[$style][0];
            $endCodes[] = self::$supportedTextStyles[$style][1];
        }

        if (count($startCodes) === 0 && count($endCodes) === 0) {
            // No point in trying to format the text
            return $text;
        }

        return sprintf(
            "\033[%sm%s\033[%sm",
            implode(';', $startCodes),
            $text,
            implode(';', $endCodes)
        );
    }
1297383
public function escape(string $text): string
    {
        $replacements = [
            '&' => '&amp;',
            '<' => '&lt;',
            '>' => '&gt;',
        ];

        return str_replace(array_keys($replacements), array_values($replacements), $text);
    }
723485
public static function humanize(string $text): string
    {
        $text = \str_replace(['-', '_'], ' ', $text);

        return Stringy::create($text)->humanize()->titleize();
    }
1041395
public function _(string $text) : string
    {
        return $this->c->translator instanceof ITranslator ? $this->c->translator->translate($text) : $text;
    }
670267
public static function humanize($text)
    {
        preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $text, $matches);
        $ret = $matches[0];

        foreach ($ret as &$match) {
            $match = $match == strtoupper($match) ? strtolower($match) : lcfirst($match);
        }

        return ucfirst(implode(' ', $ret));
    }
410493
public function readSex(string $text): string
    {
        $text = strtoupper($text);

        if ($text !== self::SEX_MALE && $text !== self::SEX_FEMALE) {
            $text = self::SEX_UNKNOWN;
        }

        return $text;
    }
124217
public function render($text)
    {
        $text = trim(str_replace(array("\r\n", "\r"), "\n", $text), "\n");

        foreach ($this->rules as $regex => $replacement) {
            if (is_callable($replacement)) {
                $text = preg_replace_callback($regex, $replacement, $text);
            } else {
                $text = preg_replace($regex, $replacement, $text);
            }
        }

        return trim($text);
    }
250486
public static function slugify(string $text) : string 
    {
        $lowerText = strtolower($text);
        $arrTransform = [
            "ä" => "ae",
            "à" => "a",
            "á" => "a",
            "ą" => "a",
            "â" => "a",
            "å" => "a",
            "Æ" => "ae",
            "æ" => "ae",
            "ç" => "c",
            "é" => "e",
            "è" => "e",
            "ê" => "e",
            "ē" => "e",
            "ë" => "e",
            "í" => "i",
            "ì" => "i",
            "î" => "i",
            "ī" => "i",
            "ï" => "i",
            "ñ" => "n",
            "ö" => "oe",
            "ô" => "o",
            "ô" => "o",
            "ǫ" => "o",
            "ò" => "o",
            "õ" => "o",
            "ø" => "o",
            "ẞ" => "ss",
            "ß" => "ss",
            "ü" => "ue",
            "û" => "ue",
            "ù" => "ue",
            "ú" => "ue",
            "ȳ" => "y",
            "ŷ" => "y",
            "ŷ" => "y",
        ];
        
        foreach ($arrTransform as $key => $val) {
            $lowerText = str_replace($key, $val, $lowerText);
        }
        
        //Final check, just make sure no special chars and replace all other chars with minus
        $slug = (string) preg_replace('/[^a-z0-9-]+/', '-', $lowerText);
        return $slug;
    }
1128955
public static function ctype_punct($text)
    {
        $text = self::convert_int_to_char_for_ctype($text);

        return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
    }