コード例 #1
0
ファイル: LintCommand.php プロジェクト: sclable/xml-lint
 /**
  * @inheritdoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->start = microtime(true);
     $this->output = $output;
     $this->input = $input;
     if ($input->getOption(self::OPTION_NO_XSD)) {
         $this->validator = ValidationFactory::createLintOnlyValidation();
     } else {
         $this->validator = ValidationFactory::createDefaultCollection();
     }
     $file = $input->getArgument(self::ARGUMENT_FILE);
     $output->writeln('progress: ');
     if (is_dir($file)) {
         $status = $this->lintDir($file);
     } else {
         $status = $this->lintFile(new \SplFileInfo($file));
     }
     $output->writeln('');
     if ($status === false) {
         $this->printReportsOfFilesWithProblems();
     }
     $this->output->writeln(sprintf(PHP_EOL . '%d files / %1.2f seconds <info>done</info>', count($this->reports), microtime(true) - $this->start));
     return $status ? 0 : 1;
 }
コード例 #2
0
 public function testDefaultCollection()
 {
     $collection = ValidationFactory::createDefaultCollection();
     $this->assertInstanceOf(ValidationInterface::class, $collection);
 }