|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace Stolt\LeanPackage\Configuration; |
| 6 | + |
| 7 | +use Laravel\AgentDetector\AgentDetector; |
| 8 | +use Symfony\Component\Console\Input\InputInterface; |
| 9 | + |
| 10 | +final class Factory |
| 11 | +{ |
| 12 | + public function createValidationConfig( |
| 13 | + InputInterface $input |
| 14 | + ): Validation { |
| 15 | + return new Validation( |
| 16 | + (string) $input->getArgument('directory'), |
| 17 | + (bool) $input->getOption('dry-run'), |
| 18 | + AgentDetector::detect()->isAgent === true, |
| 19 | + ); |
| 20 | + } |
| 21 | + |
| 22 | + public function createCreationConfig( |
| 23 | + InputInterface $input |
| 24 | + ): Creation { |
| 25 | + return new Creation( |
| 26 | + (string) $input->getArgument('directory'), |
| 27 | + (bool) $input->getOption('force'), |
| 28 | + (string) $input->getOption('flavour'), |
| 29 | + (bool) $input->getOption('dry-run'), |
| 30 | + AgentDetector::detect()->isAgent === true, |
| 31 | + ); |
| 32 | + } |
| 33 | + |
| 34 | + public function createReformattingConfig( |
| 35 | + InputInterface $input |
| 36 | + ): Reformatting { |
| 37 | + return new Reformatting( |
| 38 | + (string) $input->getArgument('directory'), |
| 39 | + (bool) $input->getOption('sort-alphabetically'), |
| 40 | + (bool) $input->getOption('sort-from-directories-to-files'), |
| 41 | + (bool) $input->getOption('group'), |
| 42 | + (bool) $input->getOption('dry-run'), |
| 43 | + AgentDetector::detect()->isAgent === true, |
| 44 | + ); |
| 45 | + } |
| 46 | + |
| 47 | + public function createUpdatingConfig(InputInterface $input |
| 48 | + ): Updating { |
| 49 | + return new Updating( |
| 50 | + (string) $input->getArgument('directory'), |
| 51 | + (bool) $input->getOption('reformat-export-ignores'), |
| 52 | + (bool) $input->getOption('migrate-to-negated-export-ignores'), |
| 53 | + (bool) $input->getOption('group'), |
| 54 | + (bool) $input->getOption('dry-run'), |
| 55 | + AgentDetector::detect()->isAgent === true, |
| 56 | + ); |
| 57 | + } |
| 58 | +} |
0 commit comments