src/Phrase.php
public static function decode(
        string $phrase,
        string $concatenationType = self::CONCATENATION_TYPE_ALL,
        string $glue = null
    ) {
        if ($concatenationType == self::CONCATENATION_TYPE_CAPITALIZATION ||
            $concatenationType == self::CONCATENATION_TYPE_ALL) {
            $phrase = preg_split('/(?=[A-Z])/', $phrase);
        } else {
            $phrase = [$phrase];
        }

        if ($concatenationType == self::CONCATENATION_TYPE_GLUE ||
            $concatenationType == self::CONCATENATION_TYPE_ALL) {
            $newWords = [];

            foreach ($phrase as $i) {
                array_push($newWords, ...self::unglue($i, $glue));
            }

            $phrase = $newWords;
        }

        $phrase = array_filter($phrase);

        foreach ($phrase as &$word) {
            $word = Dictionary::getInstance()->getWord($word);
        }

        return new self(...$phrase);
    }
public static function decode(
        string $phrase,
        string $concatenationType = self::CONCATENATION_TYPE_ALL,
        string $glue = null
    ) {
        if ($concatenationType == self::CONCATENATION_TYPE_CAPITALIZATION ||
            $concatenationType == self::CONCATENATION_TYPE_ALL) {
            $phrase = preg_split('/(?=[A-Z])/', $phrase);
        } else {
            $phrase = [$phrase];
        }

        if ($concatenationType == self::CONCATENATION_TYPE_GLUE ||
            $concatenationType == self::CONCATENATION_TYPE_ALL) {
            $newWords = [];

            foreach ($phrase as $i) {
                array_push($newWords, ...self::unglue($i, $glue));
            }

            $phrase = $newWords;
        }

        $phrase = array_filter($phrase);

        foreach ($phrase as &$word) {
            $word = Dictionary::getInstance()->getWord($word);
        }

        return new self(...$phrase);
    }
public static function decode ( string $ phrase , string $ concatenationType = self :: CONCATENATION_TYPE_ALL , string $ glue = null ) { if ( $ concatenationType == self :: CONCATENATION_TYPE_CAPITALIZATION || $ concatenationType == self :: CONCATENATION_TYPE_ALL ) { $ phrase = preg_split ( '/(?=[A-Z])/' , $ phrase ) ; } else { $ phrase = [ $ phrase ] ; } if ( $ concatenationType == self :: CONCATENATION_TYPE_GLUE || $ concatenationType == self :: CONCATENATION_TYPE_ALL ) { $ newWords = [ ] ; foreach ( $ phrase as $ i ) { array_push ( $ newWords , ... self :: unglue ( $ i , $ glue ) ) ; } $ phrase = $ newWords ; } $ phrase = array_filter ( $ phrase ) ; foreach ( $ phrase as & $ word ) { $ word = Dictionary :: getInstance ( ) -> getWord ( $ word ) ; } return new self ( ... $ phrase ) ; }
Given a phrase as a string, and a few options, break it down into individual Word objects and create a Phrase
with them.

@param string $phrase The phrase we are starting with.
@param string $concatenationType The type of the concatenation.
@param string|null $glue The glue we should use specifically. This can be a list of chars (except /).
@return Phrase The resulting object, created with the words we separated.
Given a phrase as a string and a few options break it down into individual Word objects and create a Phrase with them .