@param RemoveFromCart $command

@throws \Exception
2250
public function handle(RemoveFromCart $command)
    {
        $cart = $this->carts->getById(new CartId($command->cartId()));
        $cart->remove(new SKU($command->sku()));
    }
152955
protected function addConsoleCommand(Command $command)
    {
        Deprecated::method(3.0, 'registerNutCommands');

        $app = $this->getContainer();
        $app['nut.commands.add']($command);
    }
242411
protected function executeCommand($command)
    {

        try {
            CliExecutor::executeCommand($command);
        } catch (Exception $e) {
            exit($e->getMessage() . PHP_EOL . $e->getTraceAsString() . PHP_EOL);
        }
    }
103905
public function fire(Command $command)
    {
        if (! $this->finder->isFile('.env')) {
            throw new Exception('SocietyCMS is not installed. Please run "php artisan society:install" first.');
        }

        if ($command->option('refresh') && ! App::environment('demo')) {
            throw new Exception('Refresh option is only available in demo mode.');
        }

        if (! $command->option('force') && ! $command->option('refresh')) {
            if (! $command->confirm('Are you sure you want to start Demo Mode?')) {
                throw new Exception('Demo Mode cancelled');
            }
        }
    }
1204244
public function handle(CreateCart $command)
    {
        $this->carts->add(new Cart(new CartId($command->uuid()), $command->currency()));
    }
1243816
public function dispatch($command): void
    {
        $this->commandStack[] = $command;

        if ($this->executing) {
            return;
        }

        $this->transactionManager->begin();
        try {
            while ($command = array_shift($this->commandStack)) {
                $this->invokeHandler($command);
            }
            $this->eventPublisher->publishEvents();
            $this->transactionManager->commit();
        } catch (Exception $e) {
            $this->transactionManager->rollback();
            throw $e;
        }
    }
1259719
public function removeCommandCallback($command, $method)
    {
        $command = strtolower($command);

        if (isset($this->__command_callbacks[$command]) )
        {
            if($method instanceof \Closure) {
                $index = spl_object_hash($method);
            } else {
                $index = $method;
            }

            unset($this->__command_callbacks[$command][$index]);
        }

        return $this;
    }
421738
public function handle(UnsubscribeSubscriberCommand $command)
    {
        $subscriber = $command->subscriber;

        // First remove subscriptions.
        $subscriber->subscriptions()->delete();

        event(new SubscriberHasUnsubscribedEvent($subscriber));

        // Then remove the subscriber.
        $subscriber->delete();
    }
975299
public function handle(AddToCart $command)
    {
        $product = $this->products->getBySku(new SKU($command->sku()));

        $cart = $this->carts->getById(new CartId($command->cartId()));
        $cart->add($product, $command->quantity());
    }
14276
protected function doSendCommand(Command $command): void
    {
        if (!$this->shouldUseGearman()) {
            $this->locator->getCommandBus()->receiveCommand($command);
            return;
        }

        $envelope = new TransportEnvelope($command, 'php');
        $channel = $this->router->forCommand($command);

        try {
            $client = $this->getClient();
            @$client->doBackground($channel, $envelope->toString(), (string)$command->get('command_id'));
            $this->validateReturnCode($client, $channel);
        } catch (\GearmanException $ge) {
            if (isset(self::$reconnectCodes[$ge->getCode()])) {
                $this->destroyClient();
                $this->locator->getCommandBus()->receiveCommand($command);
                return;
            }

            throw $ge;
        } catch (\Throwable $e) {
            throw $e;
        }
    }
557554
protected function _commandPin($command)
    {
        $entity = $this->getController()->getItem();

        $label = ($entity->pinned) ? AnTranslator::_('LIB-AN-ACTION-UNPIN') : AnTranslator::_('LIB-AN-ACTION-PIN');

        $command
        ->append(array('label' => $label))
        ->href($entity->getURL().'&action='.($entity->pinned ? 'unpin' : 'pin'))
        ->setAttribute('data-trigger', 'PostLink');
    }
466289
public function exec($command)
    {
        $result = @ftp_exec($this->connection, $command);
        
        if ($result === false) {
            throw new Exception('Unable to exec command');
        }

        return $this;
    }
917114
function removeItemsFromFront(system, front) {
  system.commands.getAll().forEach(function(command) {
    if (command.front === front) {
      system.commands.remove(command);
    }
  });
}
908568
public function add(Command $command)
    {
        if ($command instanceof ContainerAwareInterface) {
            $command->setContainer($this->container);
        }

        if ($command instanceof BasePhpcrCommand) {
            if ($this->showUnsupported || $command->isSupported()) {
                parent::add($command);
            }
        } else {
            parent::add($command);
        }
    }
834187
public function execute($command, callable $next)
    {
        $migration = $command->getMigration();
        if (!$migration instanceof TransactionAwareInterface) {
            $next($command);
            return;
        }

        $result = null;
        try {
            $migration->begin();
            $next($command);
            $migration->finish();
        } catch (\Exception $e) {
            $migration->abort($e);
        }
    }
1365839
protected function execute($command)
    {
        $process = new Process($command);
        $process->setTimeout(null);
        $process->run();

        if (!$process->isSuccessful()) {
            throw new \RuntimeException($process->getErrorOutput());
        }
    }
457978
protected function registerAddonRemoveCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Addons\Commands\AddonRemoveCommand($app);
        });
    }