/**
  * Find translations in the source code.
  * The parser if looking for the *translate* or * translateContext* methods.
  */
 protected function findTranslations()
 {
     $php_files = array();
     foreach ($this->source_code_paths as $path) {
         $php_files = array_merge($php_files, $this->glob_recursive($path . '/*.php') ?: array());
     }
     foreach ($php_files as $php_file) {
         $code = file_get_contents($php_file);
         $php_scanner = new PhpFunctionsScanner($code);
         foreach ($php_scanner->getFunctions() as $function) {
             if ($function[0] == 'translate' || $function[0] == 'translateContext') {
                 $args = $function[2];
                 if ($args && count($args) > 0) {
                     $msgid = md5($args[0]);
                     if (!isset($this->translations_found[$msgid])) {
                         $this->translations_found[$msgid] = array('text' => $args[0], 'references' => array());
                     }
                     $this->translations_found[$msgid]['references'][] = substr($php_file, strlen(WT_ROOT)) . ':' . $function[1];
                 }
             }
         }
     }
 }