Retrieves the handler for a specified command

@param string $commandName
@return object

@throws MissingHandlerException
971779
public function getHandlerForCommand($commandName)
    {
        if (!isset($this->commandToServiceId[$commandName])) {
            throw MissingHandlerException::forCommand($commandName);
        }

        return $this->container->get($this->commandToServiceId[$commandName]);
    }
919842
public function addHandler($handler, $commandClassName)
    {
        $handlerInstance = app($handler);
        $this->handlers[$commandClassName] = $handlerInstance;
    }
1325058
@Override
    public Handle getHandle() throws RemoteException
    {
        ComponentMetaDataAccessorImpl cmdAccessor = null; // p125735
        try {
            cmdAccessor = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor(); // p125735
            cmdAccessor.beginContext(bmd); // p125735
            return beanId.getHome().createHandle(beanId);
        } finally
        {
            if (cmdAccessor != null)
                cmdAccessor.endContext(); // p125735
        }
    }
301282
public static function get_handler($classname) {
        global $DB;

        if (strpos($classname, '\\') !== 0) {
            $classname = '\\' . $classname;
        }

        $record = $DB->get_record('messageinbound_handlers', array('classname' => $classname), '*', IGNORE_MISSING);
        if (!$record) {
            return false;
        }
        return self::handler_from_record($record);
    }
581030
protected function getHandlers($eventName)
    {
        return isset($this->events[$eventName]) ? $this->events[$eventName] : new CallbackQueue();
    }
490203
public function getCommand($name, array $args = array()) {
    /*if($name != 'oauth') {
		  $this->checkAuth();
    }*/

    $command = parent::getCommand($name, $args);
    $this->command_history[] = $command;
		return $command;
	}
605581
protected function getHandler(): AbstractHandler
    {
        if ($this->handler === null
            && (
                is_callable($this->handlerGetter) === false
                || !(($this->handler = ($this->handlerGetter)()) instanceof \SlaxWeb\Output\AbstractHandler)
            )
        ) {
            throw new Exception\MissingOutputHandlerException(
                "Output Manager does not have a valid Output Handler nor an "
                . "Output Handler getter set, or it provided an invalid Handler."
            );
        }
        return $this->handler;
    }
885290
public function getCommand(string $name): AbstractCommand
	{
		if (!isset($this->commands[$name]) && !isset($this->aliases[$name]))
		{
			throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
		}

		return $this->commands[$name] ?? $this->aliases[$name];
	}
944885
public function get($serviceName)
    {
        $service = $this->_services[$serviceName];
        if (empty($service) === false) {
            return $service;
        }

        throw new \Exception('Service '.$serviceName.' not defined');
    }
897208
public function commandToRequestTransformer(CommandInterface $command)
    {
        $name = $command->getName();
        if (!isset($this->api[$name])) {
            throw new CommandException('Command not found', $command);
        }
        $action = $this->api[$name];

        $prefix = '';
        if (isset($action['public']) && $command->hasParam('public')) {
            $prefix = '/public';
        }

        $prefixes = [
            'system' => '/systems/{system}',
            'issuer' => '/issuers/{issuer}',
            'program' => '/programs/{program}',
        ];
        if (isset($action['admin_contexts'])) {
            $prefix .= implode('', array_intersect_key($prefixes, array_flip($action['admin_contexts']), array_merge($command->toArray(), $this->adminContext)));
        }
        $path = GuzzleHttp\uri_template($prefix.$action['path'], array_merge($command->toArray(), $this->adminContext));

        $headers = [];
        $body = null;
        if ($command->hasParam('body')) {
            $headers = ['Content-Type' => 'application/json'];
            $body = GuzzleHttp\json_encode($command['body']);
        }

        if ($command->hasParam('query')) {
            $path .= '?'.Psr7\build_query($command['query']);
        }

        return new Psr7\Request($action['method'], $path, $headers, $body);
    }
1026245
public function callHandler(array $command, $method, $args = array())
    {
        try {
            $handlers = $this->getHandlers();
            return Handler::call($handlers, $command['command_id'], $method, $args);
        } catch (Exception $ex) {
            return $ex->getMessage();
        }
    }
13511
public ICommandBehavior getCommand(final String commandName) {
        return dynamicCommands.get(commandName.toLowerCase(Locale.ENGLISH)).getBehavior();
    }
971132
public function handle(CommandInterface $command)
    {
        $class = $command->getParameter('class');
        $object = $command->hasParameter('object') ? $command->getParameter('object') : null;

        // if no object has been given, try loading it using a query object
        if (!$object) {
            $object = $this->queryExecutor->execute($command->getParameter('query_object'));
        }

        // try removing the object if it is valid
        if ($object instanceof $class) {
            try {
                $this->objectManager->remove($object);
                $this->objectManager->flush();
            } catch (ForeignKeyConstraintViolationException $e) {
                return CommandResult::error('constraint_violation');
            }
        }
    }
323058
public function handle(CommandInterface $command)
    {
        $handleAll = $command->getParameter('selectedAll');
        $ids = $command->getParameter('selected');

        try {
            $this->queryExecutor->beginTransaction();

            if ($handleAll) {
                $criteria = \json_decode($command->getParameter('query'), true);
                $this->displayCriteriaFactory->setAttributes($criteria);
                $displayCriteria = $this->displayCriteriaFactory->createCriteria([
                    'filter' => $this->filterFactory->create($criteria['filter_type']),
                ]);
                $displayCriteria->getPager()->disable();

                $this->handleAll($displayCriteria);
            } else {
                foreach ($ids as $id) {
                    $result = $this->handleOne($id);

                    if (!$result->isSuccessful()) {
                        throw new \Exception();
                    }
                }
            }

            $this->queryExecutor->commit();
        } catch (\Exception $e) {
            $this->queryExecutor->rollback();

            $return = CommandResult::error('batch_error');
            if (isset($result)) {
                $return->addMessages($result->getMessages());
            }

            return $return;
        }

        return CommandResult::success('batch_success', ['%count%' => \count($ids)]);
    }
1098986
public function getHandler( string $handlerName ) : ?IVfsHandler
   {

      return isset( $this->_handlers[ $handlerName ] )
         ? $this->_handlers[ $handlerName ]
         : null;

   }
507074
public function toCommandHandler($command)
    {
        $commandClass = get_class($command);
        $handler = substr_replace($commandClass, 'CommandHandler', strrpos($commandClass, 'Command'));

        if ( ! class_exists($handler))
        {
            $message = "Command handler [$handler] does not exist.";

            throw new HandlerNotRegisteredException($message);
        }

        return $handler;
    }
1255486
public function dispatch($command) {
        $type = $this->getCommandType($command);
        $definition = $this->getDefinition($type);

        if ( ! $definition instanceof IDefinition) {
            throw new UnhandledCommandException(
                s('Command %s could not be dispatched. Missing command handler.',
                    get_type($command))
            );
        }

        return $this->invokeDefinition($definition, $command);
    }