Switched to DIRECTORY_SEPARATOR

This commit is contained in:
Vassyli
2016-07-29 12:11:56 +02:00
parent ae63c209e9
commit c8790d60f0
3 changed files with 10 additions and 47 deletions
+2 -2
View File
@@ -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);
+2 -39
View File
@@ -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();
+6 -6
View File
@@ -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)) {