/**
  * Check if token is translated function
  *
  * @param \Magento\Tools\I18n\Parser\Adapter\Php\Tokenizer\Token $token
  * @return bool
  */
 protected function _isTranslateFunction($token)
 {
     $nextToken = $this->_tokenizer->getNextRealToken();
     return $nextToken && $token->isEqualFunction('__') && $nextToken->isOpenBrace();
 }
 /**
  * @param Token $firstToken
  * @return bool
  */
 protected function extractMethodPhrase(Token $firstToken)
 {
     if ($firstToken->isEqualFunction('__')) {
         $secondToken = $this->_tokenizer->getNextRealToken();
         if ($secondToken && $secondToken->isOpenBrace()) {
             $arguments = $this->_tokenizer->getFunctionArgumentsTokens();
             $phrase = $this->_collectPhrase(array_shift($arguments));
             if (null !== $phrase) {
                 $this->_addPhrase($phrase, count($arguments), $this->_file, $firstToken->getLine());
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #3
0
 /**
  * Check if token is translated function
  *
  * @param \Magento\Tools\I18n\Parser\Adapter\Php\Tokenizer\Token $token
  * @return bool
  */
 protected function _isTranslateFunction($token)
 {
     return ($token->isEqualFunction('__') || $token->isWhitespace() && $this->_tokenizer->getNextToken()->isEqualFunction('__')) && $this->_tokenizer->getNextToken()->isOpenBrace();
 }