-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathComponentInstaller.php
38 lines (35 loc) · 1.13 KB
/
ComponentInstaller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
namespace app\composer;
use Composer\Installer\LibraryInstaller;
use Composer\Package\PackageInterface;
/**
* Class ModuleInstaller
* @since 1.0
* @author Dzhamal Tayibov <[email protected]>
*/
class ComponentInstaller extends LibraryInstaller
{
/**
* {@inheritdoc}
*/
public function getInstallPath(PackageInterface $package)
{
$vendorPath = $this->composer->getConfig()->get('vendor-dir');
$pName = basename($package->getName());
if ($package->getType() === 'module-type' || $package->getType() === 'medkey-module') {
return dirname($vendorPath) . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $pName;
} elseif ($package->getType() === 'medkey-plugin') {
return dirname($vendorPath) . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $pName;
}
}
/**
* {@inheritdoc}
*/
public function supports($packageType)
{
return
'module-type' === $packageType ||
'medkey-module' === $packageType ||
'medkey-plugin' === $packageType;
}
}