Dumplie\SharedKernel\Application\Command\ExtensionRegistry::post PHP Method

post() public method

public post ( Command $command )
$command Command
    public function post(Command $command)
    {
        foreach ($this->extensions as $extensionItem) {
            $extension = $extensionItem[self::EXTENSION_KEY];
            if ($extension->expands($command)) {
                $extension->post($command, $this->serviceLocator);
            }
        }
    }

Usage Example

Example #1
0
 /**
  * @param object $command
  * @param callable $next
  */
 public function execute($command, callable $next)
 {
     if ($command instanceof Command) {
         $this->extensionRegistry->pre($command);
     }
     try {
         $next($command);
     } catch (\Exception $exception) {
         $this->extensionRegistry->passException($command, $exception);
         throw $exception;
     }
     if ($command instanceof Command) {
         $this->extensionRegistry->post($command);
     }
 }