public function toCamelCase($upperFirst = false)
    {
        $camelCase = $this->trim()->lowerCaseFirst();

        $camelCase = preg_replace('/^[-_]+/', '', (string)$camelCase);

        $camelCase = preg_replace_callback
        (
            '/[-_\s]+(.)?/u',
            function ($match)
            {
                if (isset($match[1]))
                {
                    return UTF8::strtoupper($match[1], $this->encoding);
                }
                else
                {
                    return '';
                }
            },
            $camelCase
        );

        $camelCase = preg_replace_callback
        (
            '/[\d]+(.)?/u',
            function ($match)
            {
                return UTF8::strtoupper($match[0], $this->encoding);
            },
            $camelCase
        );

        $camelCase = $this->newSelf($camelCase);

        if ($upperFirst === true) $camelCase = $camelCase->upperCaseFirst();

        return $camelCase;
    }
public function toCamelCase($upperFirst = false)
    {
        $camelCase = $this->trim()->lowerCaseFirst();

        $camelCase = preg_replace('/^[-_]+/', '', (string)$camelCase);

        $camelCase = preg_replace_callback
        (
            '/[-_\s]+(.)?/u',
            function ($match)
            {
                if (isset($match[1]))
                {
                    return UTF8::strtoupper($match[1], $this->encoding);
                }
                else
                {
                    return '';
                }
            },
            $camelCase
        );

        $camelCase = preg_replace_callback
        (
            '/[\d]+(.)?/u',
            function ($match)
            {
                return UTF8::strtoupper($match[0], $this->encoding);
            },
            $camelCase
        );

        $camelCase = $this->newSelf($camelCase);

        if ($upperFirst === true) $camelCase = $camelCase->upperCaseFirst();

        return $camelCase;
    }
public function toCamelCase ( $ upperFirst = false ) { $ camelCase = $ this -> trim ( ) -> lowerCaseFirst ( ) ; $ camelCase = preg_replace ( '/^[-_]+/' , '' , ( string ) $ camelCase ) ; $ camelCase = preg_replace_callback ( '/[-_\s]+(.)?/u' , function ( $ match ) { if ( isset ( $ match [ 1 ] ) ) { return UTF8 :: strtoupper ( $ match [ 1 ] , $ this -> encoding ) ; } else { return '' ; } } , $ camelCase ) ; $ camelCase = preg_replace_callback ( '/[\d]+(.)?/u' , function ( $ match ) { return UTF8 :: strtoupper ( $ match [ 0 ] , $ this -> encoding ) ; } , $ camelCase ) ; $ camelCase = $ this -> newSelf ( $ camelCase ) ; if ( $ upperFirst === true ) $ camelCase = $ camelCase -> upperCaseFirst ( ) ; return $ camelCase ; }
Returns a camelCase version of the string.

Trims surrounding spaces, capitalizes letters following digits, spaces,
dashes & underscores and removes spaces & dashes as well as underscores.

@param  bool    $upperFirst If true, the first char will be UPPERCASE.

@return static
Returns a camelCase version of the string .