Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
MethodCollector.php
Go to the documentation of this file.
1 <?php
7 
9 
14 {
20  protected function _extractPhrases()
21  {
22  $token = $this->_tokenizer->getNextRealToken();
23  if ($token && $token->isObjectOperator()) {
24  $phraseStartToken = $this->_tokenizer->getNextRealToken();
25  if ($phraseStartToken && $this->_isTranslateFunction($phraseStartToken)) {
26  $arguments = $this->_tokenizer->getFunctionArgumentsTokens();
27  $phrase = $this->_collectPhrase(array_shift($arguments));
28  $this->_addPhrase($phrase, count($arguments), $this->_file, $phraseStartToken->getLine());
29  }
30  }
31  }
32 
39  protected function _isTranslateFunction($token)
40  {
41  $nextToken = $this->_tokenizer->getNextRealToken();
42  return $nextToken && $token->isEqualFunction('__') && $nextToken->isOpenBrace();
43  }
44 }
$arguments