protected function executeCommandHook($method, $event_type)
    {
        foreach ($this->getCommandsByMethodEventType($method, $event_type) as $command) {
            if (is_string($command)) {
                $command = (new CommandHook())
                    ->setType('raw')
                    ->setCommand($command);
            } elseif (is_array($command)) {
                $command = CommandHook::createWithData($command);
            }

            if (!$command instanceof CommandHookInterface) {
                continue;
            }

            switch ($command->getType()) {
                case 'symfony':
                    $this->executeSymfonyCmdHook($command, $method);
                    break;
                default:
                    $this->executeEngineCmdHook($command);
                    break;
            }
        }

        return $this;
    }
protected function executeCommandHook($method, $event_type)
    {
        foreach ($this->getCommandsByMethodEventType($method, $event_type) as $command) {
            if (is_string($command)) {
                $command = (new CommandHook())
                    ->setType('raw')
                    ->setCommand($command);
            } elseif (is_array($command)) {
                $command = CommandHook::createWithData($command);
            }

            if (!$command instanceof CommandHookInterface) {
                continue;
            }

            switch ($command->getType()) {
                case 'symfony':
                    $this->executeSymfonyCmdHook($command, $method);
                    break;
                default:
                    $this->executeEngineCmdHook($command);
                    break;
            }
        }

        return $this;
    }
protected function executeCommandHook ( $ method , $ event_type ) { foreach ( $ this -> getCommandsByMethodEventType ( $ method , $ event_type ) as $ command ) { if ( is_string ( $ command ) ) { $ command = ( new CommandHook ( ) ) -> setType ( 'raw' ) -> setCommand ( $ command ) ; } elseif ( is_array ( $ command ) ) { $ command = CommandHook :: createWithData ( $ command ) ; } if ( ! $ command instanceof CommandHookInterface ) { continue ; } switch ( $ command -> getType ( ) ) { case 'symfony' : $ this -> executeSymfonyCmdHook ( $ command , $ method ) ; break ; default : $ this -> executeEngineCmdHook ( $ command ) ; break ; } } return $ this ; }
Execute command hook.

@param $method
The task method command.
@param $event_type
The event type on which to execute.

@return $this

@throws \Psr\Container\ContainerExceptionInterface
@throws \Psr\Container\NotFoundExceptionInterface
Execute command hook .