update v 1.0.7.5
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<?php namespace Illuminate\Console;
|
||||
<?php
|
||||
|
||||
namespace Illuminate\Console;
|
||||
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Symfony\Component\Console\Helper\Table;
|
||||
use Symfony\Component\Console\Input\ArrayInput;
|
||||
use Symfony\Component\Console\Output\NullOutput;
|
||||
@@ -7,381 +10,514 @@ use Symfony\Component\Console\Question\Question;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
use Illuminate\Contracts\Foundation\Application as LaravelApplication;
|
||||
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||
use Symfony\Component\Console\Command\Command as SymfonyCommand;
|
||||
|
||||
class Command extends \Symfony\Component\Console\Command\Command {
|
||||
class Command extends SymfonyCommand
|
||||
{
|
||||
/**
|
||||
* The Laravel application instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $laravel;
|
||||
|
||||
/**
|
||||
* The Laravel application instance.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
protected $laravel;
|
||||
/**
|
||||
* The input interface implementation.
|
||||
*
|
||||
* @var \Symfony\Component\Console\Input\InputInterface
|
||||
*/
|
||||
protected $input;
|
||||
|
||||
/**
|
||||
* The input interface implementation.
|
||||
*
|
||||
* @var \Symfony\Component\Console\Input\InputInterface
|
||||
*/
|
||||
protected $input;
|
||||
/**
|
||||
* The output interface implementation.
|
||||
*
|
||||
* @var \Illuminate\Console\OutputStyle
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* The output interface implementation.
|
||||
*
|
||||
* @var \Symfony\Component\Console\Output\OutputInterface
|
||||
*/
|
||||
protected $output;
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature;
|
||||
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* Create a new console command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($this->name);
|
||||
/**
|
||||
* The default verbosity of output commands.
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $verbosity = OutputInterface::VERBOSITY_NORMAL;
|
||||
|
||||
// We will go ahead and set the name, description, and parameters on console
|
||||
// commands just to make things a little easier on the developer. This is
|
||||
// so they don't have to all be manually specified in the constructors.
|
||||
$this->setDescription($this->description);
|
||||
/**
|
||||
* The mapping between human readable verbosity levels and Symfony's OutputInterface.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $verbosityMap = [
|
||||
'v' => OutputInterface::VERBOSITY_VERBOSE,
|
||||
'vv' => OutputInterface::VERBOSITY_VERY_VERBOSE,
|
||||
'vvv' => OutputInterface::VERBOSITY_DEBUG,
|
||||
'quiet' => OutputInterface::VERBOSITY_QUIET,
|
||||
'normal' => OutputInterface::VERBOSITY_NORMAL,
|
||||
];
|
||||
|
||||
$this->specifyParameters();
|
||||
}
|
||||
/**
|
||||
* Create a new console command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// We will go ahead and set the name, description, and parameters on console
|
||||
// commands just to make things a little easier on the developer. This is
|
||||
// so they don't have to all be manually specified in the constructors.
|
||||
if (isset($this->signature)) {
|
||||
$this->configureUsingFluentDefinition();
|
||||
} else {
|
||||
parent::__construct($this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the arguments and options on the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function specifyParameters()
|
||||
{
|
||||
// We will loop through all of the arguments and options for the command and
|
||||
// set them all on the base command instance. This specifies what can get
|
||||
// passed into these commands as "parameters" to control the execution.
|
||||
foreach ($this->getArguments() as $arguments)
|
||||
{
|
||||
call_user_func_array(array($this, 'addArgument'), $arguments);
|
||||
}
|
||||
$this->setDescription($this->description);
|
||||
|
||||
foreach ($this->getOptions() as $options)
|
||||
{
|
||||
call_user_func_array(array($this, 'addOption'), $options);
|
||||
}
|
||||
}
|
||||
if (! isset($this->signature)) {
|
||||
$this->specifyParameters();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the console command.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
* @return int
|
||||
*/
|
||||
public function run(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->input = $input;
|
||||
/**
|
||||
* Configure the console command using a fluent definition.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureUsingFluentDefinition()
|
||||
{
|
||||
list($name, $arguments, $options) = Parser::parse($this->signature);
|
||||
|
||||
$this->output = $output;
|
||||
parent::__construct($name);
|
||||
|
||||
return parent::run($input, $output);
|
||||
}
|
||||
foreach ($arguments as $argument) {
|
||||
$this->getDefinition()->addArgument($argument);
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
* @return mixed
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$method = method_exists($this, 'handle') ? 'handle' : 'fire';
|
||||
foreach ($options as $option) {
|
||||
$this->getDefinition()->addOption($option);
|
||||
}
|
||||
}
|
||||
|
||||
return $this->laravel->call([$this, $method]);
|
||||
}
|
||||
/**
|
||||
* Specify the arguments and options on the command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function specifyParameters()
|
||||
{
|
||||
// We will loop through all of the arguments and options for the command and
|
||||
// set them all on the base command instance. This specifies what can get
|
||||
// passed into these commands as "parameters" to control the execution.
|
||||
foreach ($this->getArguments() as $arguments) {
|
||||
call_user_func_array([$this, 'addArgument'], $arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call another console command.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $arguments
|
||||
* @return int
|
||||
*/
|
||||
public function call($command, array $arguments = array())
|
||||
{
|
||||
$instance = $this->getApplication()->find($command);
|
||||
foreach ($this->getOptions() as $options) {
|
||||
call_user_func_array([$this, 'addOption'], $options);
|
||||
}
|
||||
}
|
||||
|
||||
$arguments['command'] = $command;
|
||||
/**
|
||||
* Run the console command.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
* @return int
|
||||
*/
|
||||
public function run(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$this->input = $input;
|
||||
|
||||
return $instance->run(new ArrayInput($arguments), $this->output);
|
||||
}
|
||||
$this->output = new OutputStyle($input, $output);
|
||||
|
||||
/**
|
||||
* Call another console command silently.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $arguments
|
||||
* @return int
|
||||
*/
|
||||
public function callSilent($command, array $arguments = array())
|
||||
{
|
||||
$instance = $this->getApplication()->find($command);
|
||||
return parent::run($input, $output);
|
||||
}
|
||||
|
||||
$arguments['command'] = $command;
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @param \Symfony\Component\Console\Input\InputInterface $input
|
||||
* @param \Symfony\Component\Console\Output\OutputInterface $output
|
||||
* @return mixed
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$method = method_exists($this, 'handle') ? 'handle' : 'fire';
|
||||
|
||||
return $instance->run(new ArrayInput($arguments), new NullOutput);
|
||||
}
|
||||
return $this->laravel->call([$this, $method]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of a command argument.
|
||||
*
|
||||
* @param string $key
|
||||
* @return string|array
|
||||
*/
|
||||
public function argument($key = null)
|
||||
{
|
||||
if (is_null($key)) return $this->input->getArguments();
|
||||
/**
|
||||
* Call another console command.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $arguments
|
||||
* @return int
|
||||
*/
|
||||
public function call($command, array $arguments = [])
|
||||
{
|
||||
$instance = $this->getApplication()->find($command);
|
||||
|
||||
return $this->input->getArgument($key);
|
||||
}
|
||||
$arguments['command'] = $command;
|
||||
|
||||
/**
|
||||
* Get the value of a command option.
|
||||
*
|
||||
* @param string $key
|
||||
* @return string|array
|
||||
*/
|
||||
public function option($key = null)
|
||||
{
|
||||
if (is_null($key)) return $this->input->getOptions();
|
||||
return $instance->run(new ArrayInput($arguments), $this->output);
|
||||
}
|
||||
|
||||
return $this->input->getOption($key);
|
||||
}
|
||||
/**
|
||||
* Call another console command silently.
|
||||
*
|
||||
* @param string $command
|
||||
* @param array $arguments
|
||||
* @return int
|
||||
*/
|
||||
public function callSilent($command, array $arguments = [])
|
||||
{
|
||||
$instance = $this->getApplication()->find($command);
|
||||
|
||||
/**
|
||||
* Confirm a question with the user.
|
||||
*
|
||||
* @param string $question
|
||||
* @param bool $default
|
||||
* @return bool
|
||||
*/
|
||||
public function confirm($question, $default = false)
|
||||
{
|
||||
$helper = $this->getHelperSet()->get('question');
|
||||
$arguments['command'] = $command;
|
||||
|
||||
$question = new ConfirmationQuestion("<question>{$question}</question> ", $default);
|
||||
return $instance->run(new ArrayInput($arguments), new NullOutput);
|
||||
}
|
||||
|
||||
return $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
/**
|
||||
* Determine if the given argument is present.
|
||||
*
|
||||
* @param string|int $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasArgument($name)
|
||||
{
|
||||
return $this->input->hasArgument($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt the user for input.
|
||||
*
|
||||
* @param string $question
|
||||
* @param string $default
|
||||
* @return string
|
||||
*/
|
||||
public function ask($question, $default = null)
|
||||
{
|
||||
$helper = $this->getHelperSet()->get('question');
|
||||
/**
|
||||
* Get the value of a command argument.
|
||||
*
|
||||
* @param string $key
|
||||
* @return string|array
|
||||
*/
|
||||
public function argument($key = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $this->input->getArguments();
|
||||
}
|
||||
|
||||
$question = new Question("<question>$question</question> ", $default);
|
||||
return $this->input->getArgument($key);
|
||||
}
|
||||
|
||||
return $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
/**
|
||||
* Determine if the given option is present.
|
||||
*
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
public function hasOption($name)
|
||||
{
|
||||
return $this->input->hasOption($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt the user for input with auto completion.
|
||||
*
|
||||
* @param string $question
|
||||
* @param array $choices
|
||||
* @param string $default
|
||||
* @return string
|
||||
*/
|
||||
public function askWithCompletion($question, array $choices, $default = null)
|
||||
{
|
||||
$helper = $this->getHelperSet()->get('question');
|
||||
/**
|
||||
* Get the value of a command option.
|
||||
*
|
||||
* @param string $key
|
||||
* @return string|array
|
||||
*/
|
||||
public function option($key = null)
|
||||
{
|
||||
if (is_null($key)) {
|
||||
return $this->input->getOptions();
|
||||
}
|
||||
|
||||
$question = new Question("<question>$question</question> ", $default);
|
||||
return $this->input->getOption($key);
|
||||
}
|
||||
|
||||
$question->setAutocompleterValues($choices);
|
||||
/**
|
||||
* Confirm a question with the user.
|
||||
*
|
||||
* @param string $question
|
||||
* @param bool $default
|
||||
* @return bool
|
||||
*/
|
||||
public function confirm($question, $default = false)
|
||||
{
|
||||
return $this->output->confirm($question, $default);
|
||||
}
|
||||
|
||||
return $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
/**
|
||||
* Prompt the user for input.
|
||||
*
|
||||
* @param string $question
|
||||
* @param string $default
|
||||
* @return string
|
||||
*/
|
||||
public function ask($question, $default = null)
|
||||
{
|
||||
return $this->output->ask($question, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prompt the user for input but hide the answer from the console.
|
||||
*
|
||||
* @param string $question
|
||||
* @param bool $fallback
|
||||
* @return string
|
||||
*/
|
||||
public function secret($question, $fallback = true)
|
||||
{
|
||||
$helper = $this->getHelperSet()->get('question');
|
||||
/**
|
||||
* Prompt the user for input with auto completion.
|
||||
*
|
||||
* @param string $question
|
||||
* @param array $choices
|
||||
* @param string $default
|
||||
* @return string
|
||||
*/
|
||||
public function anticipate($question, array $choices, $default = null)
|
||||
{
|
||||
return $this->askWithCompletion($question, $choices, $default);
|
||||
}
|
||||
|
||||
$question = new Question("<question>$question</question> ");
|
||||
/**
|
||||
* Prompt the user for input with auto completion.
|
||||
*
|
||||
* @param string $question
|
||||
* @param array $choices
|
||||
* @param string $default
|
||||
* @return string
|
||||
*/
|
||||
public function askWithCompletion($question, array $choices, $default = null)
|
||||
{
|
||||
$question = new Question($question, $default);
|
||||
|
||||
$question->setHidden(true)->setHiddenFallback($fallback);
|
||||
$question->setAutocompleterValues($choices);
|
||||
|
||||
return $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
return $this->output->askQuestion($question);
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the user a single choice from an array of answers.
|
||||
*
|
||||
* @param string $question
|
||||
* @param array $choices
|
||||
* @param string $default
|
||||
* @param mixed $attempts
|
||||
* @param bool $multiple
|
||||
* @return bool
|
||||
*/
|
||||
public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
|
||||
{
|
||||
$helper = $this->getHelperSet()->get('question');
|
||||
/**
|
||||
* Prompt the user for input but hide the answer from the console.
|
||||
*
|
||||
* @param string $question
|
||||
* @param bool $fallback
|
||||
* @return string
|
||||
*/
|
||||
public function secret($question, $fallback = true)
|
||||
{
|
||||
$question = new Question($question);
|
||||
|
||||
$question = new ChoiceQuestion("<question>$question</question> ", $choices, $default);
|
||||
$question->setHidden(true)->setHiddenFallback($fallback);
|
||||
|
||||
$question->setMaxAttempts($attempts)->setMultiselect($multiple);
|
||||
return $this->output->askQuestion($question);
|
||||
}
|
||||
|
||||
return $helper->ask($this->input, $this->output, $question);
|
||||
}
|
||||
/**
|
||||
* Give the user a single choice from an array of answers.
|
||||
*
|
||||
* @param string $question
|
||||
* @param array $choices
|
||||
* @param string $default
|
||||
* @param mixed $attempts
|
||||
* @param bool $multiple
|
||||
* @return string
|
||||
*/
|
||||
public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
|
||||
{
|
||||
$question = new ChoiceQuestion($question, $choices, $default);
|
||||
|
||||
/**
|
||||
* Format input to textual table.
|
||||
*
|
||||
* @param array $headers
|
||||
* @param array $rows
|
||||
* @param string $style
|
||||
* @return void
|
||||
*/
|
||||
public function table(array $headers, array $rows, $style = 'default')
|
||||
{
|
||||
$table = new Table($this->output);
|
||||
$question->setMaxAttempts($attempts)->setMultiselect($multiple);
|
||||
|
||||
$table->setHeaders($headers)->setRows($rows)->setStyle($style)->render();
|
||||
}
|
||||
return $this->output->askQuestion($question);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string as information output.
|
||||
*
|
||||
* @param string $string
|
||||
* @return void
|
||||
*/
|
||||
public function info($string)
|
||||
{
|
||||
$this->output->writeln("<info>$string</info>");
|
||||
}
|
||||
/**
|
||||
* Format input to textual table.
|
||||
*
|
||||
* @param array $headers
|
||||
* @param \Illuminate\Contracts\Support\Arrayable|array $rows
|
||||
* @param string $style
|
||||
* @return void
|
||||
*/
|
||||
public function table(array $headers, $rows, $style = 'default')
|
||||
{
|
||||
$table = new Table($this->output);
|
||||
|
||||
/**
|
||||
* Write a string as standard output.
|
||||
*
|
||||
* @param string $string
|
||||
* @return void
|
||||
*/
|
||||
public function line($string)
|
||||
{
|
||||
$this->output->writeln($string);
|
||||
}
|
||||
if ($rows instanceof Arrayable) {
|
||||
$rows = $rows->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string as comment output.
|
||||
*
|
||||
* @param string $string
|
||||
* @return void
|
||||
*/
|
||||
public function comment($string)
|
||||
{
|
||||
$this->output->writeln("<comment>$string</comment>");
|
||||
}
|
||||
$table->setHeaders($headers)->setRows($rows)->setStyle($style)->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string as question output.
|
||||
*
|
||||
* @param string $string
|
||||
* @return void
|
||||
*/
|
||||
public function question($string)
|
||||
{
|
||||
$this->output->writeln("<question>$string</question>");
|
||||
}
|
||||
/**
|
||||
* Write a string as information output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function info($string, $verbosity = null)
|
||||
{
|
||||
$this->line($string, 'info', $verbosity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a string as error output.
|
||||
*
|
||||
* @param string $string
|
||||
* @return void
|
||||
*/
|
||||
public function error($string)
|
||||
{
|
||||
$this->output->writeln("<error>$string</error>");
|
||||
}
|
||||
/**
|
||||
* Write a string as standard output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $style
|
||||
* @param null|int|string $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function line($string, $style = null, $verbosity = null)
|
||||
{
|
||||
$styled = $style ? "<$style>$string</$style>" : $string;
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
$this->output->writeln($styled, $this->parseVerbosity($verbosity));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return array();
|
||||
}
|
||||
/**
|
||||
* Write a string as comment output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function comment($string, $verbosity = null)
|
||||
{
|
||||
$this->line($string, 'comment', $verbosity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output implementation.
|
||||
*
|
||||
* @return \Symfony\Component\Console\Output\OutputInterface
|
||||
*/
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
/**
|
||||
* Write a string as question output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function question($string, $verbosity = null)
|
||||
{
|
||||
$this->line($string, 'question', $verbosity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Laravel application instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
public function getLaravel()
|
||||
{
|
||||
return $this->laravel;
|
||||
}
|
||||
/**
|
||||
* Write a string as error output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function error($string, $verbosity = null)
|
||||
{
|
||||
$this->line($string, 'error', $verbosity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Laravel application instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Foundation\Application $laravel
|
||||
* @return void
|
||||
*/
|
||||
public function setLaravel(LaravelApplication $laravel)
|
||||
{
|
||||
$this->laravel = $laravel;
|
||||
}
|
||||
/**
|
||||
* Write a string as warning output.
|
||||
*
|
||||
* @param string $string
|
||||
* @param null|int|string $verbosity
|
||||
* @return void
|
||||
*/
|
||||
public function warn($string, $verbosity = null)
|
||||
{
|
||||
if (! $this->output->getFormatter()->hasStyle('warning')) {
|
||||
$style = new OutputFormatterStyle('yellow');
|
||||
|
||||
$this->output->getFormatter()->setStyle('warning', $style);
|
||||
}
|
||||
|
||||
$this->line($string, 'warning', $verbosity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the verbosity level in terms of Symfony's OutputInterface level.
|
||||
*
|
||||
* @param string|int $level
|
||||
* @return int
|
||||
*/
|
||||
protected function parseVerbosity($level = null)
|
||||
{
|
||||
if (isset($this->verbosityMap[$level])) {
|
||||
$level = $this->verbosityMap[$level];
|
||||
} elseif (! is_int($level)) {
|
||||
$level = $this->verbosity;
|
||||
}
|
||||
|
||||
return $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the verbosity level.
|
||||
*
|
||||
* @param string|int $level
|
||||
* @return void
|
||||
*/
|
||||
protected function setVerbosity($level)
|
||||
{
|
||||
$this->verbosity = $this->parseVerbosity($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command arguments.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getArguments()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the console command options.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getOptions()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the output implementation.
|
||||
*
|
||||
* @return \Symfony\Component\Console\Output\OutputInterface
|
||||
*/
|
||||
public function getOutput()
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Laravel application instance.
|
||||
*
|
||||
* @return \Illuminate\Contracts\Foundation\Application
|
||||
*/
|
||||
public function getLaravel()
|
||||
{
|
||||
return $this->laravel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Laravel application instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Container\Container $laravel
|
||||
* @return void
|
||||
*/
|
||||
public function setLaravel($laravel)
|
||||
{
|
||||
$this->laravel = $laravel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user