src/Language.php
public static function convert(string $input, int $to) : string
    {
        $string = self::normalize($input);
        $parts = explode(' ', $string);
        array_walk($parts, function (&$part) {
            $part = ucfirst($part);
        });
        switch ($to) {
            case self::TYPE_NAMESPACE:
                return implode('\\', $parts);
            case self::TYPE_TABLE:
                return strtolower(implode('_', $parts));
            case self::TYPE_VARIABLE:
            case self::TYPE_ANGULAR_COMPONENT:
                return lcfirst(implode('', $parts));
            case self::TYPE_PATH:
                return implode('/', $parts);
            case self::TYPE_URL:
                return strtolower(implode('/', $parts));
            case self::TYPE_CSS_IDENTIFIER:
            case self::TYPE_ANGULAR_TAG:
                return strtolower(implode('-', $parts));
            case self::TYPE_ANGULAR_MODULE:
                return strtolower(implode('.', $parts));
            default:
                throw new DomainException("Please use one of the `TYPE_` constants on the `Codger\Generate\Language` class as 2nd parameter.");
        }
    }
public static function convert(string $input, int $to) : string
    {
        $string = self::normalize($input);
        $parts = explode(' ', $string);
        array_walk($parts, function (&$part) {
            $part = ucfirst($part);
        });
        switch ($to) {
            case self::TYPE_NAMESPACE:
                return implode('\\', $parts);
            case self::TYPE_TABLE:
                return strtolower(implode('_', $parts));
            case self::TYPE_VARIABLE:
            case self::TYPE_ANGULAR_COMPONENT:
                return lcfirst(implode('', $parts));
            case self::TYPE_PATH:
                return implode('/', $parts);
            case self::TYPE_URL:
                return strtolower(implode('/', $parts));
            case self::TYPE_CSS_IDENTIFIER:
            case self::TYPE_ANGULAR_TAG:
                return strtolower(implode('-', $parts));
            case self::TYPE_ANGULAR_MODULE:
                return strtolower(implode('.', $parts));
            default:
                throw new DomainException("Please use one of the `TYPE_` constants on the `Codger\Generate\Language` class as 2nd parameter.");
        }
    }
public static function convert ( string $ input , int $ to ) : string { $ string = self :: normalize ( $ input ) ; $ parts = explode ( ' ' , $ string ) ; array_walk ( $ parts , function ( & $ part ) { $ part = ucfirst ( $ part ) ; } ) ; switch ( $ to ) { case self :: TYPE_NAMESPACE : return implode ( '\\' , $ parts ) ; case self :: TYPE_TABLE : return strtolower ( implode ( '_' , $ parts ) ) ; case self :: TYPE_VARIABLE : case self :: TYPE_ANGULAR_COMPONENT : return lcfirst ( implode ( '' , $ parts ) ) ; case self :: TYPE_PATH : return implode ( '/' , $ parts ) ; case self :: TYPE_URL : return strtolower ( implode ( '/' , $ parts ) ) ; case self :: TYPE_CSS_IDENTIFIER : case self :: TYPE_ANGULAR_TAG : return strtolower ( implode ( '-' , $ parts ) ) ; case self :: TYPE_ANGULAR_MODULE : return strtolower ( implode ( '.' , $ parts ) ) ; default : throw new DomainException ( "Please use one of the `TYPE_` constants on the `Codger\Generate\Language` class as 2nd parameter." ) ; } }
Convert input string to a different "format".

@param string $input
@param int $to Use one of the `TYPE_` constants defined on
`Codger\Php\Language`.
@return string
Convert input string to a different format .