Completed
Pull Request — master (#5)
by David
02:09
created

AbstractDiscoveryCommand   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 3
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAssetTypes() 0 9 1
1
<?php
2
3
4
namespace TheCodingMachine\Discovery\Commands;
5
6
7
use Composer\Command\BaseCommand;
8
use Composer\Factory;
9
use TheCodingMachine\Discovery\AssetsBuilder;
10
11
abstract class AbstractDiscoveryCommand extends BaseCommand
12
{
13
    /**
14
     * @return AssetType[]
15
     */
16
    protected function getAssetTypes() : array
17
    {
18
        $installationManager = $this->getComposer()->getInstallationManager();
19
        $rootDir = dirname(Factory::getComposerFile());
20
        $assetBuilder = new AssetsBuilder($installationManager, $this->getIO(), $rootDir);
21
22
        $localRepos = $this->getComposer()->getRepositoryManager()->getLocalRepository();
23
        return $assetBuilder->findAssetTypes($localRepos);
24
    }
25
}
26