/
dimamir
/
Wsdl_PackageGenerator
Обзор
Документация
Войти
/
dimamir
/
Wsdl_PackageGenerator
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/Command/AbstractCommand.php
52 строки
1 KB
Mikaël DELSOL
Add SonarCloud properties, add Sonar Github Workflow
10 фев 2023, 01:00
Не верифицирован
10 фев 2023, 01:00
9c7e6ca
Код
Авторство
О чём код?
<?php declare(strict_types=1); namespace WsdlToPhp\PackageGenerator\Command; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; abstract class AbstractCommand extends Command { public const EXIT_OK = 0; protected InputInterface $input; protected OutputInterface $output; protected function configure(): void { $this->addOption( 'force', null, InputOption::VALUE_NONE, 'If true, then package is really generated otherwise debug information are displayed' ); } protected function execute(InputInterface $input, OutputInterface $output): int { $this->input = $input; $this->output = $output; return self::EXIT_OK; } protected function canExecute(): bool { return true === (bool) $this->getOptionValue('force'); } protected function writeLn($messages, int $type = OutputInterface::OUTPUT_NORMAL): void { $this->output->writeln($messages, $type); } protected function getOptionValue(string $name) { return $this->input->getOption($name); } }