protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $directoryNames = $input->getArgument('directoryNames');

        $unsupportedDirectoryNames = array_diff($directoryNames, array_keys($this->directories));

        if ([] !== $unsupportedDirectoryNames) {
            $output->writeln(
                sprintf('<error>Unsupported directory names: "%s"</error>', implode('", "', $unsupportedDirectoryNames))
            );

            return 1;
        }

        foreach ($directoryNames as $directoryName) {
            $directory = $this->directories[$directoryName];

            $output->writeln(
                sprintf('<info>Start clean directory with name "%s" at path "%s"</info>', $directoryName, $directory)
            );

            try {
                $this->cleanDirectory($directory);
            } catch (\Exception $e) {
                $output->writeln(
                    sprintf(
                        '<error>Directory with name "%s" at path "%s" could not be cleaned</error>',
                        $directoryName,
                        $directory
                    )
                );

                return 2;
            }
        }

        return 0;
    }
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $directoryNames = $input->getArgument('directoryNames');

        $unsupportedDirectoryNames = array_diff($directoryNames, array_keys($this->directories));

        if ([] !== $unsupportedDirectoryNames) {
            $output->writeln(
                sprintf('<error>Unsupported directory names: "%s"</error>', implode('", "', $unsupportedDirectoryNames))
            );

            return 1;
        }

        foreach ($directoryNames as $directoryName) {
            $directory = $this->directories[$directoryName];

            $output->writeln(
                sprintf('<info>Start clean directory with name "%s" at path "%s"</info>', $directoryName, $directory)
            );

            try {
                $this->cleanDirectory($directory);
            } catch (\Exception $e) {
                $output->writeln(
                    sprintf(
                        '<error>Directory with name "%s" at path "%s" could not be cleaned</error>',
                        $directoryName,
                        $directory
                    )
                );

                return 2;
            }
        }

        return 0;
    }
@param InputInterface  $input
@param OutputInterface $output

@return int

@throws \InvalidArgumentException