@@ -18,9 +18,9 @@ |
||
| 18 | 18 | protected function configure() |
| 19 | 19 | { |
| 20 | 20 | $this->setName('discovery:list') |
| 21 | - ->setDescription('List the values of the asset type passed in parameter (or list all asset types if no parameter is passed)') |
|
| 22 | - ->addArgument('asset-type', InputArgument::OPTIONAL, 'The asset type to list') |
|
| 23 | - ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt or json)', 'txt'); |
|
| 21 | + ->setDescription('List the values of the asset type passed in parameter (or list all asset types if no parameter is passed)') |
|
| 22 | + ->addArgument('asset-type', InputArgument::OPTIONAL, 'The asset type to list') |
|
| 23 | + ->addOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt or json)', 'txt'); |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $output->writeln(sprintf('<error>Could not find the "%s" asset type.</error>', $assetTypeName)); |
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | - $assetTypes = [ $assetTypes[$assetTypeName] ]; |
|
| 36 | + $assetTypes = [$assetTypes[$assetTypeName]]; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | switch ($input->getOption('format')) { |
@@ -5,15 +5,12 @@ |
||
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | use Composer\Command\BaseCommand; |
| 8 | -use Composer\Factory; |
|
| 9 | 8 | use Symfony\Component\Console\Input\InputArgument; |
| 10 | 9 | use Symfony\Component\Console\Input\InputInterface; |
| 11 | 10 | use Symfony\Component\Console\Input\InputOption; |
| 12 | 11 | use Symfony\Component\Console\Output\OutputInterface; |
| 13 | 12 | use TheCodingMachine\Discovery\Asset; |
| 14 | 13 | use TheCodingMachine\Discovery\AssetOperation; |
| 15 | -use TheCodingMachine\Discovery\AssetsBuilder; |
|
| 16 | -use TheCodingMachine\Discovery\AssetType; |
|
| 17 | 14 | use TheCodingMachine\Discovery\DiscoveryFileLoader; |
| 18 | 15 | use TheCodingMachine\Discovery\Dumper; |
| 19 | 16 | |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | protected function configure() |
| 23 | 23 | { |
| 24 | 24 | $this->setName('discovery:add') |
| 25 | - ->setDescription('Add an asset') |
|
| 26 | - ->addArgument('asset-type', InputArgument::REQUIRED, 'The asset type') |
|
| 27 | - ->addArgument('value', InputArgument::REQUIRED, 'The asset to add') |
|
| 28 | - ->addOption('priority', 'p', InputOption::VALUE_REQUIRED, 'The priority', 0.0); |
|
| 25 | + ->setDescription('Add an asset') |
|
| 26 | + ->addArgument('asset-type', InputArgument::REQUIRED, 'The asset type') |
|
| 27 | + ->addArgument('value', InputArgument::REQUIRED, 'The asset to add') |
|
| 28 | + ->addOption('priority', 'p', InputOption::VALUE_REQUIRED, 'The priority', 0.0); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -5,13 +5,8 @@ |
||
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | use Composer\Command\BaseCommand; |
| 8 | -use Composer\Factory; |
|
| 9 | -use Symfony\Component\Console\Input\InputArgument; |
|
| 10 | 8 | use Symfony\Component\Console\Input\InputInterface; |
| 11 | -use Symfony\Component\Console\Input\InputOption; |
|
| 12 | 9 | use Symfony\Component\Console\Output\OutputInterface; |
| 13 | -use TheCodingMachine\Discovery\AssetsBuilder; |
|
| 14 | -use TheCodingMachine\Discovery\AssetType; |
|
| 15 | 10 | use TheCodingMachine\Discovery\Dumper; |
| 16 | 11 | |
| 17 | 12 | class DumpCommand extends BaseCommand |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | protected function configure() |
| 20 | 20 | { |
| 21 | 21 | $this->setName('discovery:dump') |
| 22 | - ->setDescription('Regenerates the Discovery class (in the .discovery folder). This is automatically triggered on install and update.'); |
|
| 22 | + ->setDescription('Regenerates the Discovery class (in the .discovery folder). This is automatically triggered on install and update.'); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -6,17 +6,13 @@ |
||
| 6 | 6 | |
| 7 | 7 | use Composer\Composer; |
| 8 | 8 | use Composer\EventDispatcher\EventSubscriberInterface; |
| 9 | -use Composer\Factory; |
|
| 10 | 9 | use Composer\IO\IOInterface; |
| 11 | -use Composer\Package\PackageInterface; |
|
| 12 | 10 | use Composer\Plugin\Capability\CommandProvider; |
| 13 | 11 | use Composer\Plugin\Capable; |
| 14 | 12 | use Composer\Plugin\PluginInterface; |
| 15 | 13 | use Composer\Script\Event; |
| 16 | 14 | use Composer\Script\ScriptEvents; |
| 17 | -use Symfony\Component\Filesystem\Filesystem; |
|
| 18 | 15 | use TheCodingMachine\Discovery\Commands\CommandProvider as DiscoveryCommandProvider; |
| 19 | -use TheCodingMachine\Discovery\Commands\DumpCommand; |
|
| 20 | 16 | |
| 21 | 17 | class DiscoveryPlugin implements PluginInterface, EventSubscriberInterface, Capable |
| 22 | 18 | { |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <?php |
| 2 | -declare(strict_types=1); |
|
| 2 | +declare(strict_types = 1); |
|
| 3 | 3 | |
| 4 | 4 | namespace TheCodingMachine\Discovery; |
| 5 | 5 | |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | $simple = $this->asset->toSimpleArray(); |
| 113 | 113 | if ($this->operation === self::REMOVE) { |
| 114 | 114 | if (is_string($simple)) { |
| 115 | - $simple = [ 'value' => $simple ]; |
|
| 115 | + $simple = ['value' => $simple]; |
|
| 116 | 116 | } |
| 117 | 117 | $simple['action'] = self::REMOVE; |
| 118 | 118 | } |
@@ -4,15 +4,11 @@ |
||
| 4 | 4 | namespace TheCodingMachine\Discovery\Commands; |
| 5 | 5 | |
| 6 | 6 | |
| 7 | -use Composer\Command\BaseCommand; |
|
| 8 | -use Composer\Factory; |
|
| 9 | 7 | use Symfony\Component\Console\Input\InputArgument; |
| 10 | 8 | use Symfony\Component\Console\Input\InputInterface; |
| 11 | -use Symfony\Component\Console\Input\InputOption; |
|
| 12 | 9 | use Symfony\Component\Console\Output\OutputInterface; |
| 13 | 10 | use TheCodingMachine\Discovery\Asset; |
| 14 | 11 | use TheCodingMachine\Discovery\AssetOperation; |
| 15 | -use TheCodingMachine\Discovery\AssetsBuilder; |
|
| 16 | 12 | use TheCodingMachine\Discovery\AssetType; |
| 17 | 13 | use TheCodingMachine\Discovery\DiscoveryFileLoader; |
| 18 | 14 | use TheCodingMachine\Discovery\Dumper; |
@@ -22,9 +22,9 @@ |
||
| 22 | 22 | protected function configure() |
| 23 | 23 | { |
| 24 | 24 | $this->setName('discovery:remove') |
| 25 | - ->setDescription('Remove an asset') |
|
| 26 | - ->addArgument('asset-type', InputArgument::REQUIRED, 'The asset type') |
|
| 27 | - ->addArgument('value', InputArgument::REQUIRED, 'The asset to remove'); |
|
| 25 | + ->setDescription('Remove an asset') |
|
| 26 | + ->addArgument('asset-type', InputArgument::REQUIRED, 'The asset type') |
|
| 27 | + ->addArgument('value', InputArgument::REQUIRED, 'The asset to remove'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | protected function execute(InputInterface $input, OutputInterface $output) |
@@ -42,7 +42,6 @@ |
||
| 42 | 42 | * Find discovery.json files in the passed repository and builds an asset type. |
| 43 | 43 | * |
| 44 | 44 | * @param RepositoryInterface $repository |
| 45 | - * @param RootPackageInterface $rootPackage |
|
| 46 | 45 | * @return array|AssetType[] |
| 47 | 46 | */ |
| 48 | 47 | public function findAssetTypes(RepositoryInterface $repository) : array |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | $orderedPackageList = PackagesOrderer::reorderPackages($unorderedPackagesList); |
| 53 | 53 | |
| 54 | - $packages = array_filter($orderedPackageList, function (PackageInterface $package) { |
|
| 54 | + $packages = array_filter($orderedPackageList, function(PackageInterface $package) { |
|
| 55 | 55 | $packageInstallPath = $this->getInstallPath($package); |
| 56 | 56 | |
| 57 | 57 | return file_exists($packageInstallPath.'/discovery.json'); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $assetTypes = $this->getAssetsBuilder()->findAssetTypes($compositeRepos); |
| 44 | 44 | |
| 45 | 45 | // Let's get an array of values, indexed by asset type (to store in the discovery_values.php file) |
| 46 | - $values = array_map(function (AssetType $assetType) { |
|
| 46 | + $values = array_map(function(AssetType $assetType) { |
|
| 47 | 47 | return $assetType->getValues(); |
| 48 | 48 | }, $assetTypes); |
| 49 | 49 | |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | return '.var_export($values, true).";\n"); |
| 52 | 52 | |
| 53 | 53 | // Let's get an array of assetTypes, indexed by asset type (to store in the discovery_asset_types.php file) |
| 54 | - $assetTypes = array_map(function (AssetType $assetType) { |
|
| 54 | + $assetTypes = array_map(function(AssetType $assetType) { |
|
| 55 | 55 | return $assetType->jsonSerialize(); |
| 56 | 56 | }, $assetTypes); |
| 57 | 57 | |