Exemplo n.º 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;
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function __invoke(ProviderInterface $Provider)
 {
     if (!$Provider->isShallow()) {
         $method = strtolower($Provider->getName());
         if (method_exists($this, $method)) {
             return $this->{$method}($Provider);
         }
     }
     return true;
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
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;
 }