* * 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:----buLsa5aNv6nwZhh4qwLYi6oF84vo8D/y0bzvOSGr0szcZjv4YUlEg/57EIgWXVWYF2TpJjfJKWg5IMZ5e6HHwP8Fr9pFQj+53oKzyAaSMjlhUaUqYk8URqK1w7CkhgmS4VFNvbvsXw6JZXL75kYJ3JUkjaBL1Hu0rumJrMOAgLpX/hSEqgQqXXx0odo+wci6nCiSrBjv81yGDaeZwjQpR8jcR1TSxhGqknv9QtzQM29qzy4Dw5lZRGJZSCDXxm5SQOQ0P/OglybjVfsL4w9L5U/xDeJUlIUlNNQM5dPKwDMl5+9vb+gk346tBBp3jz8IV1OB2BVWwPuloTKorMUsjwXqSv8hIQNo4CVwvSe21tTgq1KIKKWFFwXjnqecfAiQ9IkPrG7kdS3WxrK88BJcMDc9qwRvlidNv6KwwxAbk82ttUaLxuqw6kVmXgnhJF/qnDFs/cLC+ii1YBOZsZh8/fqpWetOryyvR5MalfWO3JYELGTjq8zx0lQLkboOexEnlc+Xc1y2O+3JH9jVd5QDYVBP45YxAzqZzAP70nddyZyCkngyYO/d/O6qPMw1pWnf2MN5XhzAx0qOmpROuEE60jYZaKn0m+txl4z8Yj/Z22+gKF/Z1PUM2cAwoWyFx7WLM6XcBaniCyyQShKd0+y87Nikk6+td3MnBbTrm7cnEu8=----ATTACHMENT:----MjM2MjU0NzIyNzQ2NTM5OCA4NTk0MTQxNjIzMzE4OTEzIDIxMDUyMTcwNDg4ODIyNjg=