/** * @codeCoverageIgnore * * @param ValidatorInterface $validator * @param Output $output * @return void */ protected function runValidator(ValidatorInterface $validator, Output $output) { // We don't want to run the validators in our unit tests. if (defined("ADVISER_UNDER_TEST")) { return null; } $output->write($this->indentation); $output->writeln("Running <comment>" . $validator->getName() . "</comment> validator..."); $startTime = microtime(true); $bag = $validator->handle(); // Display how many seconds it took to run this validator. $output->write($this->indentation); $output->write("Done in "); $output->write(round(microtime(true) - $startTime, 5)); $output->writeln(" seconds."); // Update the counters. $this->updateCounters($bag); $output->writeln(""); // Display the messages stored in the bag. foreach ($bag->getAll() as $message) { $output->write(str_repeat($this->indentation, 2)); $output->writeln($message->format()); } $output->writeln(""); }
/** * Run the given validator, pass the output to isMessageBag() and then return it. * * @param ValidatorInterface $validator * @return mixed */ protected function runValidator(ValidatorInterface $validator) { $value = $validator->handle(); $this->isMessageBag($value); return $value; }