src/Dispatcher.php
public function execute($command)
    {
        $commandClass = get_class($command);
        $mappings = $this->getMappings();

        $this->checkIfCommandExistsInMappings($commandClass, $mappings);

        $handlerClass = array_get($mappings, $commandClass);

        try {
            return $this->getContainer()->make($handlerClass)->handle($command);
        } catch (ReflectionException $e) {
            throw new CommandNotInstantiableException($handlerClass . ' is not instantiable.');
        }
    }
public function execute($command)
    {
        $commandClass = get_class($command);
        $mappings = $this->getMappings();

        $this->checkIfCommandExistsInMappings($commandClass, $mappings);

        $handlerClass = array_get($mappings, $commandClass);

        try {
            return $this->getContainer()->make($handlerClass)->handle($command);
        } catch (ReflectionException $e) {
            throw new CommandNotInstantiableException($handlerClass . ' is not instantiable.');
        }
    }
public function execute ( $ command ) { $ commandClass = get_class ( $ command ) ; $ mappings = $ this -> getMappings ( ) ; $ this -> checkIfCommandExistsInMappings ( $ commandClass , $ mappings ) ; $ handlerClass = array_get ( $ mappings , $ commandClass ) ; try { return $ this -> getContainer ( ) -> make ( $ handlerClass ) -> handle ( $ command ) ; } catch ( ReflectionException $ e ) { throw new CommandNotInstantiableException ( $ handlerClass . ' is not instantiable.' ) ; } }
Dispatch a command on the dispatcher.

@param mixed $command The command to dispatch.
@return mixed The result that is returned by the command his handler.
@throws CommandNotInstantiableException Thrown when the dispatcher failed to instantiate the command handler.
@throws CommandNotFoundException When the command could not be found in the mappings.
@throws Exception Any function that the handler throws.
Dispatch a command on the dispatcher .