public static function toCase($string, $case)
    {
        switch ($case) {
            case self::UPPER:
                $string = mb_strtoupper($string);
                break;
            case self::LOWER:
                $string = mb_strtolower($string);
                break;
            case self::UPPER_FIRST:
                $string = mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1);
                break;
            case self::UPPER_WORDS:
                $string = mb_convert_case($string, MB_CASE_TITLE);
                break;
            case self::NONE:
                break;
            default:
                throw new InvalidArgumentException("Cannot set case {$case}");
        }

        return $string;
    }
public static function toCase($string, $case)
    {
        switch ($case) {
            case self::UPPER:
                $string = mb_strtoupper($string);
                break;
            case self::LOWER:
                $string = mb_strtolower($string);
                break;
            case self::UPPER_FIRST:
                $string = mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1);
                break;
            case self::UPPER_WORDS:
                $string = mb_convert_case($string, MB_CASE_TITLE);
                break;
            case self::NONE:
                break;
            default:
                throw new InvalidArgumentException("Cannot set case {$case}");
        }

        return $string;
    }
public static function toCase ( $ string , $ case ) { switch ( $ case ) { case self :: UPPER : $ string = mb_strtoupper ( $ string ) ; break ; case self :: LOWER : $ string = mb_strtolower ( $ string ) ; break ; case self :: UPPER_FIRST : $ string = mb_strtoupper ( mb_substr ( $ string , 0 , 1 ) ) . mb_substr ( $ string , 1 ) ; break ; case self :: UPPER_WORDS : $ string = mb_convert_case ( $ string , MB_CASE_TITLE ) ; break ; case self :: NONE : break ; default : throw new InvalidArgumentException ( "Cannot set case {$case}" ) ; } return $ string ; }
Convert case of a string.

@param string $string
@param string $case

@return string
@throws InvalidArgumentException
Convert case of a string .