src/Composer/AbstractScriptEventHandler.php
protected function executeCommand(Event $event, Command $command)
    {
        switch ($command->getType()) {
            case $command::COMMAND_TYPE_PHP:
                $method = 'executePhpCommand';
                break;

            case $command::COMMAND_TYPE_SHELL:
            case $command::COMMAND_TYPE_SYMFONY:
                $method = 'executeShellCommand';
                break;

            default:
                throw new \InvalidArgumentException(
                    sprintf('Command type "%s" is not supported', $command->getType())
                );
        }

        try {
            $this->$method($event, $command);
        } catch (ProcessFailedException $e) {
            $event->getIO()->writeError($e->getMessage());
        }
    }
protected function executeCommand(Event $event, Command $command)
    {
        switch ($command->getType()) {
            case $command::COMMAND_TYPE_PHP:
                $method = 'executePhpCommand';
                break;

            case $command::COMMAND_TYPE_SHELL:
            case $command::COMMAND_TYPE_SYMFONY:
                $method = 'executeShellCommand';
                break;

            default:
                throw new \InvalidArgumentException(
                    sprintf('Command type "%s" is not supported', $command->getType())
                );
        }

        try {
            $this->$method($event, $command);
        } catch (ProcessFailedException $e) {
            $event->getIO()->writeError($e->getMessage());
        }
    }
@param Event $event
@param Command $command

@throws \InvalidArgumentException