Handle the update component command.

@param \CachetHQ\Cachet\Bus\Commands\Component\UpdateComponentCommand $command

@return \CachetHQ\Cachet\Models\Component
195470
public function handle(UpdateComponentCommand $command)
    {
        $component = $command->component;
        $originalStatus = $component->status;

        if ($command->status && (int) $originalStatus !== (int) $command->status) {
            event(new ComponentStatusWasChangedEvent($this->auth->user(), $component, $originalStatus, $command->status, $command->silent));
        }

        $component->update($this->filter($command));

        event(new ComponentWasUpdatedEvent($this->auth->user(), $component));

        return $component;
    }
1214226
protected function handleMainCommand(Command $command)
    {
        $command->line('Clearing settings cache...');

        $this->cache->clear();

        $command->line('Settings cache cleared!');
    }
263931
public function handle(CommandInterface $command)
    {
        $object = $command->getParameter('data');

        if ($command->hasParameter('class')) {
            $class = $command->getParameter('class');
            if (!($object instanceof $class)) {
                return CommandResult::error('invalid_instance');
            }
        }

        try {
            $this->objectManager->flush();
        } catch (ForeignKeyConstraintViolationException $e) {
            return CommandResult::error('constraint_violation');
        }
    }
537119
public function handle(UpdateScheduleCommand $command)
    {
        $schedule = $command->schedule;

        $schedule->update($this->filter($command));

        event(new ScheduleWasUpdatedEvent($this->auth->user(), $schedule));

        return $schedule;
    }
764531
public function execute(Command $command)
    {
        if ($command instanceof QueueableCommand) {
            $this->queuer->queue($command);
            return null;
        }

        return $this->innerCommandBus->execute($command);
    }
1097278
private function handleDelete(DeleteCommand $command)
    {
        $this->state = ORMInterface::STATE_DELETED;
        $this->dispatch('deleted', new RecordEvent($this, $command));
    }
745905
protected function filter(UpdateComponentGroupCommand $command)
    {
        $params = [
            'name'      => $command->name,
            'order'     => $command->order,
            'collapsed' => $command->collapsed,
            'visible'   => $command->visible,
        ];

        return array_filter($params, function ($val) {
            return $val !== null;
        });
    }
1339019
private function update_value( $component, $value )
    {
        $component->set_value( $value );
        $this->final_instance[$component->get_name()] = $value;
    }
867428
public function handle($command)
    {
        $ticket = $this->openTicket->by($command->userId)->withText($command->body)->get();
        $this->ticketRepository->save($ticket);

        $this->dispatchEventsFor($this->openTicket);

        return $ticket;
    }
776095
public function runCommand(Command $command, InputInterface $input, OutputInterface $output) {
    return $this->doRunCommand($command, $input, $output);
  }
1348634
public function handle(UnsubscribeSubscriptionCommand $command)
    {
        $subscription = $command->subscription;

        event(new SubscriberHasUnsubscribedEvent($subscription->subscriber));

        $subscription->delete();
    }
992472
public function aExecuteCommandTo($command) {
        $this->restartKernel();
        $kernel = $this->getKernel();

        $application = new \Symfony\Bundle\FrameworkBundle\Console\Application($kernel);
        $application->setAutoExit(false);

        $exploded = explode(" ", $command);

        $commandsParams = [
        ];
        foreach ($exploded as $value) {
            if (!isset($commandsParams["command"])) {
                $commandsParams["command"] = $value;
            } else {
                $e2 = explode("=", $value);
//                var_dump($e2);
                if (count($e2) == 1) {
                    $commandsParams[] = $e2[0];
                } else if (count($e2) == 2) {
                    $commandsParams[$e2[0]] = $e2[1];
                }
            }
        }
        foreach ($commandsParams as $key => $value) {
            $commandsParams[$key] = $value;
        }
        $input = new \Symfony\Component\Console\Input\ArrayInput($commandsParams);
        if ($output === null) {
            $output = new \Symfony\Component\Console\Output\ConsoleOutput();
        }
        $application->run($input, $output);
//         $content = $output->fetch();
    }
805130
public function handle(CommandInterface $command)
    {
        $object = $command->getParameter('data');

        if ($command->hasParameter('class')) {
            $class = $command->getParameter('class');
            if (!($object instanceof $class)) {
                return CommandResult::error('invalid_instance');
            }
        }

        $this->objectManager->persist($object);
        $this->objectManager->flush();
    }
587785
public function handle(UpdateIncidentUpdateCommand $command)
    {
        $command->update->update($this->filter($command));

        event(new IncidentUpdateWasUpdatedEvent($this->auth->user(), $command->update));

        return $command->update;
    }
1109713
public function handle(CreateIncidentCommand $command)
    {
        $data = [
            'user_id'  => $this->auth->user()->id,
            'name'     => $command->name,
            'status'   => $command->status,
            'visible'  => $command->visible,
            'stickied' => $command->stickied,
        ];

        if ($template = IncidentTemplate::where('slug', '=', $command->template)->first()) {
            $data['message'] = $this->parseTemplate($template, $command);
        } else {
            $data['message'] = $command->message;
        }

        // Link with the component.
        if ($command->component_id) {
            $data['component_id'] = $command->component_id;
        }

        // The incident occurred at a different time.
        if ($occurredAt = $command->occurred_at) {
            if ($date = $this->dates->create('Y-m-d H:i', $occurredAt)) {
                $data['occurred_at'] = $date;
            } else {
                throw new InvalidIncidentTimestampException("Unable to pass timestamp {$occurredAt}");
            }
        } else {
            $data['occurred_at'] = Carbon::now();
        }

        // Create the incident
        $incident = Incident::create($data);

        // Store any meta?
        if ($meta = $command->meta) {
            $this->storeMeta($command->meta, 'incidents', $incident->id);
        }

        // Update the component.
        if ($component = Component::find($command->component_id)) {
            execute(new UpdateComponentCommand(
                Component::find($command->component_id),
                null,
                null,
                $command->component_status,
                null,
                null,
                null,
                null,
                null,
                false
            ));
        }

        event(new IncidentWasCreatedEvent($this->auth->user(), $incident, (bool) $command->notify));

        return $incident;
    }
584392
public function executeCommand(Command $command)
    {
        if ($command instanceof DsnDependent) {
            $command->setDsn($this->dsn);
        }

        $shellCmd = self::VTCTLD_EXECUTABLE . ' ' . $this->getServerString() . ' '
             . $command->getName() . ' ' . implode(' ', $command->getParams());

        exec($shellCmd, $output, $return);
        $output = implode("\n", $output);

        if ($return !== 0) {
            throw new Exception('Error running vtctld command - ' . $shellCmd . ', error: ' . $output);
        }

        $resultClass = $command->getResultClass();

        return new $resultClass($this->dsn, $output);
    }
500667
public function handle(ConvergeCommand $command)
    {
        $collection = $command->getCollection();
        $targetUp = $command->getTarget();
        $options = $command->getOptions();
        $domainBus = $command->getDomainBus();

        $position = $collection->getPosition($targetUp);
        $targetDown = $collection->getByPosition($position + 1);

        $changed = clone $collection;
        $changed->clear();

        $upCommand = new CollectionCommand(
            $collection,
            $targetUp,
            $options->withDirection(Direction::up()),
            $command->getVersionRepository()
        );
        $upChanges = $domainBus->handle($upCommand);
        if (!empty($upChanges)) {
            $changed->merge($upChanges);
        }

        // if we're not yet at the end of the queue (where no migrations can go down)
        if (null !== $targetDown) {
            $downCommand = new CollectionCommand(
                $collection,
                $targetDown,
                $options->withDirection(Direction::down()),
                $command->getVersionRepository()
            );
            $downChanges = $domainBus->handle($downCommand);
            if (!empty($downChanges)) {
                $changed->merge($downChanges);
            }
        }

        return $changed->sort();
    }