/** * (non-PHPdoc) * @see IState::checkLine() */ public function checkLine(PhpLibraryCheckResult $result, $file_path, $str_line, $i) { // remove one line // comments $str_line = preg_replace('#\\/\\/.*$#', '', $str_line); // remove one line /* */ comments $str_line = preg_replace('#\\/\\*.*?\\*\\/#', '', $str_line); if (strpos($str_line, '/*') !== false) { // enter comment mode. remove comment part, // then setup for entering comment mode $str_line = preg_replace('#\\/\\*.*$#', '', $str_line); $changestate = true; } else { $changestate = false; } // performance. do not check if the line cannot contain function names if (strlen(trim($str_line)) > 1) { foreach ($this->checker->getLibraryList() as $library) { $checks = $library->checkLine($str_line); foreach ($checks as $check) { $result->addCheck($library, $file_path, $i, $check); } } } if ($changestate) { $this->checker->setState(new PhpLibraryCommentState($this->checker)); } }
/** * (non-PHPdoc) * @see IDumper::dumpCheckResult() */ public function dumpCheckResult(PhpLibraryCheckResult $result) { echo "\n\n"; $checksets = $result->getCheckSets(); $count = count($checksets); echo $count . ($count === 1 ? ' library was' : ' libraries were') . " used.\n"; foreach ($checksets as $checkset) { $checkset->dump($this); echo "\n"; } echo "configure option :\n"; echo "./configure "; foreach ($checksets as $checkset) { echo $checkset->getConfigureOption() . " "; } echo "\n\n"; }