Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CommandList.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Deploy\Console;
7 
9 
14 {
20  private $objectManager;
21 
25  public function __construct(ObjectManagerInterface $objectManager)
26  {
27  $this->objectManager = $objectManager;
28  }
29 
35  private function getCommandsClasses()
36  {
37  return [
38  \Magento\Deploy\Console\Command\App\ConfigImportCommand::class,
39  ];
40  }
41 
45  public function getCommands()
46  {
47  $commands = [];
48  foreach ($this->getCommandsClasses() as $class) {
49  if (class_exists($class)) {
50  $commands[] = $this->objectManager->get($class);
51  } else {
52  throw new \Exception('Class ' . $class . ' does not exist');
53  }
54  }
55 
56  return $commands;
57  }
58 }
__construct(ObjectManagerInterface $objectManager)
Definition: CommandList.php:25
$objectManager
Definition: bootstrap.php:17
$_option $_optionId $class
Definition: date.phtml:13