Filter the command data.

@param \CachetHQ\Cachet\Bus\Commands\Metric\UpdateMetricCommand $command

@return array
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;
        });
    }
549194
private function filterForCommand(array $property, AbstractCommand $command)
    {
        $filtered = [];
        foreach ($property as $commandClassName => $handler) {
            if ($command instanceof $commandClassName) {
                // After that, we still need to check if there is no other handler defined for this command.
                // This is because we allow command handler to listen to parent class or interface.
                $filtered[] = $handler;
            }
        }

        return $filtered;
    }
525016
public function getCommandCallbacks($command = null)
    {
        $result = array();
        if($command)
        {
            if(isset($this->__command_callbacks[$command])) {
                $result = $this->__command_callbacks[$command];
            }
        }
        else $result = $this->__command_callbacks;

        return $result;
    }
948339
private function intercept(Command $command)
    {
        foreach ($this->dispatchInterceptors as $dispatchInterceptor) {
            $command = $dispatchInterceptor->handle($command);
        }

        return $command;
    }
603991
protected function filterCommand($command, $tail)
    {
        $command = trim($command);
        if (!$command) {
            throw new ShellException('Command cannot be empty.');
        }

        if ($tail && !strpos($command, $tail)) {
            $command .= $tail;
        }

        return $command;
    }
207200
private function getFilteredOutput($output, $command)
    {
        $output = str_replace(array("\r\n", "\r"), array("\n", ''), $output);

        $matches = array();
        if (preg_match($this->getOutputFilterRegex($command), $output, $matches) === 1) {
            $output = ltrim($matches[1]);
        }

        return $output;
    }
1123657
public function addTasks($command)
	{
		$this->addSection('Tasks');

		$class = new \ReflectionClass($command);
		$tasks = $class->getMethods(\ReflectionMethod::IS_PUBLIC);

		if ($tasks && count($tasks) > 0)
		{
			$list = [];
			$max  = 0;

			foreach ($tasks as $task)
			{
				if (!$task->isConstructor() && $task->name != 'execute' && $task->name != 'help')
				{
					$comment     = $task->getDocComment();
					$description = 'no description available';

					// Check for help ignore flag
					preg_match('/@museDescription ([[:alnum:] ,\.()\-\'\/]*)/', $comment, $matched);

					if ($matched && isset($matched[1]))
					{
						$description = trim($matched[1]);
					}

					$list[] = [
						'name'        => $task->name,
						'description' => $description
					];

					$max    = ($max > strlen($task->name)) ? $max : strlen($task->name);
				}
			}

			if (count($list) > 0)
			{
				foreach ($list as $item)
				{
					$this->addString($item['name'], [
						'color'       => 'blue',
						'indentation' => 2
					]);

					$this->addString(str_repeat(' ', ($max - strlen($item['name']))) . '   ');
					$this->addLine($item['description']);
				}
			}
			else
			{
				$this->addLine('There are no tasks available for this command', [
					'color'       => 'red',
					'indentation' => 2
				]);
			}
		}

		$this->addSpacer();

		return $this;
	}
1233944
protected function getSvnCredetials($command)
    {
        $httpBasic = $this->config->get('http-basic');
        $parsedUrl = parse_url($this->baseUrl);
        $svnCommand = $command;

        if ($parsedUrl && isset($httpBasic[$parsedUrl['host']])) {
            if ($httpBasic[$parsedUrl['host']]['username'] && $httpBasic[$parsedUrl['host']]['password']) {
                $uname = $httpBasic[$parsedUrl['host']]['username'];
                $pw = $httpBasic[$parsedUrl['host']]['password'];

                $svnCommand = $command.sprintf(' --username %s --password %s --no-auth-cache', $uname, $pw);
            }
        }

        return $svnCommand;
    }
881080
public function transform(Command $command)
    {
        $block = $this->block->reflector(new \ReflectionClass($command));
        $lines = [];

        foreach ($block->getLines() as $line)
        {
            $lines[] = $line->stripTag();
        }

        list($name, $description, $signature) = $lines;

        $command->setName($name);
        $command->setDescription($description);
        $command->setDefinition($this->getDefinition($signature));
    }
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;
        });
    }
915479
private function process($command, array $data = [])
    {
        return $this->parse(
            $this->cURL(
                $this->queryString(
                    array_merge([
                        'command' => $command
                    ], $data)
                )
            )
        );
    }
258776
private function executeCommand($command)
    {
        $stdoutPath = tempnam(sys_get_temp_dir(), 'php-msMsgfOut');
        $stderrPath = tempnam(sys_get_temp_dir(), 'php-msMsGfErr');
        
        $descriptors = array(
            0 => array(
                'pipe',
                'r'
            ),
            1 => array(
                'file',
                $stdoutPath,
                'a'
            ),
            2 => array(
                'file',
                $stderrPath,
                'a'
            )
        );
        
        $process = proc_open($command, $descriptors, $pipes);
        proc_close($process);
        
        if (filesize($stderrPath) > 0) {
            throw new \InvalidArgumentException(file_get_contents($stderrPath));
        }
        
        return $stdoutPath;
    }
13970
public function exec( $command ) {
		$command .= ' 2>&1';
		$command = escapeshellcmd( $command );
		exec( $command, $output, $return_var );

		return [ $output, $return_var ];
	}
139215
protected function getKeyFromAllArguments(CommandInterface $command)
    {
        $arguments = $command->getArguments();

        if ($this->checkSameSlotForKeys($arguments)) {
            return $arguments[0];
        }
    }
716442
private function cleanExtraCommandArgument(Command $command): void
    {
        $arguments = $command->getDefinition()->getArguments();
        if (! isset($arguments['command'])) {
            return;
        }

        unset($arguments['command']);
        $command->getDefinition()->setArguments($arguments);
    }
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;
    }
240861
public function getCommandHandler($command)
    {
        $key = get_class($command);

        if (array_key_exists($key, $this->handlers)) {
            $handler = $this->handlers[$key];

            return $this->container->make($handler);
        }
    }