Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | use Lucent\Facades\FileSystem; |
| 4 | |
| 5 | /** |
| 6 | * Lucent framework bootstrap. |
| 7 | * |
| 8 | * Composer-only: no PHAR support. This file is autoloaded via the |
| 9 | * package's composer.json "autoload.files" entry, so requiring the |
| 10 | * package's autoloader is enough to boot the framework constants. |
| 11 | */ |
| 12 | |
| 13 | // Package source directory (vendor/blueprintau/lucent/src in a consumer, |
| 14 | // or this repo's src/ during development). |
| 15 | define("ROOT", __DIR__ . DIRECTORY_SEPARATOR); |
| 16 | |
| 17 | // Project root: find the vendor directory from Composer's ClassLoader, |
| 18 | // then go one level up. This works regardless of the vendor-dir name or |
| 19 | // package path structure. Falls back to the repo root for development. |
| 20 | $projectRoot = null; |
| 21 | if (class_exists(\Composer\Autoload\ClassLoader::class)) { |
| 22 | $loaders = \Composer\Autoload\ClassLoader::getRegisteredLoaders(); |
| 23 | $vendorDir = key($loaders); |
| 24 | if ($vendorDir !== null && is_dir($vendorDir)) { |
| 25 | // vendorDir is <project>/vendor — project root is its parent. |
| 26 | $projectRoot = dirname($vendorDir); |
| 27 | } |
| 28 | } |
| 29 | if ($projectRoot === null) { |
| 30 | // Fallback: running from the Lucent repo itself (src/ is 1 level below repo root). |
| 31 | $projectRoot = dirname(__DIR__, 1); |
| 32 | } |
| 33 | |
| 34 | define("RUNNING_LOCATION", $projectRoot . DIRECTORY_SEPARATOR); |
| 35 | |
| 36 | // Version: read from Composer's InstalledVersions (always available |
| 37 | // since this file is autoloaded via Composer's files entry). |
| 38 | // getPrettyVersion() returns a meaningful string for dev installs too |
| 39 | // (e.g. "dev-main"), unlike getVersion() which is null outside tagged |
| 40 | // releases and would make VERSION fall back to 'unknown'. |
| 41 | define("VERSION", \Composer\InstalledVersions::getPrettyVersion('blueprintau/lucent') ?: 'unknown'); |
| 42 | |
| 43 | define("LUCENT", ROOT . "Lucent" . DIRECTORY_SEPARATOR); |
| 44 | |
| 45 | // Set file system root |
| 46 | require_once LUCENT . "Facades" . DIRECTORY_SEPARATOR . "FileSystem.php"; |
| 47 | FileSystem::overrideRootPath(RUNNING_LOCATION); |
| 48 | |
| 49 | define("APP", FileSystem::rootPath() . DIRECTORY_SEPARATOR . "App" . DIRECTORY_SEPARATOR); |
| 50 | |
| 51 |