getConfiguration() public method

Get the configuration object.
public getConfiguration ( ) : Configuration
return Configuration
示例#1
0
文件: Context.php 项目: ovr/phpsa
 /**
  * Creates a notice message.
  *
  * @param string $type
  * @param string $message
  * @param \PhpParser\NodeAbstract $expr
  * @param int $status
  * @return bool
  */
 public function notice($type, $message, \PhpParser\NodeAbstract $expr, $status = Check::CHECK_SAFE)
 {
     $analyzerConfig = $this->application->getConfiguration()->getValue('analyzers');
     if ($type == "language_error" && !$analyzerConfig['language_error']['enabled']) {
         return true;
     }
     $filepath = $this->filepath;
     $code = file($filepath);
     $this->output->writeln('<comment>Notice:  ' . $message . " in {$filepath} on {$expr->getLine()} [{$type}]</comment>");
     $this->output->writeln('');
     if ($this->application->getConfiguration()->valueIsTrue('blame')) {
         exec("git blame --show-email -L {$expr->getLine()},{$expr->getLine()} " . $filepath, $result);
         if ($result && isset($result[0])) {
             $result[0] = trim($result[0]);
             $this->output->writeln("<comment>\t {$result[0]}</comment>");
         }
     } else {
         $code = trim($code[$expr->getLine() - 1]);
         $this->output->writeln("<comment>\t {$code} </comment>");
     }
     $this->output->writeln('');
     $issueCollector = $this->application->getIssuesCollector();
     $issueCollector->addIssue(new Issue($type, $message, new IssueLocation($this->filepath, $expr->getLine() - 1)));
     return true;
 }
示例#2
0
 /**
  * @param $type
  * @param $message
  * @param \PhpParser\NodeAbstract $expr
  * @return bool
  */
 public function notice($type, $message, \PhpParser\NodeAbstract $expr)
 {
     $code = file($this->scope->getFilepath());
     $this->output->writeln('<comment>Notice:  ' . $message . " in {$this->scope->getFilepath()} on {$expr->getLine()} [{$type}]</comment>");
     $this->output->writeln('');
     if ($this->application->getConfiguration()->valueIsTrue('blame')) {
         exec("git blame --show-email -L {$expr->getLine()},{$expr->getLine()} " . $this->scope->getFilepath(), $result);
         if ($result && isset($result[0])) {
             $result[0] = trim($result[0]);
             $this->output->writeln("<comment>\t {$result[0]}</comment>");
         }
     } else {
         $code = trim($code[$expr->getLine() - 1]);
         $this->output->writeln("<comment>\t {$code} </comment>");
     }
     $this->output->writeln('');
     unset($code);
     return true;
 }
示例#3
0
 /**
  * @covers \PHPSA\Application::getConfiguration
  */
 public function testGetConfiguration()
 {
     $application = new Application();
     $this->assertInstanceOf('\\PHPSA\\Configuration', $application->getConfiguration());
 }