protected function parseTokens($tokens, MessageCatalogue $catalog)
    {
        $tokenIterator = new \ArrayIterator($tokens);

        for ($key = 0; $key < $tokenIterator->count(); ++$key) {
            foreach ($this->sequences as $sequence) {
                $message = '';
                $domain = 'messages';
                $tokenIterator->seek($key);

                foreach ($sequence as $sequenceKey => $item) {
                    $this->seekToNextRelevantToken($tokenIterator);

                    if ($this->normalizeToken($tokenIterator->current()) === $item) {
                        $tokenIterator->next();
                        continue;
                    } elseif (self::MESSAGE_TOKEN === $item) {
                        $message = $this->getValue($tokenIterator);

                        if (\count($sequence) === ($sequenceKey + 1)) {
                            break;
                        }
                    } elseif (self::METHOD_ARGUMENTS_TOKEN === $item) {
                        $this->skipMethodArgument($tokenIterator);
                    } elseif (self::DOMAIN_TOKEN === $item) {
                        $domainToken = $this->getValue($tokenIterator);
                        if ('' !== $domainToken) {
                            $domain = $domainToken;
                        }

                        break;
                    } else {
                        break;
                    }
                }

                if ($message) {
                    $catalog->set($message, $this->prefix.$message, $domain);
                    break;
                }
            }
        }
    }
protected function parseTokens($tokens, MessageCatalogue $catalog)
    {
        $tokenIterator = new \ArrayIterator($tokens);

        for ($key = 0; $key < $tokenIterator->count(); ++$key) {
            foreach ($this->sequences as $sequence) {
                $message = '';
                $domain = 'messages';
                $tokenIterator->seek($key);

                foreach ($sequence as $sequenceKey => $item) {
                    $this->seekToNextRelevantToken($tokenIterator);

                    if ($this->normalizeToken($tokenIterator->current()) === $item) {
                        $tokenIterator->next();
                        continue;
                    } elseif (self::MESSAGE_TOKEN === $item) {
                        $message = $this->getValue($tokenIterator);

                        if (\count($sequence) === ($sequenceKey + 1)) {
                            break;
                        }
                    } elseif (self::METHOD_ARGUMENTS_TOKEN === $item) {
                        $this->skipMethodArgument($tokenIterator);
                    } elseif (self::DOMAIN_TOKEN === $item) {
                        $domainToken = $this->getValue($tokenIterator);
                        if ('' !== $domainToken) {
                            $domain = $domainToken;
                        }

                        break;
                    } else {
                        break;
                    }
                }

                if ($message) {
                    $catalog->set($message, $this->prefix.$message, $domain);
                    break;
                }
            }
        }
    }
protected function parseTokens ( $ tokens , MessageCatalogue $ catalog ) { $ tokenIterator = new \ ArrayIterator ( $ tokens ) ; for ( $ key = 0 ; $ key < $ tokenIterator -> count ( ) ; ++ $ key ) { foreach ( $ this -> sequences as $ sequence ) { $ message = '' ; $ domain = 'messages' ; $ tokenIterator -> seek ( $ key ) ; foreach ( $ sequence as $ sequenceKey => $ item ) { $ this -> seekToNextRelevantToken ( $ tokenIterator ) ; if ( $ this -> normalizeToken ( $ tokenIterator -> current ( ) ) === $ item ) { $ tokenIterator -> next ( ) ; continue ; } elseif ( self :: MESSAGE_TOKEN === $ item ) { $ message = $ this -> getValue ( $ tokenIterator ) ; if ( \ count ( $ sequence ) === ( $ sequenceKey + 1 ) ) { break ; } } elseif ( self :: METHOD_ARGUMENTS_TOKEN === $ item ) { $ this -> skipMethodArgument ( $ tokenIterator ) ; } elseif ( self :: DOMAIN_TOKEN === $ item ) { $ domainToken = $ this -> getValue ( $ tokenIterator ) ; if ( '' !== $ domainToken ) { $ domain = $ domainToken ; } break ; } else { break ; } } if ( $ message ) { $ catalog -> set ( $ message , $ this -> prefix . $ message , $ domain ) ; break ; } } } }
Extracts trans message from PHP tokens.

@param array            $tokens
@param MessageCatalogue $catalog
Extracts trans message from PHP tokens .