-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.php
49 lines (38 loc) · 1.13 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
declare(strict_types=1);
/*
* This file is part of the Sigwin Yassg project.
*
* (c) sigwin.hr
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Sigwin\YASSG;
$skipBundles = [];
if (getenv('YASSG_SKIP_BUNDLES') !== false) {
$skipBundles = array_map(static fn (string $name): string => trim($name), explode(',', getenv('YASSG_SKIP_BUNDLES')));
}
$GLOBALS['YASSG_SKIP_BUNDLES'] = $skipBundles;
$autoloaders = [
// when installed in the project
__DIR__.'/../../autoload_runtime.php',
// in own repo
__DIR__.'/vendor/autoload_runtime.php',
];
$baseDir = null;
foreach ($autoloaders as $autoloader) {
if (true === file_exists($autoloader)) {
$baseDir = getcwd();
if ($baseDir === false) {
throw new \RuntimeException('Could not get current working directory');
}
$GLOBALS['YASSG_BASEDIR'] = $baseDir;
require_once $autoloader;
break;
}
}
if ($baseDir === null) {
fwrite(\STDERR, 'You must set up the project dependencies using `composer install`'.\PHP_EOL);
exit(1);
}