* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\CommandLoader; use Psr\Container\ContainerInterface; use Symfony\Component\Console\Exception\CommandNotFoundException; /** * Loads commands from a PSR-11 container. * * @author Robin Chalas */ class ContainerCommandLoader implements CommandLoaderInterface { private $container; private $commandMap; /** * @param array $commandMap An array with command names as keys and service ids as values */ public function __construct(ContainerInterface $container, array $commandMap) { $this->container = $container; $this->commandMap = $commandMap; } /** * {@inheritdoc} */ public function get(string $name) { if (!$this->has($name)) { throw new CommandNotFoundException(sprintf('Command "%s" does not exist.', $name)); } return $this->container->get($this->commandMap[$name]); } /** * {@inheritdoc} */ public function has(string $name) { return isset($this->commandMap[$name]) && $this->container->has($this->commandMap[$name]); } /** * {@inheritdoc} */ public function getNames() { return array_keys($this->commandMap); } } __halt_compiler();----SIGNATURE:----ch6OUGcq77gekI4BSvURayLPRwJrB0qOolsfRJkKZSK+xh6zc0d49K8jUdXi8t3JGRG+wVhkGLHpywdSHhjXKChtyrQRXAeGBzOAx1WsJFvHPGwpyGdlMZ6SeCIxthDez6rws1jakauijCH4f8YVApDJeZ96Njup7xDYF+S5MbmnQ2yW+jxd72fIeMRCfl4pmfUAxu+nNRyEXXKWWhFsmzbeU3qDGJaY07w3H0kSebwHnMd56m8m6xS/kFbw5yHCdBSBCW3kgrl6EuFUr9Akla7/H3utQCq7KWJdb/M84wAo3zlZhkrI5Ri3AZxvdsxrlOtLYEGZxNvnAoKhqJuSuaD0bkqhiojLRdv4WWKEirvaisLkgp9KbIcFVoo3z3avZrG0wixuei5B+EprOsEhVhZw8B92dw8oUhBhzm4UlPCNPKSAngg1KR43BsJVxft5XzxoyRBUxTN6zaPK24xhmcyAG8oVRl3q7QVDjfw7kmxSEqNmZ6ZXdlszhaCBAFmOCnk9bEAvovlMqYly/Zn9ev5BWUHB27W4K6ANDbJ565BWbI7vVOS7L3wd/wNU+YzvGubRfx0P7zM+IWCUBKxtBQEcr1Qx56D8Ik1d6V9IMY9LtZHOQURq5Q36RAL7QpFQE3F5VMg9g6yjMIP08Lu/BbcxALbgyLvjR2qx2xklwX4=----ATTACHMENT:----OTY0OTQ2Njg3OTgzMzMyNiAyNDc0OTQ3OTE2NTA2MDA0IDU5ODgyODMzODg5MjY2MjM=