Final Class Yiisoft\Yii\Console\Application
| Inheritance | Yiisoft\Yii\Console\Application » Symfony\Component\Console\Application |
|---|
Public Methods
Protected Methods
| Method | Description | Defined By |
|---|---|---|
| doRenderThrowable() | Yiisoft\Yii\Console\Application |
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| NAME | 'Yii Console' | Yiisoft\Yii\Console\Application | |
| VERSION | '1.0' | Yiisoft\Yii\Console\Application |
Method Details
| public mixed __construct ( string $name = self::NAME, string $version = self::VERSION ) | ||
| $name | string | |
| $version | string | |
public function __construct(string $name = self::NAME, string $version = self::VERSION)
{
parent::__construct($name, $version);
}
| public void addOptions ( \Symfony\Component\Console\Input\InputOption $options ) | ||
| $options | \Symfony\Component\Console\Input\InputOption | |
public function addOptions(InputOption $options): void
{
$this
->getDefinition()
->addOption($options);
}
| protected void doRenderThrowable ( Throwable $e, \Symfony\Component\Console\Output\OutputInterface $output ) | ||
| $e | Throwable | |
| $output | \Symfony\Component\Console\Output\OutputInterface | |
protected function doRenderThrowable(Throwable $e, OutputInterface $output): void
{
parent::doRenderThrowable($e, $output);
// Friendly Exception support
if ($e instanceof FriendlyExceptionInterface) {
if ($output instanceof StyleInterface) {
$output->title($e->getName());
if (($solution = $e->getSolution()) !== null) {
$output->note($solution);
}
$output->newLine();
} else {
$output->writeln('<fg=red>' . $e->getName() . '</>');
if (($solution = $e->getSolution()) !== null) {
$output->writeln('<fg=yellow>' . $solution . '</>');
}
$output->writeln('');
}
}
$output->writeln($e->getTraceAsString());
}
| public string extractNamespace ( string $name, integer|null $limit = null ) | ||
| $name | string | |
| $limit | integer|null | |
public function extractNamespace(string $name, ?int $limit = null): string
{
return parent::extractNamespace(str_replace('/', ':', $name), $limit);
}
| public array getNamespaces ( ) |
public function getNamespaces(): array
{
$namespaces = [];
foreach ($this->all() as $command) {
if ($command->isHidden()) {
continue;
}
$namespaces[] = $this->extractAllNamespaces($command->getName());
/** @var string $alias */
foreach ($command->getAliases() as $alias) {
$namespaces[] = $this->extractAllNamespaces($alias);
}
}
return array_values(array_unique(array_filter(array_merge([], ...$namespaces))));
}
| public void renderThrowable ( Throwable $e, \Symfony\Component\Console\Output\OutputInterface $output ) | ||
| $e | Throwable | |
| $output | \Symfony\Component\Console\Output\OutputInterface | |
public function renderThrowable(Throwable $e, OutputInterface $output): void
{
$output->writeln('', OutputInterface::VERBOSITY_QUIET);
$this->doRenderThrowable($e, $output);
}
| public void setDispatcher ( \Symfony\Contracts\EventDispatcher\EventDispatcherInterface $dispatcher ) | ||
| $dispatcher | \Symfony\Contracts\EventDispatcher\EventDispatcherInterface | |
public function setDispatcher(EventDispatcherInterface $dispatcher): void
{
$this->dispatcher = $dispatcher;
parent::setDispatcher($dispatcher);
}
| public void shutdown ( integer $exitCode ) | ||
| $exitCode | integer | |
public function shutdown(int $exitCode): void
{
if ($this->dispatcher !== null) {
$this->dispatcher->dispatch(new ApplicationShutdown($exitCode));
}
}
| public void start ( \Symfony\Component\Console\Input\ArgvInput|null $input = null ) | ||
| $input | \Symfony\Component\Console\Input\ArgvInput|null | |
public function start(?ArgvInput $input = null): void
{
if ($this->dispatcher !== null && $input !== null) {
$this->dispatcher->dispatch(new ApplicationStartup($input->getFirstArgument()));
}
}
Signup or Login in order to comment.