- WIP on cleaning of definitions files

This commit is contained in:
Dave Mc Nicoll committed 2024-06-07 00:01:43 +00:00
1 parent 63fde92b68
commit d9f9c053c3
8 files changed
+55 -29

No files matched your search

+22 -14
View File
@@ -1,29 +1,37 @@
<?php
use function DI\autowire, DI\create, DI\get;
use Tell\I18n;
use Psr\Container\ContainerInterface;
use Notes\Tell\LanguageHandler;
return [
Tell\I18n::class => create( Tell\I18n::class ) ->constructor(
get(Tell\Reader\JsonReader::class),
get(Tell\Reader\PhpReader::class),
get('tell.fallback') /* getenv("DEBUG") ? create(Tell\PrintMissingKey::class) : get('tell.fallback') */
),
use function DI\autowire, DI\create, DI\get, DI\add;
'tell.fallback' => function($c) {
$i18n = new Tell\I18n( $c->get(Tell\Reader\JsonReader::class), $c->get(Tell\Reader\PhpReader::class), new Tell\PrintMissingKey() );
return [
I18n::class => function(ContainerInterface $container) {
$i18n = new I18n($container->get(Tell\Reader\JsonReader::class), $container->get(Tell\Reader\PhpReader::class), $container->get('tell.fallback'));
$i18n->locale(getenv('DEFAULT_LOCAL'));
$i18n->initialize(! getenv("DEBUG"));
return $i18n;
},
'tell.fallback' => function(ContainerInterface $container) {
$i18n = new Tell\I18n( $container->get(Tell\Reader\JsonReader::class), $container->get(Tell\Reader\PhpReader::class), new Tell\PrintMissingKey() );
$i18n->locale(getenv('DEFAULT_LOCAL_FALLBACK') ?: "en_US");
$i18n->initialize(true);
return $i18n;
},
Tell\Reader\PhpReader::class => function($c) {
return new Tell\Reader\PhpReader($c->get(Lean\Lean::class)->getI18n('php'), false);
Tell\Reader\PhpReader::class => function(ContainerInterface $container) {
return new Tell\Reader\PhpReader($container->get(Lean\Lean::class)->getI18n('php'), false);
},
Tell\Reader\JsonReader::class => function($c) {
return new Tell\Reader\JsonReader($c->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
Tell\Reader\JsonReader::class => function(ContainerInterface $container) {
return new Tell\Reader\JsonReader($container->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
},
'lean.autoload' => add([
I18n::class,
]),
];
+9
View File
@@ -0,0 +1,9 @@
<?php
use Ulmus\Container\AdapterProxy;
return [
'lean.autoload' => add([
AdapterProxy::class,
]),
];
+1 -1
View File
@@ -54,7 +54,7 @@ return [
# PostRequestAuthenticationMiddleware::class,
],
'routes.list' => function($c) {
Lean\Routing\RouteDefinitionInterface::class => function($c) {
return function (ContainerInterface $container) {
$router = $container->get(Router::class);
+7 -1
View File
@@ -1,6 +1,6 @@
<?php
use function DI\autowire, DI\create, DI\get;
use Tell\I18n;
use TheBugs\JavascriptMiddleware;
@@ -10,6 +10,8 @@ use Storage\Cookie,
Storage\Session,
Storage\SessionMiddleware;
use function DI\autowire, DI\create, DI\get, DI\add;
$dir = dirname(__DIR__, 2);
return [
@@ -74,6 +76,10 @@ return [
],
],
'lean.autoload' => add([
Lean::class,
]),
Lean::class => autowire(Lean::class),
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
+2 -1
View File
@@ -1,6 +1,7 @@
<?php
use Ulmus\ConnectionAdapter;
use Ulmus\{ ConnectionAdapter, Container\AdapterProxy };
use Lean\Lean;
return [
'lean:adapter.sqlite' => function($c) {