Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge bba4d33 into c20c1ab
Browse files Browse the repository at this point in the history
  • Loading branch information
Mezzle committed Nov 2, 2017
2 parents c20c1ab + bba4d33 commit f69bc19
Showing 1 changed file with 44 additions and 40 deletions.
84 changes: 44 additions & 40 deletions src/ComponentInstaller.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,48 +222,52 @@ private function loadModuleClassesDependencies(PackageInterface $package)

$autoload = $package->getAutoload();
foreach ($autoload as $type => $map) {
foreach ($map as $namespace => $path) {
switch ($type) {
case 'classmap':
$fullPath = sprintf('%s/%s', $packagePath, $path);
if (is_dir(rtrim($fullPath, '/'))) {
$modulePath = sprintf('%s%s', $fullPath, 'Module.php');
} elseif (substr($path, -10) === 'Module.php') {
$modulePath = $fullPath;
} else {
foreach ($map as $namespace => $paths) {
$paths = (array)$paths;

foreach ($paths as $path) {
switch ($type) {
case 'classmap':
$fullPath = sprintf('%s/%s', $packagePath, $path);
if (is_dir(rtrim($fullPath, '/'))) {
$modulePath = sprintf('%s%s', $fullPath, 'Module.php');
} elseif (substr($path, -10) === 'Module.php') {
$modulePath = $fullPath;
} else {
continue 2;
}
break;
case 'files':
if (substr($path, -10) !== 'Module.php') {
continue 2;
}
$modulePath = sprintf('%s/%s', $packagePath, $path);
break;
case 'psr-0':
$modulePath = sprintf(
'%s/%s%s%s',
$packagePath,
$path,
str_replace('\\', '/', $namespace),
'Module.php'
);
break;
case 'psr-4':
$modulePath = sprintf(
'%s/%s%s',
$packagePath,
$path,
'Module.php'
);
break;
default:
continue 2;
}
break;
case 'files':
if (substr($path, -10) !== 'Module.php') {
continue 2;
}
$modulePath = sprintf('%s/%s', $packagePath, $path);
break;
case 'psr-0':
$modulePath = sprintf(
'%s/%s%s%s',
$packagePath,
$path,
str_replace('\\', '/', $namespace),
'Module.php'
);
break;
case 'psr-4':
$modulePath = sprintf(
'%s/%s%s',
$packagePath,
$path,
'Module.php'
);
break;
default:
continue 2;
}
}

if (file_exists($modulePath)) {
if ($result = $this->getModuleDependencies($modulePath)) {
$dependencies += $result;
if (file_exists($modulePath)) {
if ($result = $this->getModuleDependencies($modulePath)) {
$dependencies += $result;
}
}
}
}
Expand Down

0 comments on commit f69bc19

Please sign in to comment.