Skip to content

Commit 207200a

Browse files
committed
Fix #6
1 parent 2a8db16 commit 207200a

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

src/Loader.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,17 @@ public function __construct()
1717

1818
public function register(): void
1919
{
20-
if (empty($this->roots) === false) {
21-
foreach ($this->roots as $root) {
22-
if (is_string($root) === true) {
23-
$root = $this->getRootPath($root);
24-
} elseif (is_a($root, 'Closure') === true) {
25-
$root = $this->getRootPath($root());
26-
} else {
27-
// not supported type
28-
continue;
29-
}
30-
31-
$this->pluginsLoader($root);
20+
foreach ($this->roots as $root) {
21+
if (is_string($root) === true) {
22+
$root = $this->getRootPath($root);
23+
} elseif (is_a($root, 'Closure') === true) {
24+
$root = $this->getRootPath($root());
25+
} else {
26+
// not supported type
27+
continue;
3228
}
29+
30+
$this->pluginsLoader($root);
3331
}
3432
}
3533

@@ -77,18 +75,17 @@ protected function readDir(?string $root = null): bool
7775
return true;
7876
}
7977

80-
protected function getRootPath(?string $root = null): string
78+
protected function getRootPath(string $root): string
8179
{
8280
$baseRoot = App::instance()->root();
8381

8482
if (
85-
$root !== null &&
8683
is_dir($root) === false &&
8784
strpos($root, $baseRoot) === false
8885
) {
8986
return $baseRoot . DIRECTORY_SEPARATOR . ltrim($root, DIRECTORY_SEPARATOR);
9087
}
9188

92-
return $baseRoot;
89+
return $root;
9390
}
9491
}

0 commit comments

Comments
 (0)