src/Parser/FieldParser.php
private function bundleTokens(array $tokenList, $targetToken)
    {
        $bundleList = array();
        $bundle = array();

        foreach ($tokenList as $token) {
            // On token match add the bundle to list & re-initialize empty bundle
            if ($targetToken === $token) {
                $bundleList[] = $bundle;
                $bundle = array();

            // Otherwise collect tokens
            } else {
                $bundle[] = $token;
            }
        }

        // Handle trailing type
        $bundleList[] = $bundle;

        // Remove empty types
        $bundleList = array_filter($bundleList);

        return $bundleList;
    }
private function bundleTokens(array $tokenList, $targetToken)
    {
        $bundleList = array();
        $bundle = array();

        foreach ($tokenList as $token) {
            // On token match add the bundle to list & re-initialize empty bundle
            if ($targetToken === $token) {
                $bundleList[] = $bundle;
                $bundle = array();

            // Otherwise collect tokens
            } else {
                $bundle[] = $token;
            }
        }

        // Handle trailing type
        $bundleList[] = $bundle;

        // Remove empty types
        $bundleList = array_filter($bundleList);

        return $bundleList;
    }
private function bundleTokens ( array $ tokenList , $ targetToken ) { $ bundleList = array ( ) ; $ bundle = array ( ) ; foreach ( $ tokenList as $ token ) { // On token match add the bundle to list & re-initialize empty bundle if ( $ targetToken === $ token ) { $ bundleList [ ] = $ bundle ; $ bundle = array ( ) ; // Otherwise collect tokens } else { $ bundle [ ] = $ token ; } } // Handle trailing type $ bundleList [ ] = $ bundle ; // Remove empty types $ bundleList = array_filter ( $ bundleList ) ; return $ bundleList ; }
Splits token list up into one bundle per variant for later processing.

@param array<string> $tokenList
@param string $targetToken The token to split the list up by.

@return array<array<string>> an array of arrays - the child array contains the tokens for a single variant.
Splits token list up into one bundle per variant for later processing .