/** * Looks for class names in a PHP code * * @param string File to scan for class name. * @todo Reine PHP Alternative um Klassen zu erkennen (RegExp) */ private function parse($filepath) { $file = new File($filepath); if ($file->exists() == true) { $code = $file->read(); $tokens = @token_get_all($code); foreach ($tokens as $token) { if (!isset($token[0])) { continue; } // next token after this one is our desired class name if ($token[0] == T_CLASS) { $this->next = true; } if ($token[0] == T_STRING && $this->next === true) { if (isset($this->data[$token[1]]) == true) { Core::throwError('Class with name "' . $token[1] . '" was found more than once. Only file "' . $file->absPath() . '" has been indexed!', INTERNAL_NOTICE); } $this->data[$token[1]] = $file->relPath(); $this->next = false; } } } }