src/main/php/DataDo/Data/Parser/DefaultMethodNameParser.php
private function getTokens($methodName)
    {
        preg_match_all('([A-Z_-][^A-Z_-]*)', $methodName, $rawTokens);
        $result = array();
        $lastToken = null;
        $seenBy = false;
        foreach ($rawTokens[0] as $token) {
            $newToken = $this->getToken($token, $seenBy);

            if ($newToken instanceof ValueToken) {
                $lastToken = $lastToken !== null && $lastToken instanceof ValueToken ?
                    new ValueToken($lastToken->getSource() . $newToken->getSource()) :
                    $newToken;
            } else {
                if ($lastToken instanceof ValueToken) {
                    // Add the last token too
                    $result[] = $lastToken;
                    $lastToken = null;
                }
                $result[] = $newToken;
            }
        }

        if ($lastToken !== null) {
            $result[] = $lastToken;
        }


        return $result;
    }
private function getTokens($methodName)
    {
        preg_match_all('([A-Z_-][^A-Z_-]*)', $methodName, $rawTokens);
        $result = array();
        $lastToken = null;
        $seenBy = false;
        foreach ($rawTokens[0] as $token) {
            $newToken = $this->getToken($token, $seenBy);

            if ($newToken instanceof ValueToken) {
                $lastToken = $lastToken !== null && $lastToken instanceof ValueToken ?
                    new ValueToken($lastToken->getSource() . $newToken->getSource()) :
                    $newToken;
            } else {
                if ($lastToken instanceof ValueToken) {
                    // Add the last token too
                    $result[] = $lastToken;
                    $lastToken = null;
                }
                $result[] = $newToken;
            }
        }

        if ($lastToken !== null) {
            $result[] = $lastToken;
        }


        return $result;
    }
private function getTokens ( $ methodName ) { preg_match_all ( '([A-Z_-][^A-Z_-]*)' , $ methodName , $ rawTokens ) ; $ result = array ( ) ; $ lastToken = null ; $ seenBy = false ; foreach ( $ rawTokens [ 0 ] as $ token ) { $ newToken = $ this -> getToken ( $ token , $ seenBy ) ; if ( $ newToken instanceof ValueToken ) { $ lastToken = $ lastToken !== null && $ lastToken instanceof ValueToken ? new ValueToken ( $ lastToken -> getSource ( ) . $ newToken -> getSource ( ) ) : $ newToken ; } else { if ( $ lastToken instanceof ValueToken ) { // Add the last token too $ result [ ] = $ lastToken ; $ lastToken = null ; } $ result [ ] = $ newToken ; } } if ( $ lastToken !== null ) { $ result [ ] = $ lastToken ; } return $ result ; }
Split the method name into tokens and parse them.
@param $methodName string the method name
@return Token[]
Split the method name into tokens and parse them .