Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CommandPool.php
Go to the documentation of this file.
1 <?php
8 
13 
20 {
24  private $commands;
25 
30  public function __construct(
31  TMapFactory $tmapFactory,
32  array $commands = []
33  ) {
34  $this->commands = $tmapFactory->create(
35  [
36  'array' => $commands,
37  'type' => CommandInterface::class
38  ]
39  );
40  }
41 
49  public function get($commandCode)
50  {
51  if (!isset($this->commands[$commandCode])) {
52  throw new NotFoundException(
53  __('The "%1" command doesn\'t exist. Verify the command and try again.', $commandCode)
54  );
55  }
56 
57  return $this->commands[$commandCode];
58  }
59 }
__()
Definition: __.php:13
__construct(TMapFactory $tmapFactory, array $commands=[])
Definition: CommandPool.php:30