- Done fixing Container build caching and WIP on Picea's asset
This commit is contained in:
1 parent
4dcc7f407e
commit
4c0cddd617
10 files changed
+208
-79
No files matched your search
@@ -5,7 +5,7 @@ use function DI\autowire, DI\create, DI\get;
|
||||
use Laminas\Diactoros\Response\HtmlResponse;
|
||||
|
||||
use Picea\{Asset\Action\InstallActionInterface,
|
||||
Picea,
|
||||
Language\LanguageRegistration,
|
||||
Caching\Cache,
|
||||
Caching\Opcache,
|
||||
Compiler,
|
||||
@@ -14,21 +14,39 @@ use Picea\{Asset\Action\InstallActionInterface,
|
||||
FileFetcher,
|
||||
Language\DefaultRegistrations,
|
||||
Method\Request};
|
||||
use Picea\Extension\{ LanguageHandler, LanguageExtension, TitleExtension, NumberExtension, UrlExtension };
|
||||
use Picea\Extension\{ LanguageHandlerInterface, LanguageExtension, TitleExtension, NumberExtension, UrlExtension };
|
||||
use Picea\Ui\{ Method, Ui };
|
||||
use Picea\Asset\{ Asset, Action };
|
||||
|
||||
return [
|
||||
Picea::class => function($c) {
|
||||
return new Picea($c->get(Context::class), $c->get(Cache::class), $c->get(Compiler::class), null, $c->get(FileFetcher::class), null, getenv("DEBUG"));
|
||||
Picea\Picea::class => function($c) {
|
||||
return new Picea\Picea($c->get(Context::class), $c->get(Cache::class), $c->get(Compiler::class), null, $c->get(FileFetcher::class), null, getenv("DEBUG"));
|
||||
},
|
||||
|
||||
Context::class => function($c) {
|
||||
return new BaseContext($c->get(Lean\Lean::class)->getPiceaContext());
|
||||
},
|
||||
|
||||
Compiler::class => function($c) {
|
||||
return new Compiler(new class(array_merge([
|
||||
Ui::class => autowire(Ui::class),
|
||||
|
||||
Asset::class => autowire(Asset::class),
|
||||
|
||||
Compiler::class => autowire(Compiler::class),
|
||||
|
||||
Request::class => autowire(Request::class),
|
||||
|
||||
Method\Form::class => autowire(Method\Form::class),
|
||||
|
||||
Method\Pagination::class => autowire(Method\Pagination::class),
|
||||
|
||||
LanguageExtension::class => create(LanguageExtension::class)->constructor(get(LanguageHandlerInterface::class)),
|
||||
|
||||
LanguageHandlerInterface::class => autowire(\Lean\LanguageHandler::class),
|
||||
|
||||
LanguageRegistration::class => create(\Lean\PiceaDefaultRegistration::class)->constructor(get('picea.extensions'), [], [], get(Ui::class), get(Asset::class)),
|
||||
|
||||
'picea.extensions' => function(\Psr\Container\ContainerInterface $c) {
|
||||
return array_merge([
|
||||
$c->get(LanguageExtension::class),
|
||||
$c->get(TitleExtension::class),
|
||||
$c->get(NumberExtension::class),
|
||||
@@ -37,44 +55,8 @@ return [
|
||||
$c->get(Method\Pagination::class),
|
||||
$c->get(Request::class),
|
||||
], class_exists(\Taxus\Picea\Extension::class) ? [ $c->get(\Taxus\Picea\Extension::class) ] : [],
|
||||
array_map(fn($class) => $c->get($class), $c->get(Lean\Lean::class)->getPiceaExtensions() ))) extends DefaultRegistrations {
|
||||
|
||||
public function registerAll(Compiler $compiler) : void
|
||||
{
|
||||
parent::registerAll($compiler);
|
||||
|
||||
if (class_exists(Ui::class)) {
|
||||
( new Ui() )->registerFormExtension($compiler);
|
||||
}
|
||||
|
||||
if (class_exists(Asset::class)) {
|
||||
( new Asset() )->registerExtension($compiler);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Request::class => autowire(Request::class),
|
||||
|
||||
Method\Form::class => autowire(Method\Form::class),
|
||||
|
||||
Method\Pagination::class => autowire(Method\Pagination::class),
|
||||
|
||||
LanguageExtension::class => create(LanguageExtension::class)->constructor(get(LanguageHandler::class)),
|
||||
|
||||
LanguageHandler::class => function($c) {
|
||||
return new class( $c->get(Tell\I18n::class) ) implements LanguageHandler {
|
||||
public Tell\I18n $tell;
|
||||
|
||||
public function __construct(Tell\I18n $tell) {
|
||||
$this->tell = $tell;
|
||||
}
|
||||
|
||||
public function languageFromKey(string $key, array $variables = []) #: array|string
|
||||
{
|
||||
return $this->tell->fromKey($key, $variables) ?: "";
|
||||
}
|
||||
};
|
||||
array_map(fn($class) => $c->get($class), $c->get(Lean\Lean::class)->getPiceaExtensions())
|
||||
);
|
||||
},
|
||||
|
||||
TitleExtension::class => autowire(TitleExtension::class),
|
||||
@@ -89,7 +71,13 @@ return [
|
||||
return new FileFetcher($c->get(Lean\Lean::class)->getViewPaths());
|
||||
},
|
||||
|
||||
Action\Install::class => autowire(Action\Install::class),
|
||||
Picea\Asset\FileFetcher::class => function($c) {
|
||||
return new Picea\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 => create(Action\Symlink::class),
|
||||
|
||||
Action\InstallActionInterface::class => autowire(Action\Symlink::class),
|
||||
];
|
||||
Reference in new issue
Block a user