public static function splitFunctionName(
        $functionName)
    {
        // Split the input on the FIRST encountered NON-LOWERCAZE ("a-z")
        // character. And allow empty splits (that's important). Because of the
        // fact that it splits on non-lowercase character types, it means that
        // if there are 2 chunks then we KNOW that there was a non-lowercase
        // character (such as _, 0-9, A-Z, etc) in the input. And if there are
        // two chunks but the first chunk is an empty string then we know that
        // there was no lowercase a-z PREFIX in the input. And if there is only
        // 1 chunk then we know the entire input was all-lowercase a-z.
        //
        // Examples of this preg_split()'s behavior:
        //
        // "get_" => 2 chunks: "get" & "_"
        // "getgetX" => 2 chunks: "getget" & "X"
        // "eraseSomething" => 2 chunks: "erase" & "Something"
        // "getgetget" (only lowercase a-z) => 1 chunk: "getgetget"
        // "GetSomething" (no lowercase prefix) => 2 chunks: "" & "GetSomething"
        // "G" => 2 chunks: "" & "G"
        // "GX" => 2 chunks: "" & "GX"
        // "Gx" => 2 chunks: "" & "Gx"
        // "0" => 2 chunks: "" & "0"
        // "gx" => 1 chunk: "gx"
        // "gX" => 2 chunks: "g" & "X"
        // "g0" => 2 chunks: "g" & "0"
        // "" (empty string input) => 1 chunk: ""
        //
        // Therefore, we know that the input was valid (a lowercase a-z prefix
        // followed by at least one non-lowercase a-z after that) if we have two
        // chunks and the first chunk is non-empty!
        $chunks = preg_split('/(?=[^a-z])/', $functionName, 2);
        if (count($chunks) === 2 && $chunks[0] !== '') {
            // [0] = prefix (functionType), [1] = suffix (FuncCase).
            return $chunks;
        }

        // Invalid input. Return NULL prefix and NULL suffix values.
        static $invalidChunks = [null, null]; // Static=Only created first call.

        return $invalidChunks;
    }
public static function splitFunctionName(
        $functionName)
    {
        // Split the input on the FIRST encountered NON-LOWERCAZE ("a-z")
        // character. And allow empty splits (that's important). Because of the
        // fact that it splits on non-lowercase character types, it means that
        // if there are 2 chunks then we KNOW that there was a non-lowercase
        // character (such as _, 0-9, A-Z, etc) in the input. And if there are
        // two chunks but the first chunk is an empty string then we know that
        // there was no lowercase a-z PREFIX in the input. And if there is only
        // 1 chunk then we know the entire input was all-lowercase a-z.
        //
        // Examples of this preg_split()'s behavior:
        //
        // "get_" => 2 chunks: "get" & "_"
        // "getgetX" => 2 chunks: "getget" & "X"
        // "eraseSomething" => 2 chunks: "erase" & "Something"
        // "getgetget" (only lowercase a-z) => 1 chunk: "getgetget"
        // "GetSomething" (no lowercase prefix) => 2 chunks: "" & "GetSomething"
        // "G" => 2 chunks: "" & "G"
        // "GX" => 2 chunks: "" & "GX"
        // "Gx" => 2 chunks: "" & "Gx"
        // "0" => 2 chunks: "" & "0"
        // "gx" => 1 chunk: "gx"
        // "gX" => 2 chunks: "g" & "X"
        // "g0" => 2 chunks: "g" & "0"
        // "" (empty string input) => 1 chunk: ""
        //
        // Therefore, we know that the input was valid (a lowercase a-z prefix
        // followed by at least one non-lowercase a-z after that) if we have two
        // chunks and the first chunk is non-empty!
        $chunks = preg_split('/(?=[^a-z])/', $functionName, 2);
        if (count($chunks) === 2 && $chunks[0] !== '') {
            // [0] = prefix (functionType), [1] = suffix (FuncCase).
            return $chunks;
        }

        // Invalid input. Return NULL prefix and NULL suffix values.
        static $invalidChunks = [null, null]; // Static=Only created first call.

        return $invalidChunks;
    }
public static function splitFunctionName ( $ functionName ) { // Split the input on the FIRST encountered NON-LOWERCAZE ("a-z") // character. And allow empty splits (that's important). Because of the // fact that it splits on non-lowercase character types, it means that // if there are 2 chunks then we KNOW that there was a non-lowercase // character (such as _, 0-9, A-Z, etc) in the input. And if there are // two chunks but the first chunk is an empty string then we know that // there was no lowercase a-z PREFIX in the input. And if there is only // 1 chunk then we know the entire input was all-lowercase a-z. // // Examples of this preg_split()'s behavior: // // "get_" => 2 chunks: "get" & "_" // "getgetX" => 2 chunks: "getget" & "X" // "eraseSomething" => 2 chunks: "erase" & "Something" // "getgetget" (only lowercase a-z) => 1 chunk: "getgetget" // "GetSomething" (no lowercase prefix) => 2 chunks: "" & "GetSomething" // "G" => 2 chunks: "" & "G" // "GX" => 2 chunks: "" & "GX" // "Gx" => 2 chunks: "" & "Gx" // "0" => 2 chunks: "" & "0" // "gx" => 1 chunk: "gx" // "gX" => 2 chunks: "g" & "X" // "g0" => 2 chunks: "g" & "0" // "" (empty string input) => 1 chunk: "" // // Therefore, we know that the input was valid (a lowercase a-z prefix // followed by at least one non-lowercase a-z after that) if we have two // chunks and the first chunk is non-empty! $ chunks = preg_split ( '/(?=[^a-z])/' , $ functionName , 2 ) ; if ( count ( $ chunks ) === 2 && $ chunks [ 0 ] !== '' ) { // [0] = prefix (functionType), [1] = suffix (FuncCase). return $ chunks ; } // Invalid input. Return NULL prefix and NULL suffix values. static $ invalidChunks = [ null , null ] ; // Static=Only created first call. return $ invalidChunks ; }
Split a function name into its function-type and FuncCase components.

This helper function takes care of splitting a full function name, such
as `getSomeVariable`, into `get` (its function type) and `SomeVariable`
(the valid input format for the FunctionTranslation constructor).

Call it from your own code before constructing your `FunctionTranslation`
objects. Don't worry about the extra function call for this splitter.
It can perform its job 2.5 million times per second on a 2010 Core i7
dual-core laptop on PHP7, and 0.64 million times per second on PHP5.
And directly embedding these same steps instead of calling this function
will only gain 5% more speed in PHP7 and 16% more speed in PHP5. But the
numbers are already so astronomically fast that it doesn't matter!

This splitting into `get` and `SomeVariable` is easy and super efficient.
It is this class' final translation of the FunctionCase `SomeVariable`
part into `some_variable` and `someVariable` properties that's the HARD
step which should be cached.

Recommended usage:

```php
list($functionType, $funcCase) = FunctionTranslation::splitFunctionName($name);
// if $functionType is now NULL, the input was invalid. otherwise it was ok.
```

@param string $functionName The function name to split. It's your job to
make sure this is a string-type variable! We
will not validate its type. Empty strings ok.

@return string[]|null[] Two-element array of `functionType` (element 0) &
`funcCase` (element 1). If the input name wasn't
valid a `doSomething` (function-camelCase), then
both elements are `NULL` instead of strings.
Split a function name into its function - type and FuncCase components .