59 lines
2.1 KiB
PHP
59 lines
2.1 KiB
PHP
<?php
|
|
|
|
use function DI\autowire, DI\create, DI\get;
|
|
|
|
use Picea\{
|
|
Caching\Cache,
|
|
Caching\Opcache,
|
|
Compiler,
|
|
Compiler\Context,
|
|
Compiler\BaseContext,
|
|
FileFetcher,
|
|
Method\Request
|
|
};
|
|
|
|
use Picea\Extension\{ LanguageHandlerInterface, LanguageExtension, TitleExtension, NumberExtension, UrlExtension };
|
|
|
|
return [
|
|
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 => autowire(Compiler::class),
|
|
|
|
Request::class => autowire(Request::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), null),
|
|
|
|
'picea.extensions' => function(\Psr\Container\ContainerInterface $c) {
|
|
return array_merge([
|
|
$c->get(LanguageExtension::class),
|
|
$c->get(TitleExtension::class),
|
|
$c->get(NumberExtension::class),
|
|
$c->get(UrlExtension::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())
|
|
);
|
|
},
|
|
|
|
TitleExtension::class => autowire(TitleExtension::class),
|
|
|
|
NumberExtension::class => autowire(NumberExtension::class),
|
|
|
|
UrlExtension::class => create(UrlExtension::class)->constructor(getenv("URL_BASE"), get('git.commit'), explode(',', getenv('APP_URL')), (bool) getenv('FORCE_SSL')),
|
|
|
|
Cache::class => create(Opcache::class)->constructor(getenv("CACHE_PATH"), get(Context::class)),
|
|
|
|
FileFetcher::class => function($c) {
|
|
return new FileFetcher($c->get(Lean\Lean::class)->getViewPaths());
|
|
},
|
|
]; |