/** * Execute the command * * @param $command * @return mixed */ public function execute($command) { $this->executeDecorators($command); $handlerName = $this->commandTranslator->toCommandHandler($command); $handle = $this->resolver->resolve($handlerName); return $handle->handle($command); }
/** * If appropriate, validate command data. * * @param $command */ protected function validateCommand($command) { $validator = $this->commandTranslator->toValidator($command); if ($this->resolver->canResolve($validator)) { $this->resolver->resolve($validator)->validate($command); } }