Translate a "morse word" to text

@param string $morse
@return string
331152
private function translateMorseWord($morse) {
        $morseChars = explode(' ', $morse);
        $characters = array_map([$this, 'translateMorseCharacter'], $morseChars);
        return implode('', $characters);
    }
697298
public function toFixed($quote = false)
    {
        $txt = '';

        $this->_reformat(false, $quote);
        $lines = count($this->_output) - 1;
        foreach ($this->_output as $no => $line) {
            $txt .= $line['text'] . (($lines == $no) ? '' : "\n");
        }

        return $txt;
    }
637280
function translate ($code)
    {
        if (preg_match_all("/<\?_\(\"(.*)\"\)\?>/siU", $code, $matches, PREG_SET_ORDER)) {
            foreach ($matches as $match) {
                if (isset($match[1])) {
                    $code = str_replace($match[0], gettext(stripslashes($match[1])), $code);
                }
            }
        }
        return $code;
    }
1362530
public function processText(string $text): string
    {
        $text = str_replace("<br>", "", $text);
        $text = str_replace("<br/>", "", $text);
        $text = str_replace("<br />", "", $text);
        $text = str_replace("\n", "<br>", $text);
        $text = str_replace("\t", "&nbsp; &nbsp; &nbsp;", $text);

        return preg_replace($this->pattern, $this->replace, $text);
    }
119465
protected function snakeCase( $string )
	{
		if( !ctype_lower( $string )) {
			$string = preg_replace( '/\s+/u', '', $string );
			$string = preg_replace( '/(.)(?=[A-Z])/u', '$1_', $string );
			$string = mb_strtolower( $string, 'UTF-8' );
		}

		return $string;
	}
811931
private function transliterateCroatian($s)
    {
        $table = array(
            'Č' => 'C',
            'Ć' => 'C',
            'Ž' => 'Z',
            'Š' => 'S',
            'Đ' => 'D',
            'č' => 'c',
            'ć' => 'c',
            'ž' => 'z',
            'š' => 's',
            'đ' => 'd',
        );
        return strtr($s, $table);
    }
365096
protected function getText($key)
    {
        return isset($this->texts[$key]) ? $this->texts[$key] : GetOpt::translate($key);
    }
750001
public function initialLetter(string $text): string
    {
        $text = I18N::strtoupper($text);

        $digraphs = self::DIGRAPHS[$this->locale->languageTag()] ?? [];

        foreach ($digraphs as $key => $value) {
            if (substr_compare($text, $key, 0, strlen($key)) === 0) {
                return $value;
            }
        }

        // No special rules - just take the first character
        return mb_substr($text, 0, 1);
    }
1044360
public static function camelcaseToSnakecase(string $string): string
    {
        preg_match_all('!([A-Z][A-Z0-9]*(?=$|[A-Z][a-z0-9])|[A-Za-z][a-z0-9]+)!', $string, $matches);

        $words = $matches[0];
        foreach ($words as &$word) {
            $word = ($word == strtoupper($word))
                ? strtolower($word)
                : lcfirst($word);
        }

        return implode('_', $words);
    }
1232830
protected function translateName($name)
    {
        if ($name === '/index.php') {
            return '';
        }

        $name = ltrim($name, '/');
        $name = rtrim($name, '/');

        return preg_replace('/[^A-Za-z0-9\-_]/', '', strtr($name, [
            '/' => '_',
            '.md' => '',
        ]));
    }
1332398
public String decode(String morse) {
		Assert.notNull(morse, "Morse should not be null.");

		final char dit = this.dit;
		final char dah = this.dah;
		final char split = this.split;
		if (false == StrUtil.containsOnly(morse, dit, dah, split)) {
			throw new IllegalArgumentException("Incorrect morse.");
		}
		final List<String> words = StrUtil.split(morse, split);
		final StringBuilder textBuilder = new StringBuilder();
		Integer codePoint;
		for (String word : words) {
			if(StrUtil.isEmpty(word)){
				continue;
			}
			word = word.replace(dit, '0').replace(dah, '1');
			codePoint = dictionaries.get(word);
			if (codePoint == null) {
				codePoint = Integer.valueOf(word, 2);
			}
			textBuilder.appendCodePoint(codePoint);
		}
		return textBuilder.toString();
	}
932810
public function getSnakeCase(string $glue = '-')
    {
        $words = [];

        foreach ($this->words as $word) {
            $words[] = $word->getLowerCase();
        }

        return implode($glue, $words);
    }
963959
public function slugify(string $text): string
    {
        $map = $this->getMap();
        $text = str_replace(array_keys($map), array_values($map), trim($text));

        $transliterator = IntlTransliterator::create('Any-Latin; Latin-ASCII; Lower()');

        $text = $transliterator->transliterate($text);
        $text = str_replace('&', 'and', $text);

        return preg_replace(
            ['/[^\w\s]/', '/\s+/'],
            ['', '-'],
            $text
        );
    }
1150825
private function _transliterateFrench ($s)
    {        
        $table = array (
            'â' => 'a',
            'ê' => 'e',
            'î' => 'i',
            'ô' => 'o',
            'û' => 'u',
            'Â' => 'A',
            'Ê' => 'E',
            'Î' => 'I',
            'Ô' => 'O',
            'Û' => 'U',
            'œ' => 'oe',
            'æ' => 'ae',
            'Ÿ' => 'Y',
            'ç' => 'c',
        	'Ç' => 'C',
        );
        return strtr($s, $table);
    }
203734
public static function trans($string, $replace = [])
    {
        $text = \JText::_($string);

        foreach ($replace as $key => $value) {
            $text = str_replace($key, $value, $text);
        }

        return $text;
    }
280977
public function convertGrammar( $word, $case ) {
		global $wgGrammarForms;
		if ( isset( $wgGrammarForms['he'][$case][$word] ) ) {
			return $wgGrammarForms['he'][$case][$word];
		}

		switch ( $case ) {
			case 'prefixed':
			case 'תחילית':
				# Duplicate the "Waw" if prefixed
				if ( substr( $word, 0, 2 ) == "ו" && substr( $word, 0, 4 ) != "וו" ) {
					$word = "ו" . $word;
				}

				# Remove the "He" if prefixed
				if ( substr( $word, 0, 2 ) == "ה" ) {
					$word = substr( $word, 2 );
				}

				# Add a hyphen if non-Hebrew letters
				if ( substr( $word, 0, 2 ) < "א" || substr( $word, 0, 2 ) > "ת" ) {
					$word = "־" . $word;
				}
		}

		return $word;
	}
768820
protected function translateCipher(int $nscaName) : string {
        switch ($nscaName) {
            case self::ENCRYPT_DES:
                return MCRYPT_DES;
            case self::ENCRYPT_3DES:
                return MCRYPT_3DES;
            case self::ENCRYPT_CAST128:
                return MCRYPT_CAST_128;
            case self::ENCRYPT_CAST256:
                return MCRYPT_CAST_256;
            case self::ENCRYPT_XTEA:
                return MCRYPT_XTEA;
            case self::ENCRYPT_3WAY:
                return MCRYPT_THREEWAY;
            case self::ENCRYPT_BLOWFISH:
                return MCRYPT_BLOWFISH;
            case self::ENCRYPT_TWOFISH:
                return MCRYPT_TWOFISH;
            case self::ENCRYPT_LOKI97:
                return MCRYPT_LOKI97;
            case self::ENCRYPT_RC2:
                return MCRYPT_RC2;
            case self::ENCRYPT_ARCFOUR:
                return MCRYPT_ARCFOUR;
            case self::ENCRYPT_RIJNDAEL128:
                return MCRYPT_RIJNDAEL_128;
            case self::ENCRYPT_RIJNDAEL192:
                return MCRYPT_RIJNDAEL_192;
            case self::ENCRYPT_RIJNDAEL256:
                return MCRYPT_RIJNDAEL_256;
            case self::ENCRYPT_WAKE:
                return MCRYPT_WAKE;
            case self::ENCRYPT_SERPENT:
                return MCRYPT_SERPENT;
            case self::ENCRYPT_ENIGMA:
                return MCRYPT_ENIGNA;
            case self::ENCRYPT_GOST:
                return MCRYPT_GOST;
            case self::ENCRYPT_SAFER64:
                return MCRYPT_SAFER64;
            case self::ENCRYPT_SAFER128:
                return MCRYPT_SAFER128;
            case self::ENCRYPT_SAFERPLUS:
                return MCRYPT_SAFERPLUS;
        }
        throw new EncryptionException('Unknown Cipher: ' . $nscaName);
    }