Determine if the given command should be queued.

@param  mixed  $command
@return bool
330310
protected function commandShouldBeQueued($command)
	{
		if ($command instanceof ShouldBeQueued)
		{
			return true;
		}

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

        if (!is_null($this->loader)) {
            $this->loader->setCommand($this->command);
        }
    }
482891
public function commandExists($cmd) {
		return $this->loaded && isset($this->commands[$cmd]) && method_exists($this, $cmd);
	}
338015
public function hasArgs($command = '') {
        $args = null;

        if ($command) {
            // Check to see if the specific command has args.
            $def = $this->getSchema($command);
            if (isset($def[Cli::META][Cli::ARGS])) {
                $args = $def[Cli::META][Cli::ARGS];
            }
        } else {
            foreach ($this->commandSchemas as $pattern => $def) {
                if (isset($def[Cli::META][Cli::ARGS])) {
                    $args = $def[Cli::META][Cli::ARGS];
                }
            }
            if (!empty($args)) {
                return 1;
            }
        }

        if (!$args || empty($args)) {
            return 0;
        }

        foreach ($args as $arg) {
            if (!Cli::val('required', $arg)) {
                return 1;
            }
        }
        return 2;
    }
609453
public static function validateCommand($command)
    {
        try {
            list($class, $method, $args) = self::parseCommand($command);
        } catch (TaskManagerException $e) {
            return false;
        }
        $args = array_map(function ($elem) {
            return trim($elem);
        }, $args);
        return $class . '::' . $method . '(' . trim(implode(',', $args), ',') . ')';
    }
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;
        }
    }
1351478
public function handle($command)
    {
        $this->commandStack[] = $command;

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

        $first = true;

        while ($command = array_shift($this->commandStack)) {
            $this->invokeHandler($command, $first);
            $first = false;
        }
    }
229668
protected function forceCommand($command)
    {
        if ((
            Str::startsWith($command, 'migrate') === true && Str::startsWith($command, 'migrate:status') === false ||
            Str::startsWith($command, 'db:seed') === true
        ) && strpos($command, '--force') === false) {
            $command .= ' --force';
        }

        if ((
            is_null($this->laravel) === false &&
            version_compare($this->laravel->version(), 5.5, '>=') &&
            Str::startsWith($command, 'vendor:publish') === true
        ) && strpos($command, '--all') === false) {
            $command .= ' --all';
        }

        return $command;
    }
895712
public function runnableInEnvironment(ScheduledCommandInterface $command)
    {
        $environment = $command->environment();

        //if any
        if ($environment == '*' || $environment == App::environment()) {
            return true;
        }

        if (is_array($environment) && in_array(App::environment(), $environment)) {
            return true;
        }

        return false;
    }
1077481
public function findHandler(Command $command)
    {
        $command_name = get_class($command);

        return isset($this->handlers[$command_name]) ? $this->handlers[$command_name] : null;
    }
941773
protected function call($command, $multiline = false)
    {
        if (!$this->send($command)) {
            return false;
        }

        return $this->receive($multiline);
    }
247527
protected function isCommandDisabled($command) {
    $disabled_commands = $this->getDisabledCommands();
    if (is_array($disabled_commands) && array_key_exists($command, $disabled_commands) && $disabled_commands[$command]) {
      $this->logger->warning("The $command command is disabled.");
      return TRUE;
    }

    return FALSE;
  }
778081
public function isNativeCommandAvailable($command)
    {
        switch ($command) {
            case 'zip':
            case 'unzip':
                break;
            default:
                return false;
        }
        if (!isset($this->availableNativeCommands[$command])) {
            $this->availableNativeCommands[$command] = false;
            if ($this->functionInspector->functionAvailable('exec')) {
                $rc = 1;
                $output = [];
                @exec($command . ' -v 2>&1', $output, $rc);
                if ($rc === 0) {
                    $stdOut = implode("\n", $output);
                    if (stripos($stdOut, 'info-zip') !== false || stripos($stdOut, 'infozip') !== false) {
                        $this->availableNativeCommands[$command] = true;
                    }
                }
            }
        }

        return $this->availableNativeCommands[$command];
    }
84093
public function run($command = null) {
		if ($command && !$this->request->args()) {
			return $this->_default($command);
		}
		$this->request->shift();
		$this->template = $this->template ?: $command;

		if (!$command) {
			return false;
		}
		if ($this->_execute($command)) {
			return true;
		}
		$this->error("{$command} could not be created.");
		return false;
	}
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;
    }
1295064
public function command($command)
    {
        if (! $command instanceof Command) {
            $command = $this[$command];
        }

        $this['console']->add($command);
    }
705300
public function handle(ExistCommand $command): bool
    {
        return $this->s3Client->doesObjectExist(
            $command->getBucket(),
            $command->getFilename(),
            $command->getOptions()
        );
    }