diff --git a/meta/definitions/template.php b/meta/definitions/template.php index 7683ae0..08f9ac4 100644 --- a/meta/definitions/template.php +++ b/meta/definitions/template.php @@ -31,12 +31,6 @@ return [ Ui::class => autowire(Ui::class), - Asset\Asset::class => autowire(Asset\Asset::class), - - Asset\Config::class => create(Asset\Config::class)->constructor( - destination: getenv("PUBLIC_PATH") . DIRECTORY_SEPARATOR . "static" - ), - Compiler::class => autowire(Compiler::class), Request::class => autowire(Request::class), @@ -49,7 +43,7 @@ return [ LanguageHandlerInterface::class => autowire(\Lean\LanguageHandler::class), - LanguageRegistration::class => create(\Lean\PiceaDefaultRegistration::class)->constructor(get('picea.extensions'), [], [], get(Ui::class), get(Asset\Asset::class)), + LanguageRegistration::class => create(\Lean\PiceaDefaultRegistration::class)->constructor(get('picea.extensions'), [], [], get(Ui::class), null), 'picea.extensions' => function(\Psr\Container\ContainerInterface $c) { return array_merge([ @@ -76,14 +70,4 @@ return [ FileFetcher::class => function($c) { return new FileFetcher($c->get(Lean\Lean::class)->getViewPaths()); }, - - Asset\FileFetcher::class => function($c) { - return new Asset\FileFetcher($c->get(Lean\Lean::class)->getAssetPaths()); - }, - - Action\Install::class => autowire(Action\Install::class)->constructor(get(Action\InstallActionInterface::class), []), - - Action\Symlink::class => autowire(Action\Symlink::class), - - Action\InstallActionInterface::class => autowire(Action\Symlink::class), ]; \ No newline at end of file diff --git a/src/Lean.php b/src/Lean.php index 63a00d8..af48421 100644 --- a/src/Lean.php +++ b/src/Lean.php @@ -102,6 +102,8 @@ class Lean { $list = array_merge(...array_map(fn($app) => $app->views ?? [], $this->applications)); + $this->verifyPathList($list); + uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] ); return $list; @@ -111,11 +113,22 @@ class Lean { $list = array_merge(...array_map(fn($app) => $app->piceaAssets ?? [], $this->applications)); + $this->verifyPathList($list); + uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] ); return $list; } + protected function verifyPathList(array $list) : void + { + foreach($list as $item) { + if (! isset($item['order']) ) { + throw new \RuntimeException(sprintf("An error occured while verifying a path list (%s)", json_encode($item, \JSON_PRETTY_PRINT))); + } + } + } + public function getI18n(string $reader) : ? array { switch($reader) { diff --git a/src/PiceaDefaultRegistration.php b/src/PiceaDefaultRegistration.php index c440117..eeb6192 100644 --- a/src/PiceaDefaultRegistration.php +++ b/src/PiceaDefaultRegistration.php @@ -22,7 +22,7 @@ class PiceaDefaultRegistration extends DefaultRegistrations { { parent::registerAll($compiler); - $this->ui->registerFormExtension($compiler); - $this->asset->registerExtension($compiler); + $this->ui AND $this->ui->registerFormExtension($compiler); + $this->asset AND $this->asset->registerExtension($compiler); } } \ No newline at end of file