Filter the command data.

@param \CachetHQ\Cachet\Bus\Commands\Schedule\CreateScheduleCommand $command

@return array
545514
protected function filter(CreateScheduleCommand $command)
    {
        $scheduledAt = $this->dates->create('Y-m-d H:i', $command->scheduled_at);

        if ($completedAt = $command->completed_at) {
            $completedAt = $this->dates->create('Y-m-d H:i', $command->completed_at);
        }

        $params = [
            'name'         => $command->name,
            'message'      => $command->message,
            'status'       => $command->status,
            'scheduled_at' => $scheduledAt,
            'completed_at' => $completedAt,
        ];

        $availableParams = array_filter($params, function ($val) {
            return $val !== null && $val !== '';
        });

        return $availableParams;
    }
680771
public function executeCommandOnNodes(CommandInterface $command)
    {
        $responses = array();

        foreach ($this->pool as $connection) {
            $responses[] = $connection->executeCommand($command);
        }

        return $responses;
    }
1323673
protected function commandShouldBeQueued($command)
    {
        if ($command instanceof ShouldQueue) {
            return true;
        }

        return (new ReflectionClass($this->getHandlerClass($command)))->implementsInterface(
            'Illuminate\Contracts\Queue\ShouldQueue'
        );
    }
833449
protected function registerDatabaseCleanCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Database\Commands\DatabaseCleanCommand($app);
        });
    }
81631
protected function doAction(Command $command)
    {
        if ($command->name() === '__default__') {
            return $this->notFound();
        }

        // Let the command collect more data (if missing or needs confirmation)
        $command->interact($this->io());

        if (!$command->action() && !\method_exists($command, 'execute')) {
            return;
        }

        $params = [];
        $values = $command->values();
        // We prioritize action to be in line with commander.js!
        $action = $command->action() ?? [$command, 'execute'];

        foreach ($this->getActionParameters($action) as $param) {
            $params[] = $values[$param->getName()] ?? null;
        }

        return $action(...$params);
    }
116431
protected function getKeyFromBlockingListCommands(CommandInterface $command)
    {
        $arguments = $command->getArguments();

        if ($this->checkSameSlotForKeys(array_slice($arguments, 0, count($arguments) - 1))) {
            return $arguments[0];
        }
    }
175541
public function getSchema($command = '') {
        $result = [];
        foreach ($this->commandSchemas as $pattern => $opts) {
            if (fnmatch($pattern, $command)) {
                $result = array_replace_recursive($result, $opts);
            }
        }
        return $result;
    }
1224042
protected function analyseCommands($commands)
    {
        $commandList = [];
        foreach (explode('$', $commands) as $commandLine) {
            $params = explode(',', $commandLine);
            $command = array_shift($params);
            $commandList[] = [
                'command' => $command,
                'params' => $params,
            ];
        }
        return $commandList;
    }
486693
protected function filter(UpdateMetricCommand $command)
    {
        $params = [
            'name'          => $command->name,
            'suffix'        => $command->suffix,
            'description'   => $command->description,
            'default_value' => $command->default_value,
            'calc_type'     => $command->calc_type,
            'display_chart' => $command->display_chart,
            'places'        => $command->places,
            'default_view'  => $command->default_view,
            'threshold'     => $command->threshold,
            'order'         => $command->order,
            'visible'       => $command->visible,
        ];

        return array_filter($params, function ($val) {
            return $val !== null;
        });
    }
38256
public function handle(DeleteScheduleCommand $command)
    {
        $schedule = $command->schedule;

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

        $schedule->delete();
    }
330310
protected function commandShouldBeQueued($command)
	{
		if ($command instanceof ShouldBeQueued)
		{
			return true;
		}

		return (new ReflectionClass($this->getHandlerClass($command)))->implementsInterface(
			'Illuminate\Contracts\Queue\ShouldBeQueued'
		);
	}
556952
protected function executeCommand($command)
    {

        $process = new Process($command);
        $process->run();

        return array(
            $process->getExitCode(),
            $process->getOutput(),
            $process->getErrorOutput(),
        );
    }
96933
static public function execute($command)
    {
        $output = array();
        $return = 0;

        ob_start();
        exec($command, $output, $return);
        $std = ob_get_contents();
        ob_end_clean();

        return array(
            'return' => $return,
            'output' => $output,
            'std' => $std,
        );
    }
769013
public static function parseAndRunCommand($command)
    {
        try {
            list($class, $method, $args) = TaskManager::parseCommand($command);
            if (!class_exists($class)) {
                TaskLoader::loadController($class);
            }

            $obj = new $class();
            if (!method_exists($obj, $method)) {
                throw new TaskManagerException('method ' . $method . ' not found in class ' . $class);
            }

            return call_user_func_array(array($obj, $method), $args);
        } catch (\Exception $e) {
            echo 'Caught an exception: ' . get_class($e) . ': ' . PHP_EOL . $e->getMessage() . PHP_EOL;
            return false;
        }
    }
1086162
public function execute(Command $command)
    {
        if ($this->locked === true) {
            $this->queue[] = $command;
            return null;
        }

        $this->locked = true;

        $response = $this->executeIgnoringLock($command);

        $this->executeQueue();

        $this->locked = false;

        return $response;
    }
854368
public function getScheduledCommands()
    {
        $scheduledCommands = [];
        foreach ($this->console->all() as $command) {
            if ($command instanceof ScheduledCommandInterface) {
                $scheduledCommands[] = $command;
            }
        }

        return $scheduledCommands;
    }
461690
private function gatherFacts(array $commands) {
        $facts = [];

        foreach ($commands as $command) {
            if ( ! $command->isHidden() && ! $command->isGlobal()) {
                $facts[$command->getName()] = $command->getDescription();
            }
        }

        ksort($facts);

        $ungroupedFacts = [];
        $groupedFacts = [];

        foreach ($facts as $name => $description) {
            if (stripos($name, ':') === false) {
                $ungroupedFacts[$name] = $description;
            } else {
                $groupedFacts[$name] = $description;
            }
        }

        $facts = array_merge($ungroupedFacts, $groupedFacts);

        return $facts;
    }