/**
  * Parse given files for phrase
  *
  * @param string $file
  * @return void
  */
 public function parse($file)
 {
     $this->_phrases = [];
     $this->_file = $file;
     $this->_tokenizer->parse($file);
     while (!$this->_tokenizer->isEndOfLoop()) {
         $this->_extractPhrases();
     }
 }
Esempio n. 2
0
 /**
  * @covers \Magento\Tools\I18n\Parser\Adapter\Php\Tokenizer::isEndOfLoop
  */
 public function testIsEndOfLoop()
 {
     $this->parseFile();
     //We have 27 total tokens in objectsCode.php file (excluding whitespaces)
     //So the isEndOfLoop function should return true after we pick 28th non-existent token
     for ($i = 0; $i < 28; $i += 1) {
         $this->assertFalse($this->tokenizer->isEndOfLoop());
         $this->tokenizer->getNextRealToken();
     }
     $this->assertTrue($this->tokenizer->isEndOfLoop());
 }