private function parseIntoParts(string $string) : array
    {
        $parts            = [];
        $currentType      = self::TYPE_PROPERTY;
        $currentName      = '';
        $currentParam     = '';
        $currentParams    = [];
        $parenthesisCount = 0;

        foreach (str_split($string) as $key => $char) {

            if ($char === '(') {
                if (!$currentName) {
                    throw BaseException::format('unexpected \'(\', must be following method name');
                }

                if ($currentParam) {
                    $currentParam .= '(';
                }

                $parenthesisCount++;
                $currentType = self::TYPE_METHOD;
            } //
            elseif ($char === ',' && $parenthesisCount <= 1) {
                if ($parenthesisCount === 0) {
                    throw BaseException::format('unexpected \',\', must be within parenthesis');
                }

                $currentParams[] = trim($currentParam);
                $currentParam    = '';
            } //
            elseif ($char === ')') {
                if ($parenthesisCount === 0) {
                    throw BaseException::format('unexpected \')\', does not match opening parenthesis');
                }

                if ($parenthesisCount === 1) {
                    if ($currentParam) {
                        $currentParams[] = trim($currentParam);
                    }
                } else {
                    $currentParam .= ')';
                }

                $parenthesisCount--;
            } //
            elseif ($char === '.' && $parenthesisCount === 0) {
                $parts[] = [
                    $currentType,
                    $currentName,
                    $currentParams
                ];

                $currentType   = self::TYPE_PROPERTY;
                $currentName   = '';
                $currentParam  = '';
                $currentParams = [];
            } //
            else {
                if ($parenthesisCount === 0) {
                    $currentName .= $char;
                } else {
                    $currentParam .= $char;
                }
            }
        }

        if ($parenthesisCount > 0) {
            throw BaseException::format('unexpected end of string, unbalanced \'(\' opening parenthesis');
        }

        if (!isset($char) || $char === '.') {
            throw BaseException::format('unexpected end of string, member name cannot be empty');
        }

        if ($currentName) {
            $parts[] = [
                $currentType,
                $currentName,
                $currentParams
            ];
        }

        return $parts;
    }
private function parseIntoParts(string $string) : array
    {
        $parts            = [];
        $currentType      = self::TYPE_PROPERTY;
        $currentName      = '';
        $currentParam     = '';
        $currentParams    = [];
        $parenthesisCount = 0;

        foreach (str_split($string) as $key => $char) {

            if ($char === '(') {
                if (!$currentName) {
                    throw BaseException::format('unexpected \'(\', must be following method name');
                }

                if ($currentParam) {
                    $currentParam .= '(';
                }

                $parenthesisCount++;
                $currentType = self::TYPE_METHOD;
            } //
            elseif ($char === ',' && $parenthesisCount <= 1) {
                if ($parenthesisCount === 0) {
                    throw BaseException::format('unexpected \',\', must be within parenthesis');
                }

                $currentParams[] = trim($currentParam);
                $currentParam    = '';
            } //
            elseif ($char === ')') {
                if ($parenthesisCount === 0) {
                    throw BaseException::format('unexpected \')\', does not match opening parenthesis');
                }

                if ($parenthesisCount === 1) {
                    if ($currentParam) {
                        $currentParams[] = trim($currentParam);
                    }
                } else {
                    $currentParam .= ')';
                }

                $parenthesisCount--;
            } //
            elseif ($char === '.' && $parenthesisCount === 0) {
                $parts[] = [
                    $currentType,
                    $currentName,
                    $currentParams
                ];

                $currentType   = self::TYPE_PROPERTY;
                $currentName   = '';
                $currentParam  = '';
                $currentParams = [];
            } //
            else {
                if ($parenthesisCount === 0) {
                    $currentName .= $char;
                } else {
                    $currentParam .= $char;
                }
            }
        }

        if ($parenthesisCount > 0) {
            throw BaseException::format('unexpected end of string, unbalanced \'(\' opening parenthesis');
        }

        if (!isset($char) || $char === '.') {
            throw BaseException::format('unexpected end of string, member name cannot be empty');
        }

        if ($currentName) {
            $parts[] = [
                $currentType,
                $currentName,
                $currentParams
            ];
        }

        return $parts;
    }
private function parseIntoParts ( string $ string ) : array { $ parts = [ ] ; $ currentType = self :: TYPE_PROPERTY ; $ currentName = '' ; $ currentParam = '' ; $ currentParams = [ ] ; $ parenthesisCount = 0 ; foreach ( str_split ( $ string ) as $ key => $ char ) { if ( $ char === '(' ) { if ( ! $ currentName ) { throw BaseException :: format ( 'unexpected \'(\', must be following method name' ) ; } if ( $ currentParam ) { $ currentParam .= '(' ; } $ parenthesisCount ++ ; $ currentType = self :: TYPE_METHOD ; } // elseif ( $ char === ',' && $ parenthesisCount <= 1 ) { if ( $ parenthesisCount === 0 ) { throw BaseException :: format ( 'unexpected \',\', must be within parenthesis' ) ; } $ currentParams [ ] = trim ( $ currentParam ) ; $ currentParam = '' ; } // elseif ( $ char === ')' ) { if ( $ parenthesisCount === 0 ) { throw BaseException :: format ( 'unexpected \')\', does not match opening parenthesis' ) ; } if ( $ parenthesisCount === 1 ) { if ( $ currentParam ) { $ currentParams [ ] = trim ( $ currentParam ) ; } } else { $ currentParam .= ')' ; } $ parenthesisCount -- ; } // elseif ( $ char === '.' && $ parenthesisCount === 0 ) { $ parts [ ] = [ $ currentType , $ currentName , $ currentParams ] ; $ currentType = self :: TYPE_PROPERTY ; $ currentName = '' ; $ currentParam = '' ; $ currentParams = [ ] ; } // else { if ( $ parenthesisCount === 0 ) { $ currentName .= $ char ; } else { $ currentParam .= $ char ; } } } if ( $ parenthesisCount > 0 ) { throw BaseException :: format ( 'unexpected end of string, unbalanced \'(\' opening parenthesis' ) ; } if ( ! isset ( $ char ) || $ char === '.' ) { throw BaseException :: format ( 'unexpected end of string, member name cannot be empty' ) ; } if ( $ currentName ) { $ parts [ ] = [ $ currentType , $ currentName , $ currentParams ] ; } return $ parts ; }
Parses the expression string into an array format.

Example:
<code>
'some.method(param, abc).foo'
</code>
Becomes:
<code>
[
[self::TYPE_PROPERTY, 'some', []],
[self::TYPE_METHOD, 'method', ['param', 'abc']],
[self::TYPE_PROPERTY, 'foo'],
]
</code>

@param string $string

@return array
@throws BaseException
Parses the expression string into an array format .