예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function __invoke(ProviderInterface $Provider)
 {
     $Provider->stash();
     $this->output(sprintf("running code sniffer on all %s files", implode(', ', $this->extensions)), false);
     $ret = true;
     foreach ($Provider->files as $File) {
         if (!$File->isValid($this->extensions, $this->paths)) {
             continue;
         }
         $extension = $File->getExtension();
         if (!isset($files[$extension])) {
             $files[$extension] = array();
         }
         $files[$extension][] = $File->getPathname();
     }
     foreach ($this->extensions as $extension) {
         if (empty($files[$extension])) {
             continue;
         }
         $this->standard = $this->standards[$extension];
         $this->setExecutable($this->executables[$extension]);
         if (!$this->{$extension}($files[$extension])) {
             $ret = false;
             if ($this->halt) {
                 $Provider->unstash();
                 return $ret;
             }
         }
     }
     if ($ret) {
         $this->output("\t\t\tOK");
     }
     $Provider->unstash();
     return true;
 }
예제 #2
0
파일: Monohook.php 프로젝트: jadb/monohook
 /**
  * Runs all attached processors.
  *
  * @return void
  */
 public function run()
 {
     $result = AbstractProcessor::PASS;
     $this->Provider->stash();
     foreach ((array) $this->processors as $processor) {
         if (!call_user_func($processor, $this->Provider)) {
             $result = AbstractProcessor::FAIL;
         }
     }
     $this->Provider->unstash();
     return $result;
 }
예제 #3
0
 /**
  * {@inheritdoc}
  */
 public function __invoke(ProviderInterface $Provider)
 {
     $Provider->stash();
     $this->output(sprintf("running phpunit tests on all %s files", implode(', ', $this->extensions)), false);
     $passes = $failures = array();
     $ret = true;
     foreach ($Provider->files as $File) {
         if (!$File->isValid($this->extensions, $this->paths)) {
             continue;
         }
         $test = false;
         if ($this->isTestFile($File)) {
             $test = $File->getPathname();
         } elseif ($this->autoSearch) {
             $test = $this->findTestFor($File);
         }
         if (!$test || in_array($test, $passes) || in_array($test, $failures)) {
             continue;
         }
         $cmd = escapeshellarg($test);
         $this->execute($cmd, $output, $return);
         if (0 != $return) {
             array_push($failures, $test);
             $this->output($output, true);
             $ret = false;
             if ($this->halt) {
                 $Provider->unstash();
                 return $ret;
             }
         } else {
             array_push($passes, $test);
         }
     }
     if ($ret) {
         $this->output("\t\t\t\tOK");
     }
     $Provider->unstash();
     return true;
 }