diff --git a/src/BootConfiguration.php b/src/BootConfiguration.php index 03c17b4..22d24ed 100644 --- a/src/BootConfiguration.php +++ b/src/BootConfiguration.php @@ -36,10 +36,10 @@ class BootConfiguration // only lotgd-modules are installed in the vendor directory if ($package->getType() === "lotgd-module") { - $confFile = $installationManager->getInstallPath($package) . "/lotgd.yml"; + $confFile = $installationManager->getInstallPath($package) . DIRECTORY_SEPARATOR . "lotgd.yml"; } else { - $confFile = $cwd . "/lotgd.yml"; + $confFile = $cwd . DIRECTORY_SEPARATOR . "lotgd.yml"; } $this->rootNamespace = $this->findRootNamespace($package); diff --git a/src/Bootstrap.php b/src/Bootstrap.php index 2d2cef9..b742df1 100644 --- a/src/Bootstrap.php +++ b/src/Bootstrap.php @@ -100,43 +100,6 @@ class Bootstrap return $composer; } - /** - * Returns all bootstrap classes - * @param ComposerManager $composer - * @return array - * @throws \Exception - */ - protected function initPackageBootstraps(ComposerManager $composer): array - { - $packages = $composer->getPackages(); - $classes = []; - - foreach ($packages as $package) { - if (isset($package->getExtra()["lotgd-namespace"]) === false) { - continue; - } - - $cn = $package->getExtra()["lotgd-namespace"] . "Bootstrap"; - - // silently ignore that class does not exist, could be one that doesn't need to bootstrap - if (class_exists($cn, true) === false) { - continue; - } - - $cl = new $cn(); - - if ($cl instanceof BootstrapInterface) { - $classes[] = $cl; - } - else { - $name = $package->getName() . "@" . $package->getVersion(); - throw new \Exception("Package {$name} does not implement BootstrapInterface in it's Bootstrap class"); - } - } - - return $classes; - } - /** * Returns a configuration object reading from the file located at the path stored in LOTGD_CONFIG. * @return \LotGD\Core\Configuration @@ -147,7 +110,7 @@ class Bootstrap $configFilePath = getenv('LOTGD_CONFIG'); if (empty($configFilePath)) { - $configFilePath = $this->rootDir . "/config/lotgd.yml"; + $configFilePath = implode(DIRECTORY_SEPARATOR, [$this->rootDir, "config", "lotgd.yml"]); } else { $configFilePath = $this->rootDir . $configFilePath; @@ -220,7 +183,7 @@ class Bootstrap protected function generateAnnotationDirectories(): array { // Read db annotations from our own model files. - $directories = [__DIR__ . '/Models']; + $directories = [__DIR__ . DIRECTORY_SEPARATOR . 'Models']; // Get additional annotation directories from bootstrap classes $packageDirectories = $this->bootConfigurationManager->getEntityDirectories(); diff --git a/src/ComposerManager.php b/src/ComposerManager.php index 7a570dc..0dd67ff 100644 --- a/src/ComposerManager.php +++ b/src/ComposerManager.php @@ -122,8 +122,8 @@ class ComposerManager $suffix = array_splice($split, -1, 1); // starts with [''] $path = null; while (!empty($split)) { - $key = join('\\', $split) . '\\'; - $dir = join(DIRECTORY_SEPARATOR, $suffix); + $key = implode('\\', $split) . '\\'; + $dir = implode(DIRECTORY_SEPARATOR, $suffix); // Prefix to directory mappings are arrays in Composer's // ClassLoader object. Not sure why. This might break in // some unforseen case. @@ -154,10 +154,10 @@ class ComposerManager // Dance to find the autoloader. // TOOD: change this to open up the Composer config and use $c['config']['vendor-dir'] instead of "vendor" $order = [ - $cwd . '/vendor/autoload.php', - __DIR__ . '/../vendor/autoload.php', - __DIR__ . '/../autoload.php', - ]; + implode(DIRECTORY_SEPARATOR, [$cwd, "vendor", "autoload.php"]), + implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "vendor", "autoload.php"]), + implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "autoload.php"]), + ]; foreach ($order as $path) { if (file_exists($path)) {