Spec-Zone.ru › Laravel 10

BaseCommand

class BaseCommand extends Command (View source)

Свойства

CallsCommands
ConfiguresPrompts
HasParameters
InteractsWithIO
InteractsWithSignals
PromptsForMissingInput
Macroable

Свойства

protected Factory internal $components

Фабрика компонентов консоли.

from InteractsWithIO
protected InputInterface $input

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

from InteractsWithIO
protected OutputStyle $output

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

from InteractsWithIO
protected int $verbosity

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

from InteractsWithIO
protected array $verbosityMap

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

from InteractsWithIO
protected Signals|null $signals

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

from InteractsWithSignals
static protected array $macros

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

from Macroable
protected Application $laravel

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

from Command
protected string $signature

Имя и синтаксис команды консоли.

from Command
protected string $name

Имя команды консоли.

from Command
protected string|null $description

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

from Command
protected string $help

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

from Command
protected bool $hidden

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

from Command
protected bool $isolated

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

from Command
protected int $isolatedExitCode

Код выхода по умолчанию для изолированных команд.

from Command
protected array $aliases

Псевдонимы имени команды консоли.

from Command

Методы

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

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

из CallsCommands
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 configurePrompts(InputInterface $input)

Настроить отказоустойчивость подсказок.

из ConfiguresPrompts
смешанный promptUntilValid(Closure $prompt, bool|string $required, Closure|null $validate)

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

из ConfiguresPrompts
void restorePrompts()

Восстановить вывод подсказок.

из ConfiguresPrompts
void specifyParameters()

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

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

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

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

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

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

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

из InteractsWithIO
массив|строка|bool|null argument(string|null $key = null)

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

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

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

из InteractsWithIO
bool hasOption(string $name)

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

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

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

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

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

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

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

из InteractsWithIO
смешанный ask(string $question, string|null $default = null)

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

из InteractsWithIO
смешанный anticipate(string $question, array|callable $choices, string|null $default = null)

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

из InteractsWithIO
смешанный askWithCompletion(string $question, array|callable $choices, string|null $default = null)

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

из InteractsWithIO
смешанный secret(string $question, bool $fallback = true)

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

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

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

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

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

из InteractsWithIO
смешанный|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)

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

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

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

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

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

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

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

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

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

from InteractsWithIO
void alert(string $string, int|string|null $verbosity = null)

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

from InteractsWithIO
$this newLine(int $count = 1)

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

from InteractsWithIO
void setInput(InputInterface $input)

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

from InteractsWithIO
void setOutput(OutputStyle $output)

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

from InteractsWithIO
void setVerbosity(string|int $level)

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

from InteractsWithIO
int parseVerbosity(string|int|null $level = null)

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

from InteractsWithIO
OutputStyle getOutput()

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

from InteractsWithIO
Factory outputComponents()

Получить реализацию фабрики компонентов вывода.

from InteractsWithIO
trap($signals, $callback)

Без описания

from InteractsWithSignals
void untrap()

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

from InteractsWithSignals
void interact(InputInterface $input, OutputInterface $output)

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

from PromptsForMissingInput
void promptForMissingArguments(InputInterface $input, OutputInterface $output)

Запросить у пользователя отсутствующие аргументы.

from PromptsForMissingInput
array promptForMissingArgumentsUsing()

Запрашивать отсутствующие аргументы ввода, используя возвращаемые вопросы.

from PromptsForMissingInput
void afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)

Выполнить действия после того, как пользователя попросили предоставить недостающие аргументы.

from PromptsForMissingInput
bool didReceiveOptions(InputInterface $input)

Содержит ли ввод какие-либо параметры, отличающиеся от значений по умолчанию.

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

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

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

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

from Macroable
static bool hasMacro(string $name)

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

from Macroable
static void flushMacros()

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

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

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

from Macroable
mixed __call(string $method, array $parameters)

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

from Macroable
void __construct()

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

from Command
void configureUsingFluentDefinition()

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

from Command
void configureIsolation()

Настроить команду консоли для изоляции.

from Command
int run(InputInterface $input, OutputInterface $output)

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

from Команда
int execute(InputInterface $input, OutputInterface $output)

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

from Команда
CommandMutex commandIsolationMutex()

Получить экземпляр мьютекса изоляции команды для команды.

from Команда
bool isHidden()

{@inheritdoc}

from Команда
Команда setHidden(bool $hidden = true)

{@inheritdoc}

from Команда
Приложение getLaravel()

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

from Команда
void setLaravel(Контейнер $laravel)

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

from Команда
array getMigrationPaths()

Получить все пути к миграциям.

bool usingRealPath()

Определить, являются ли заданные пути "реальными" путями, предварительно разрешенными.

string getMigrationPath()

Получить путь к каталогу миграций.

Подробности

abstract protected Command resolveCommand(Command|string $command)

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

Parameters

Command|string $command

Return Value

Command

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

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

Parameters

Command|string $command
array $arguments

Return Value

int

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

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

Parameters

Command|string $command
array $arguments

Return Value

int

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

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

Parameters

Command|string $command
array $arguments

Return Value

int

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

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

Parameters

Command|string $command
array $arguments
OutputInterface $output

Return Value

int

protected ArrayInput createInputFromArguments(array $arguments)

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

Parameters

array $arguments

Return Value

ArrayInput

protected array context()

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

Return Value

array

protected void configurePrompts(InputInterface $input)

Настроить отступы подсказки.

Parameters

InputInterface $input

Return Value

void

protected mixed promptUntilValid(Closure $prompt, bool|string $required, Closure|null $validate)

Запрашивать у пользователя, пока не будет выполнено данное обратное вызывание проверки.

Parameters

Closure $prompt
bool|string $required
Closure|null $validate

Return Value

mixed

protected void restorePrompts()

Восстановить вывод подсказок.

Return Value

void

protected void specifyParameters()

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

Return Value

void

protected array getArguments()

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

Return Value

array

protected array getOptions()

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

Return Value

array

bool hasArgument(string|int $name)

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

Parameters

string|int $name

Return Value

bool

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

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

Parameters

string|null $key

Return Value

array|string|bool|null

array arguments()

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

Return Value

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|int|null $default = null, mixed|null $attempts = null, bool $multiple = false)

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

Параметры

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

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

string|array

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

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

Параметры

array $headers
Arrayable|array $rows
TableStyle|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

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

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

Параметры

string $string
int|string|null $verbosity

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

void

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

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

Параметры

string $string
int|string|null $verbosity

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

void

$this newLine(int $count = 1)

Вставить пустую строку.

Параметры

int $count

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

$this

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

Factory outputComponents()

Получить реализацию фабрики компонентов вывода.

Return Value

Factory

trap($signals, $callback)

Без описания

Parameters

$signals
$callback

void untrap()

internal

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

Return Value

void

protected void interact(InputInterface $input, OutputInterface $output)

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

Parameters

InputInterface $input
OutputInterface $output

Return Value

void

protected void promptForMissingArguments(InputInterface $input, OutputInterface $output)

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

Parameters

InputInterface $input
OutputInterface $output

Return Value

void

protected array promptForMissingArgumentsUsing()

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

Return Value

array

protected void afterPromptingForMissingArguments(InputInterface $input, OutputInterface $output)

Выполнить действия после запроса у пользователя недостающих аргументов.

Parameters

InputInterface $input
OutputInterface $output

Return Value

void

protected bool didReceiveOptions(InputInterface $input)

Ввод содержит какие-либо опции, отличающиеся от значений по умолчанию.

Parameters

InputInterface $input

Return Value

bool

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
END_OF_DOCUMENT_MARKER

protected void configureIsolation()

Настроить консольную команду для изоляции.

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

void

int run(InputInterface $input, OutputInterface $output)

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

Параметры

InputInterface $input
OutputInterface $output

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

int

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

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

Параметры

InputInterface $input
OutputInterface $output

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

int

protected CommandMutex commandIsolationMutex()

Получить экземпляр мьютекса изоляции команд для команды.

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

CommandMutex

bool isHidden()

{@inheritdoc}

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

bool

Command setHidden(bool $hidden = true)

{@inheritdoc}

Параметры

bool $hidden

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

Command

Application getLaravel()

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

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

Application

void setLaravel(Container $laravel)

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

Параметры

Container $laravel

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

void

protected array getMigrationPaths()

Получить все пути миграций.

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

array

protected bool usingRealPath()

Определить, являются ли заданные пути "реальными" путями, предварительно разрешёнными.

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

bool

protected string getMigrationPath()

Получить путь к каталогу миграций.

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

string

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

Spec-Zone.ru

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