Spec-Zone.ru › Laravel 8

Команда

класс Команда наследует Command (Просмотреть исходный код)

Трейты

CallsCommands
HasParameters
InteractsWithIO
Macroable

Свойства

protected InputInterface $input

Реализация интерфейса ввода.

из InteractsWithIO
protected OutputStyle $output

Реализация интерфейса вывода.

из InteractsWithIO
protected int $verbosity

Уровень подробности вывода по умолчанию.

из InteractsWithIO
protected array $verbosityMap

Сопоставление уровней подробности, читаемых человеком, с уровнями Symfony OutputInterface.

из InteractsWithIO
static protected array $macros

Зарегистрированные строковые макросы.

из Macroable
protected Application $laravel

Экземпляр приложения Laravel.

protected string $signature

Имя и синтаксис командной строки.

protected string $name

Имя команды.

protected string $description

Описание команды.

protected string $help

Текст справки по команде.

protected bool $hidden

Указывает, должна ли команда отображаться в списке команд Artisan.

Методы

Команда resolveCommand(Command|string $command)

Разрешить экземпляр консольной команды для данной команды.

int call(Command|string $command, array $arguments = [])

Вызвать другую консольную команду.

из CallsCommands
int callSilent(Command|string $command, array $arguments = [])

Вызвать другую консольную команду без вывода.

из CallsCommands
int callSilently(Command|string $command, array $arguments = [])

Вызвать другую консольную команду без вывода.

из CallsCommands
int runCommand(Command|string $command, array $arguments, OutputInterface $output)

Выполнить заданную консольную команду.

из CallsCommands
ArrayInput createInputFromArguments(array $arguments)

Создать экземпляр входных данных из заданных аргументов.

из CallsCommands
массив context()

Получить весь контекст, переданный команде.

из CallsCommands
void specifyParameters()

Указать аргументы и опции команды.

из HasParameters
массив getArguments()

Получить аргументы консольной команды.

из HasParameters
массив getOptions()

Получить опции консольной команды.

из HasParameters
bool hasArgument(string|int $name)

Определить, присутствует ли данный аргумент.

из InteractsWithIO
string|массив|null argument(string|null $key = null)

Получить значение аргумента команды.

из InteractsWithIO
массив arguments()

Получить все аргументы, переданные команде.

из InteractsWithIO
bool hasOption(string $name)

Определить, присутствует ли данная опция.

из InteractsWithIO
string|массив|bool|null option(string|null $key = null)

Получить значение опции команды.

из InteractsWithIO
массив options()

Получить все опции, переданные команде.

из InteractsWithIO
bool confirm(string $question, bool $default = false)

Подтвердить вопрос у пользователя.

из InteractsWithIO
mixed ask(string $question, string|null $default = null)

Задать вопрос пользователю и получить ответ.

из InteractsWithIO
mixed anticipate(string $question, array|callable $choices, string|null $default = null)

Задать вопрос пользователю с автозаполнением.

из InteractsWithIO
mixed askWithCompletion(string $question, array|callable $choices, string|null $default = null)

Задать вопрос пользователю с автозаполнением.

из InteractsWithIO
mixed secret(string $question, bool $fallback = true)

Задать вопрос пользователю, но скрыть ответ в консоли.

из InteractsWithIO
string|массив choice(string $question, array $choices, string|null $default = null, mixed|null $attempts = null, bool $multiple = false)

Предложить пользователю один вариант ответа из списка.

из InteractsWithIO
void table(array $headers, Arrayable|array $rows, string $tableStyle = 'default', array $columnStyles = [])

Форматировать ввод в текстовую таблицу.

из InteractsWithIO
mixed|void withProgressBar(iterable|int $totalSteps, Closure $callback)

Выполнить заданный обратный вызов с прогресс-баром.

из InteractsWithIO
void info(string $string, int|string|null $verbosity = null)

Вывести строку как информацию.

из InteractsWithIO
void line(string $string, string|null $style = null, int|string|null $verbosity = null)

Вывести строку в стандартный вывод.

из InteractsWithIO
void comment(string $string, int|string|null $verbosity = null)

Вывести строку как комментарий.

из InteractsWithIO
void question(string $string, int|string|null $verbosity = null)

Вывести строку как вопрос.

из InteractsWithIO
void error(string $string, int|string|null $verbosity = null)

Вывести строку как ошибку.

из InteractsWithIO
void warn(string $string, int|string|null $verbosity = null)

Вывести строку как предупреждение.

из InteractsWithIO
void alert(string $string)

Вывести строку в всплывающее окно.

из InteractsWithIO
void newLine(int $count = 1)

Вывести пустую строку.

из InteractsWithIO
void setInput(InputInterface $input)

Установить реализацию интерфейса ввода.

из InteractsWithIO
void setOutput(OutputStyle $output)

Установить реализацию интерфейса вывода.

из InteractsWithIO
void setVerbosity(string|int $level)

Установить уровень подробности.

из InteractsWithIO
int parseVerbosity(string|int|null $level = null)

Получить уровень подробности в терминах уровня OutputInterface Symfony.

из InteractsWithIO
OutputStyle getOutput()

Получить реализацию вывода.

из InteractsWithIO
static void macro(string $name, object|callable $macro)

Зарегистрировать пользовательскую макрокоманду.

из Macroable
static void mixin(object $mixin, bool $replace = true)

Добавить другой объект в класс.

из Macroable
static bool hasMacro(string $name)

Проверяет, зарегистрирована ли макрокоманда.

из Macroable
static void flushMacros()

Очистить существующие макрокоманды.

из Macroable
static mixed __callStatic(string $method, array $parameters)

Динамически обрабатывать вызовы к классу.

из Macroable
mixed __call(string $method, array $parameters)

Динамически обрабатывать вызовы к классу.

из Macroable
void __construct()

Создать новый экземпляр команды консоли.

void configureUsingFluentDefinition()

Настроить команду консоли с помощью определения fluent.

int run(InputInterface $input, OutputInterface $output)

Запустить команду консоли.

int execute(InputInterface $input, OutputInterface $output)

Выполнить команду консоли.

bool isHidden()

{@inheritdoc}

Command setHidden(bool $hidden)

{@inheritdoc}

Application getLaravel()

Получить экземпляр приложения Laravel.

void setLaravel(Container $laravel)

Установить экземпляр приложения Laravel.

Подробности

protected Command resolveCommand(Command|string $command)

Разрешить экземпляр команды консоли для заданной команды.

Параметры

Command|string $command

Возвращаемое значение

Command

int call(Command|string $command, array $arguments = [])

Вызвать другую команду консоли.

Параметры

Command|string $command
array $arguments

Возвращаемое значение

int

int callSilent(Command|string $command, array $arguments = [])

Вызвать другую команду консоли без вывода.

Параметры

Command|string $command
array $arguments

Возвращаемое значение

int

int callSilently(Command|string $command, array $arguments = [])

Вызвать другую команду консоли без вывода.

Параметры

Command|string $command
array $arguments

Возвращаемое значение

int

protected int runCommand(Command|string $command, array $arguments, OutputInterface $output)

Запустить заданную команду консоли.

Параметры

Command|string $command
array $arguments
OutputInterface $output

Возвращаемое значение

int

protected ArrayInput createInputFromArguments(array $arguments)

Создать экземпляр ввода из заданных аргументов.

Параметры

array $arguments

Возвращаемое значение

ArrayInput

protected array context()

Получить весь контекст, переданный команде.

Возвращаемое значение

array

protected void specifyParameters()

Указать аргументы и параметры команды.

Возвращаемое значение

void

protected array getArguments()

Получить аргументы команды консоли.

Возвращаемое значение

array

protected array getOptions()

Получить параметры командной консоли.

Значение возврата

array

bool hasArgument(string|int $name)

Определить, существует ли заданный аргумент.

Параметры

string|int $name

Значение возврата

bool

string|array|null argument(string|null $key = null)

Получить значение аргумента команды.

Параметры

string|null $key

Значение возврата

string|array|null

array arguments()

Получить все переданные аргументы команды.

Значение возврата

array

bool hasOption(string $name)

Определить, существует ли заданный параметр.

Параметры

string $name

Значение возврата

bool

string|array|bool|null option(string|null $key = null)

Получить значение параметра команды.

Параметры

string|null $key

Значение возврата

string|array|bool|null

array options()

Получить все переданные параметры команды.

Значение возврата

array

bool confirm(string $question, bool $default = false)

Подтвердить вопрос у пользователя.

Параметры

string $question
bool $default

Значение возврата

bool

mixed ask(string $question, string|null $default = null)

Задать вопрос пользователю и получить ответ.

Параметры

string $question
string|null $default

Значение возврата

mixed

mixed anticipate(string $question, array|callable $choices, string|null $default = null)

Задать вопрос пользователю с автодополнением.

Параметры

string $question
array|callable $choices
string|null $default

Значение возврата

mixed

mixed askWithCompletion(string $question, array|callable $choices, string|null $default = null)

Задать вопрос пользователю с автодополнением.

Параметры

string $question
array|callable $choices
string|null $default

Значение возврата

mixed

mixed secret(string $question, bool $fallback = true)

Задать вопрос пользователю, скрывая ответ в консоли.

Параметры

string $question
bool $fallback

Значение возврата

mixed

string|array choice(string $question, array $choices, string|null $default = null, mixed|null $attempts = null, bool $multiple = false)

Предложить пользователю выбрать один вариант из массива ответов.

Параметры

string $question
array $choices
string|null $default
mixed|null $attempts
bool $multiple

Значение возврата

string|array

void table(array $headers, Arrayable|array $rows, string $tableStyle = 'default', array $columnStyles = [])

Форматирование ввода в текстовую таблицу.

Параметры

array $headers
Arrayable|array $rows
string $tableStyle
array $columnStyles

Значение возврата

void

mixed|void withProgressBar(iterable|int $totalSteps, Closure $callback)

Выполнить заданный обратный вызов, отображая прогресс-бар.

Параметры

iterable|int $totalSteps
Closure $callback

Значение возврата

mixed|void

void info(string $string, int|string|null $verbosity = null)

Вывести строку как информационное сообщение.

Параметры

string $string
int|string|null $verbosity

Значение возврата

void

void line(string $string, string|null $style = null, int|string|null $verbosity = null)

Вывести строку как стандартное сообщение.

Параметры

string $string
string|null $style
int|string|null $verbosity

Значение возврата

void

void comment(string $string, int|string|null $verbosity = null)

Вывести строку как комментарий.

Параметры

string $string
int|string|null $verbosity

Значение возврата

void

void question(string $string, int|string|null $verbosity = null)

Вывести строку как вопрос.

Параметры

string $string
int|string|null $verbosity

Значение возврата

void

void error(string $string, int|string|null $verbosity = null)

Вывести строку как сообщение об ошибке.

Параметры

string $string
int|string|null $verbosity

Значение возврата

void
END_OF_DOCUMENT_MARKER

void warn(string $string, int|string|null $verbosity = null)

Вывести строку как предупреждение.

Parameters

string $string
int|string|null $verbosity

Return Value

void

void alert(string $string)

Вывести строку в окне оповещения.

Parameters

string $string

Return Value

void

void newLine(int $count = 1)

Вывести пустую строку.

Parameters

int $count

Return Value

void

void setInput(InputInterface $input)

Установить реализацию интерфейса ввода.

Parameters

InputInterface $input

Return Value

void

void setOutput(OutputStyle $output)

Установить реализацию интерфейса вывода.

Parameters

OutputStyle $output

Return Value

void

protected void setVerbosity(string|int $level)

Установить уровень подробности.

Parameters

string|int $level

Return Value

void

protected int parseVerbosity(string|int|null $level = null)

Получить уровень подробности в терминах уровня OutputInterface Symfony.

Parameters

string|int|null $level

Return Value

int

OutputStyle getOutput()

Получить реализацию вывода.

Return Value

OutputStyle

static void macro(string $name, object|callable $macro)

Зарегистрировать пользовательский макрос.

Parameters

string $name
object|callable $macro

Return Value

void

static void mixin(object $mixin, bool $replace = true)

Смешать другой объект в класс.

Parameters

object $mixin
bool $replace

Return Value

void

Exceptions

ReflectionException

static bool hasMacro(string $name)

Проверяет, зарегистрирован ли макрос.

Parameters

string $name

Return Value

bool

static void flushMacros()

Очистить существующие макросы.

Return Value

void

static mixed __callStatic(string $method, array $parameters)

Динамически обработать вызовы класса.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

mixed __call(string $method, array $parameters)

Динамически обработать вызовы класса.

Parameters

string $method
array $parameters

Return Value

mixed

Exceptions

BadMethodCallException

void __construct()

Создать новый экземпляр команды консоли.

Return Value

void

protected void configureUsingFluentDefinition()

Настроить команду консоли с помощью определения fluent.

Return Value

void

int run(InputInterface $input, OutputInterface $output)

Запустить команду консоли.

Parameters

InputInterface $input
OutputInterface $output

Return Value

int

protected int execute(InputInterface $input, OutputInterface $output)

Выполнить команду консоли.

Parameters

InputInterface $input
OutputInterface $output

Return Value

int

bool isHidden()

{@inheritdoc}

Return Value

bool

Command setHidden(bool $hidden)

{@inheritdoc}

Parameters

bool $hidden

Return Value

Command

Application getLaravel()

Получить экземпляр приложения Laravel.

Return Value

Application

void setLaravel(Container $laravel)

Установить экземпляр приложения Laravel.

Параметры

Container $laravel

Возвращаемое значение

void

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/8.x/Illuminate/Console/Command.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API