AsCommand.php
33 lines
| 1 | <?php |
| 2 | |
| 3 | /* |
| 4 | * This file is part of the Symfony package. |
| 5 | * |
| 6 | * (c) Fabien Potencier <fabien@symfony.com> |
| 7 | * |
| 8 | * For the full copyright and license information, please view the LICENSE |
| 9 | * file that was distributed with this source code. |
| 10 | */ |
| 11 | namespace IAWP_SCOPED\Symfony\Component\Console\Attribute; |
| 12 | |
| 13 | /** |
| 14 | * Service tag to autoconfigure commands. |
| 15 | * @internal |
| 16 | */ |
| 17 | #[\Attribute(\Attribute::TARGET_CLASS)] |
| 18 | class AsCommand |
| 19 | { |
| 20 | public function __construct(public string $name, public ?string $description = null, array $aliases = [], bool $hidden = \false) |
| 21 | { |
| 22 | if (!$hidden && !$aliases) { |
| 23 | return; |
| 24 | } |
| 25 | $name = \explode('|', $name); |
| 26 | $name = \array_merge($name, $aliases); |
| 27 | if ($hidden && '' !== $name[0]) { |
| 28 | \array_unshift($name, ''); |
| 29 | } |
| 30 | $this->name = \implode('|', $name); |
| 31 | } |
| 32 | } |
| 33 |