| Conditions | 3 |
| Paths | 1 |
| Total Lines | 25 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | public function starting(Application $app) : void |
||
| 26 | { |
||
| 27 | /** |
||
| 28 | * @var Records $rec |
||
| 29 | * @var Inspector $isp |
||
| 30 | * @var Dispatcher $dsp |
||
| 31 | */ |
||
| 32 | |||
| 33 | DI::set(Records::class, $rec = DI::object(Records::class)); |
||
| 34 | DI::set(Inspector::class, $isp = DI::object(Inspector::class)); |
||
| 35 | DI::set(Dispatcher::class, $dsp = DI::object(Dispatcher::class)); |
||
| 36 | |||
| 37 | // starting works |
||
| 38 | |||
| 39 | $app->starting()->add(static function () use ($rec, $isp, $dsp) { |
||
| 40 | // routes parsing |
||
| 41 | if (defined('CWD') && is_file($rf = CWD . '/routes.php')) { |
||
|
|
|||
| 42 | (new Initializer)->loads(...(array) include $rf); |
||
| 43 | } |
||
| 44 | |||
| 45 | // policing init |
||
| 46 | $dsp->policing($isp); |
||
| 47 | |||
| 48 | // dispatcher init |
||
| 49 | $dsp->dispatched($rec->dispatcher()); |
||
| 50 | }); |
||
| 53 |