PhpGitHooks\Module\Configuration\Service\PhpCsConfigurator::configure PHP Метод

configure() публичный статический Метод

public static configure ( Composer\IO\IOInterface $io, PhpCs $phpCs ) : PhpCs | Module\Configuration\Model\ToolInterface
$io Composer\IO\IOInterface
$phpCs PhpGitHooks\Module\Configuration\Domain\PhpCs
Результат PhpGitHooks\Module\Configuration\Domain\PhpCs | Module\Configuration\Model\ToolInterface
    public static function configure(IOInterface $io, PhpCs $phpCs)
    {
        if (true === $phpCs->isUndefined()) {
            $answer = $io->ask(HookQuestions::PHPCS_TOOL, HookQuestions::DEFAULT_TOOL_ANSWER);
            $phpCs = $phpCs->setEnabled(new Enabled(HookQuestions::DEFAULT_TOOL_ANSWER === strtoupper($answer)));
            if (true === $phpCs->isEnabled()) {
                $standardAnswer = $io->ask(HookQuestions::PHPCS_STANDARD, null);
                /** @var PhpCs $phpCs */
                $phpCs = $phpCs->addStandard(new PhpCsStandard($standardAnswer));
            }
        }
        return $phpCs;
    }

Usage Example

Пример #1
0
 /**
  * @param ExecuteInterface $execute
  *
  * @return ExecuteInterface
  */
 private function configTools(ExecuteInterface $execute)
 {
     $tools = $execute->execute();
     $tools[0] = ComposerConfigurator::configure($this->io, $tools[0]);
     $tools[1] = JsonLintConfigurator::configure($this->io, $tools[1]);
     $tools[2] = PhpLintConfigurator::configure($this->io, $tools[2]);
     $tools[3] = PhpMdConfigurator::configure($this->io, $tools[3]);
     $tools[4] = PhpCsConfigurator::configure($this->io, $tools[4]);
     $tools[5] = PhpCsFixerConfigurator::configure($this->io, $tools[5]);
     $tools[6] = PhpUnitConfigurator::configure($this->io, $tools[6]);
     $tools[7] = PhpUnitStrictCoverageConfigurator::configure($this->io, $tools[7]);
     $tools[8] = $this->phpUnitGuardCoverageConfigurator->configure($this->io, $tools[8]);
     return new Execute($tools);
 }
PhpCsConfigurator