Overview

Namespaces

  • Peridot
    • WebDriverManager
      • Binary
        • Decompression
        • Request
      • Console
      • Event
      • OS
      • Process
      • Test
  • PHP

Classes

  • AbstractManagerCommand
  • CleanCommand
  • StartCommand
  • StatusCommand
  • UpdateCommand
  • Overview
  • Namespace
  • Class
  • Tree
 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:  * StatusCommand shows what drivers and binaries are up to date, out of date, or not present.
 9:  *
10:  * @package Peridot\WebDriverManager\Console
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:      * @param InputInterface $input
23:      * @param OutputInterface $output
24:      * @return int|null|void
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:      * @param OutputInterface $output
37:      * @param $binary
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: 
WebDriver Manager API documentation generated by ApiGen