Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | /** |
| 6 | * Copyright (c) 2019-2023 NxtLvl Software Solutions. |
| 7 | * |
| 8 | * Freely available to use under the terms of the MIT license. |
| 9 | */ |
| 10 | |
| 11 | /** |
| 12 | * Temporary callable for bootstrapping the static constructor loader. |
| 13 | * |
| 14 | * This is unset after calling to ensure it isn't available after use as |
| 15 | * this file is automatically included by the composer autoloader. |
| 16 | */ |
| 17 | $hook = static function(string $key = 'DISABLE_STATIC_CONSTRUCTOR_HOOK'): void { |
| 18 | $disabled = $_SERVER[$key] ?? $_ENV[$key] ?? defined($key); |
| 19 | if(!$disabled) { |
| 20 | \NxtLvlSoftware\StaticConstructors\Loader::init(); |
| 21 | } |
| 22 | }; |
| 23 | |
| 24 | $hook(); // call hook function |
| 25 | unset($hook); // remove hook function from runtime |