/** * @param JobRegistry $registry */ public function runJobs(JobRegistry $registry) { while ($registry->count() > 0) { $job = $registry->getNewJob(); $this->runJob($job); $registry->markJobComplete($job); } }
/** * @param OutputInterface $output * @param SplFileInfo[] $files * * @return void */ private function watchForChanges(OutputInterface $output, array $files) { $output->writeln("Watching for changes"); $previously = []; while (true) { foreach ($files as $file) { /** @var SplFileInfo $file */ if ($this->checkFile($file->getRealPath(), $previously)) { $output->writeln(sprintf("<info>>>>></info> <comment>The following file changed:</comment> <info>%s</info>", $file->getPathname())); $this->getJobs(); $this->registry->addJob($this->registry->getNewJob()); return; } } sleep(1); } return; }