Skip to content

Commit 64fde5f

Browse files
committed
Allow loading config dir from registry
1 parent dc5bf6d commit 64fde5f

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/StaticPHP/Registry/Registry.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,23 @@ public static function loadRegistry(string $registry_file, bool $auto_require =
8787
if (isset($data['package']['config']) && is_array($data['package']['config'])) {
8888
foreach ($data['package']['config'] as $path) {
8989
$path = self::fullpath($path, dirname($registry_file));
90-
PackageConfig::loadFromFile($path);
90+
if (is_file($path)) {
91+
PackageConfig::loadFromFile($path);
92+
} elseif (is_dir($path)) {
93+
PackageConfig::loadFromDir($path);
94+
}
9195
}
9296
}
9397

9498
// load artifact configs
9599
if (isset($data['artifact']['config']) && is_array($data['artifact']['config'])) {
96100
foreach ($data['artifact']['config'] as $path) {
97101
$path = self::fullpath($path, dirname($registry_file));
98-
ArtifactConfig::loadFromFile($path);
102+
if (is_file($path)) {
103+
ArtifactConfig::loadFromFile($path);
104+
} elseif (is_dir($path)) {
105+
ArtifactConfig::loadFromDir($path);
106+
}
99107
}
100108
}
101109

@@ -232,7 +240,7 @@ private static function parseClassEntry(int|string $key, string $value): array
232240
*/
233241
private static function requireClassFile(string $class, ?string $file_path, string $base_path, bool $auto_require): void
234242
{
235-
if (!$auto_require || class_exists($class, true)) {
243+
if (!$auto_require || class_exists($class)) {
236244
return;
237245
}
238246

0 commit comments

Comments
 (0)