|
26 | 26 |
|
27 | 27 | class CurlCommand extends AbstractCommand |
28 | 28 | { |
29 | | - public const ARGUMENT_URL = 'url'; |
30 | | - public const ARGUMENT_FILENAME = 'filename'; |
31 | | - public const OPTION_METHOD = 'method'; |
32 | | - public const OPTION_BASE_URL = 'base-url'; |
33 | | - public const OPTION_SAVE = 'save'; |
| 29 | + final public const ARGUMENT_URL = 'url'; |
| 30 | + final public const ARGUMENT_FILENAME = 'filename'; |
| 31 | + final public const OPTION_METHOD = 'method'; |
| 32 | + final public const OPTION_BASE_URL = 'base-url'; |
| 33 | + final public const OPTION_SAVE = 'save'; |
34 | 34 | protected static $defaultName = Commands::CURL; |
35 | | - private EventDispatcherInterface $eventDispatcher; |
36 | | - private ControllerResolverInterface $controllerResolver; |
37 | | - private AssetRuntime $assetRuntime; |
38 | 35 | private ?SessionInterface $session = null; |
39 | | - private RequestStack $requestStack; |
40 | | - private StorageManager $storageManager; |
41 | 36 |
|
42 | 37 | private string $url; |
43 | 38 | private string $method; |
44 | 39 | private string $filename; |
45 | 40 | private ?string $baseUrl = null; |
46 | 41 | private bool $save; |
47 | 42 |
|
48 | | - public function __construct(EventDispatcherInterface $eventDispatcher, ControllerResolverInterface $controllerResolver, RequestStack $requestStack, StorageManager $storageManager, AssetRuntime $assetRuntime) |
| 43 | + public function __construct(private readonly EventDispatcherInterface $eventDispatcher, private readonly ControllerResolverInterface $controllerResolver, private readonly RequestStack $requestStack, private readonly StorageManager $storageManager, private readonly AssetRuntime $assetRuntime) |
49 | 44 | { |
50 | 45 | parent::__construct(); |
51 | | - $this->eventDispatcher = $eventDispatcher; |
52 | | - $this->controllerResolver = $controllerResolver; |
53 | | - $this->requestStack = $requestStack; |
54 | | - $this->storageManager = $storageManager; |
55 | | - $this->assetRuntime = $assetRuntime; |
56 | 46 | } |
57 | 47 |
|
58 | 48 | protected function configure(): void |
@@ -81,20 +71,20 @@ protected function execute(InputInterface $input, OutputInterface $output): int |
81 | 71 | $this->io->writeln(\sprintf('The file %s has been generated', $this->filename)); |
82 | 72 |
|
83 | 73 | if (!$this->save && null === $this->baseUrl) { |
84 | | - return parent::EXECUTE_SUCCESS; |
| 74 | + return self::EXECUTE_SUCCESS; |
85 | 75 | } |
86 | 76 |
|
87 | 77 | $hash = $this->storageManager->saveFile($this->filename, StorageInterface::STORAGE_USAGE_ASSET); |
88 | 78 | $this->io->writeln(\sprintf('The file has been saved with the id %s', $hash)); |
89 | 79 |
|
90 | 80 | if (null === $this->baseUrl) { |
91 | | - return parent::EXECUTE_SUCCESS; |
| 81 | + return self::EXECUTE_SUCCESS; |
92 | 82 | } |
93 | 83 |
|
94 | 84 | $url = $this->getUrl($hash); |
95 | 85 | $this->io->writeln(\sprintf('The file is available at %s', $url)); |
96 | 86 |
|
97 | | - return parent::EXECUTE_SUCCESS; |
| 87 | + return self::EXECUTE_SUCCESS; |
98 | 88 | } |
99 | 89 |
|
100 | 90 | protected function performRequest(): void |
|
0 commit comments