/** * 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 extractObjectPhrase(Token $firstToken) { if ($firstToken->isNew() && $this->_tokenizer->isMatchingClass('Phrase')) { $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; }
/** * 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(); }