1: <?php
2: namespace Peridot\WebDriverManager\Console;
3:
4: use Symfony\Component\Console\Input\InputInterface;
5: use Symfony\Component\Console\Output\OutputInterface;
6:
7: 8: 9: 10: 11:
12: class StatusCommand extends AbstractManagerCommand
13: {
14: protected function configure()
15: {
16: $this
17: ->setName('status')
18: ->setDescription('List the current available drivers');
19: }
20:
21: 22: 23: 24: 25:
26: protected function execute(InputInterface $input, OutputInterface $output)
27: {
28: $binaries = $this->manager->getBinaries();
29: foreach ($binaries as $name => $binary) {
30: $this->outputBinaryStatus($output, $binary);
31: }
32: return 0;
33: }
34:
35: 36: 37: 38:
39: protected function outputBinaryStatus(OutputInterface $output, $binary)
40: {
41: $directory = $this->manager->getInstallPath();
42: $tag = "comment";
43: if ($binary->exists($directory)) {
44: $message = "{$binary->getName()} is up to date";
45: $tag = "info";
46: } else if ($binary->isOutOfDate($directory)) {
47: $message = "{$binary->getName()} needs to be updated";
48: } else {
49: $message = "{$binary->getName()} is not present";
50: }
51: $output->writeln("<$tag>$message</$tag>");
52: }
53: }
54: