Просмотр файла vendor/symfony/console/Attribute/AsCommand.php

Размер файла: 861B
  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.  
  12. namespace Symfony\Component\Console\Attribute;
  13.  
  14. /**
  15. * Service tag to autoconfigure commands.
  16. */
  17. #[\Attribute(\Attribute::TARGET_CLASS)]
  18. class AsCommand
  19. {
  20. public function __construct(
  21. public string $name,
  22. public ?string $description = null,
  23. array $aliases = [],
  24. bool $hidden = false,
  25. ) {
  26. if (!$hidden && !$aliases) {
  27. return;
  28. }
  29.  
  30. $name = explode('|', $name);
  31. $name = array_merge($name, $aliases);
  32.  
  33. if ($hidden && '' !== $name[0]) {
  34. array_unshift($name, '');
  35. }
  36.  
  37. $this->name = implode('|', $name);
  38. }
  39. }