Validate a command with its appropriate validator.

@param  mixed  $command

@return mixed
494789
public function validate($command)
	{
		if ($command instanceof SelfValidating) {
            return $this->container->call([$command, 'validate']);
		}
		
		$validatorClass = $this->getValidatorClass($command);
		if(!$validatorClass) {
			return;
		}
        
		$validator = $this->container->make($validatorClass);
		$method = $this->getValidatorMethod($command);

		call_user_func([$validator, $method], $command);
	}
697285
public function validateCommand ($attribute)
		{
			if (!$this->hasErrors())
			{
				$return_var1 = $return_var2 = $return_var3 = 0;
				exec('command -v ' . $this->$attribute . '', $output, $return_var);
				if ($return_var == 127)
					$this->addError($attribute, Yii::tr('Command not found.', [], 'setting'));
			}
		}
556952
protected function executeCommand($command)
    {

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

        return array(
            $process->getExitCode(),
            $process->getOutput(),
            $process->getErrorOutput(),
        );
    }
284270
public static function parseCommand($command)
    {
        if (preg_match('/([\w\\\\]+)::(\w+)\((.*)\)/', $command, $match)) {
            $params = explode(',', $match[3]);
            if ((1 == count($params)) && ('' == $params[0])) {
                //prevents to pass an empty string
                $params[0] = null;
            }
            return array(
                $match[1],
                $match[2],
                $params
            );
        }

        throw new TaskManagerException('Command not recognized');
    }
1013684
protected function runCommand($command)
    {
        $process = $this->getProcess();

        $process->setCommandLine(trim($this->find() . ' ' . $command));

        $process->run();

        return $this;
    }
1191884
protected function runCommand($command)
    {
        $method = 'image' . ucfirst(strtolower($command['command']));
        if (!method_exists($this, $method)) {
            return false;
        }
        call_user_func_array([$this, $method], $command['params']);
        
        return true;
    }
1015783
public function hasCommandHandler($command)
    {
        $class = get_class($command);

        if (isset($this->handlers[$class])) {
            return true;
        }

        $callback = $this->mapper;

        if (!$callback || method_exists($command, 'handle')) {
            return false;
        }

        $this->handlers[$class] = $callback($command);

        return true;
    }
91879
public static function hasCommand($command)
    {
        if (!is_string($command) || strlen($command) < 1) {
            throw new BadMethodCallException('Parameter command is not a valid string');
        }
        $instance = self::getInstance();

        return isset($instance->commands[$command]);
    }
1276942
public function toValidator($command)
    {
        $class = get_class($command);
        $offset = ($this->positionAt('Command', $class)) ?: $this->positionAt('Request', $class);

        return substr_replace($class, 'Validator', $offset);
    }
114715
function (cmd, callback) {
    if (!cmd || !_.isObject(cmd)) {
      debug(err);
      return callback(new Error('Please pass a valid command!'), null);
    }
    return this.aggregate.validateCommand(cmd, callback);
  }
25023
protected function forceCommand($command): string
    {
        return (
            starts_with($command, 'migrate') === true && starts_with($command, 'migrate:status') === false ||
            starts_with($command, 'db:seed') === true
        ) && mb_strpos('command', '--force') === false ?
            $command .= ' --force' : $command;
    }
562498
public function resolve($command)
    {
        $commandInstance = $this->di->get($command);

        return $this->add($commandInstance);
    }
570915
public function handle($command)
    {
        $comment = $this->writeComment->by($command->userId)->withText($command->body)->about($command->ticketId)->get();
        $this->commentRepository->save($comment);

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

        return $comment;
    }
128056
protected function registerMakeCommandCommand($command)
    {
        $this->app->singleton($command, function ($app) {
            return new Generators\Commands\CommandMakeCommand($app);
        });
    }
1127493
public function execute($command, callable $next)
    {
        if (!$command->validate()) {
            throw new ValidationException(implode(', ', $command->getFirstErrors()));
        }

        return $next($command);
    }
1079062
protected function forceCommand($command)
    {
        return (
            starts_with($command, 'migrate') === true && starts_with($command, 'migrate:status') === false ||
            starts_with($command, 'db:seed') === true
        ) && strpos('command', '--force') === false ?
            $command .= ' --force' : $command;
    }
491866
protected function filterArtisanCommand($command)
    {
        $parts = explode(" ", $command);

        if (isset($parts[2])) {
            if (str_contains(strtolower($parts[0]), 'php') && str_contains(strtolower($parts[1]), 'artisan')) {
                unset($parts[0]);
                unset($parts[1]);
                return implode(" ", $parts);
            }
        }

        return $command;
    }