AsCommand.php
32 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 Matomo\Dependencies\Symfony\Component\Console\Attribute; |
| 12 | |
| 13 | /** |
| 14 | * Service tag to autoconfigure commands. |
| 15 | */ |
| 16 | #[\Attribute(\Attribute::TARGET_CLASS)] |
| 17 | class AsCommand |
| 18 | { |
| 19 | public function __construct(public string $name, public ?string $description = null, array $aliases = [], bool $hidden = \false) |
| 20 | { |
| 21 | if (!$hidden && !$aliases) { |
| 22 | return; |
| 23 | } |
| 24 | $name = explode('|', $name); |
| 25 | $name = array_merge($name, $aliases); |
| 26 | if ($hidden && '' !== $name[0]) { |
| 27 | array_unshift($name, ''); |
| 28 | } |
| 29 | $this->name = implode('|', $name); |
| 30 | } |
| 31 | } |
| 32 |