/** * @param OutputInterface $output */ private function printJobsList(OutputInterface $output) { $sections = []; $maxLength = 0; foreach ($this->jobs as $job) { $maxLength = max($maxLength, strlen($job->getName())); $nameParams = explode(':', $job->getName()); $sections[$nameParams[0]][] = $job; } foreach ($sections as $section => $jobs) { $output->writeln(sprintf('%s:', $section)); /** @var JobInterface $job */ foreach ($jobs as $job) { $spacesNumber = $maxLength - strlen($job->getName()) + 1; $output->writeln(sprintf("\t%s%s%s", $job->getName(), str_repeat(' ', $spacesNumber), $job->getInfo())); } $output->writeln(''); } }
/** * @param InputInterface $input * @param OutputInterface $output */ public function run(InputInterface $input, OutputInterface $output) { $fixtureIterator = new FixtureIterator(APP_DIR . '/src/Fixture'); foreach ($fixtureIterator as $fixture) { $fixtures[] = $fixture; } usort($fixtures, function (AbstractFixture $a, AbstractFixture $b) { return $a->getOrder() > $b->getOrder() ? 1 : -1; }); foreach ($fixtures as $fixture) { $output->writeln(sprintf("%d: Loading fixture %s", $fixture->getOrder(), get_class($fixture))); $fixture->load($output); } }
public function run(InputInterface $input, OutputInterface $output) { $output->writeln('Hello, World!'); }