- Done fixing Container build caching and WIP on Picea's asset
This commit is contained in:
parent
4dcc7f407e
commit
4c0cddd617
|
@ -18,6 +18,8 @@ use Storage\Cookie,
|
||||||
Storage\Session,
|
Storage\Session,
|
||||||
Storage\SessionMiddleware;
|
Storage\SessionMiddleware;
|
||||||
|
|
||||||
|
$dir = dirname(__DIR__, 2);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'lean.default' => [
|
'lean.default' => [
|
||||||
'picea' => [
|
'picea' => [
|
||||||
|
@ -29,11 +31,22 @@ return [
|
||||||
'order' => 10,
|
'order' => 10,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'path' => getenv("PROJECT_PATH") . implode(DIRECTORY_SEPARATOR, [ "", "vendor", "mcnd" , "lean" , "view" ]),
|
'path' => implode(DIRECTORY_SEPARATOR, [ $dir, "view", '' ]),
|
||||||
'order' => 99,
|
'order' => 99,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'asset' => [
|
||||||
|
"public_path" => getenv("PUBLIC_PATH"),
|
||||||
|
'destination_path' => "static",
|
||||||
|
'source' => [
|
||||||
|
[
|
||||||
|
'path' => implode(DIRECTORY_SEPARATOR, [ getenv("PROJECT_PATH"), "asset", '' ]),
|
||||||
|
'order' => 10
|
||||||
|
]
|
||||||
|
],
|
||||||
|
],
|
||||||
|
|
||||||
'extensions' => [],
|
'extensions' => [],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ use function DI\autowire, DI\create, DI\get;
|
||||||
use Laminas\Diactoros\Response\HtmlResponse;
|
use Laminas\Diactoros\Response\HtmlResponse;
|
||||||
|
|
||||||
use Picea\{Asset\Action\InstallActionInterface,
|
use Picea\{Asset\Action\InstallActionInterface,
|
||||||
Picea,
|
Language\LanguageRegistration,
|
||||||
Caching\Cache,
|
Caching\Cache,
|
||||||
Caching\Opcache,
|
Caching\Opcache,
|
||||||
Compiler,
|
Compiler,
|
||||||
|
@ -14,21 +14,39 @@ use Picea\{Asset\Action\InstallActionInterface,
|
||||||
FileFetcher,
|
FileFetcher,
|
||||||
Language\DefaultRegistrations,
|
Language\DefaultRegistrations,
|
||||||
Method\Request};
|
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\Ui\{ Method, Ui };
|
||||||
use Picea\Asset\{ Asset, Action };
|
use Picea\Asset\{ Asset, Action };
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Picea::class => function($c) {
|
Picea\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"));
|
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) {
|
Context::class => function($c) {
|
||||||
return new BaseContext($c->get(Lean\Lean::class)->getPiceaContext());
|
return new BaseContext($c->get(Lean\Lean::class)->getPiceaContext());
|
||||||
},
|
},
|
||||||
|
|
||||||
Compiler::class => function($c) {
|
Ui::class => autowire(Ui::class),
|
||||||
return new Compiler(new class(array_merge([
|
|
||||||
|
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(LanguageExtension::class),
|
||||||
$c->get(TitleExtension::class),
|
$c->get(TitleExtension::class),
|
||||||
$c->get(NumberExtension::class),
|
$c->get(NumberExtension::class),
|
||||||
|
@ -37,44 +55,8 @@ return [
|
||||||
$c->get(Method\Pagination::class),
|
$c->get(Method\Pagination::class),
|
||||||
$c->get(Request::class),
|
$c->get(Request::class),
|
||||||
], class_exists(\Taxus\Picea\Extension::class) ? [ $c->get(\Taxus\Picea\Extension::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 {
|
array_map(fn($class) => $c->get($class), $c->get(Lean\Lean::class)->getPiceaExtensions())
|
||||||
|
);
|
||||||
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) ?: "";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
TitleExtension::class => autowire(TitleExtension::class),
|
TitleExtension::class => autowire(TitleExtension::class),
|
||||||
|
@ -89,7 +71,13 @@ return [
|
||||||
return new FileFetcher($c->get(Lean\Lean::class)->getViewPaths());
|
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\Symlink::class => autowire(Action\Symlink::class),
|
||||||
Action\InstallActionInterface::class => create(Action\Symlink::class),
|
|
||||||
|
Action\InstallActionInterface::class => autowire(Action\Symlink::class),
|
||||||
];
|
];
|
|
@ -30,6 +30,8 @@ return [
|
||||||
return new RedirectResponse(getenv("URL_BASE")."/login");
|
return new RedirectResponse(getenv("URL_BASE")."/login");
|
||||||
}, get('authentication.unauthorize'), get(Taxus::class)),
|
}, get('authentication.unauthorize'), get(Taxus::class)),
|
||||||
|
|
||||||
|
'authentication.method' => null,
|
||||||
|
|
||||||
'authentication.error' => function($c, Picea $picea) {
|
'authentication.error' => function($c, Picea $picea) {
|
||||||
return function($message) use ($picea) {
|
return function($message) use ($picea) {
|
||||||
return new HtmlResponse($picea->renderHtml('lean/error/500', [
|
return new HtmlResponse($picea->renderHtml('lean/error/500', [
|
||||||
|
|
|
@ -13,9 +13,8 @@ return array_merge(
|
||||||
'%APPKEY%' => [
|
'%APPKEY%' => [
|
||||||
'picea' => [
|
'picea' => [
|
||||||
'context' => "%ESCAPED_NAMESPACE%\\View",
|
'context' => "%ESCAPED_NAMESPACE%\\View",
|
||||||
|
'asset' => [],
|
||||||
'extensions' => [
|
'extensions' => [],
|
||||||
],
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -5,34 +5,36 @@ namespace Lean;
|
||||||
use League\Route\Strategy;
|
use League\Route\Strategy;
|
||||||
|
|
||||||
use League\Route\Http\Exception\NotFoundException;
|
use League\Route\Http\Exception\NotFoundException;
|
||||||
|
use Picea\Asset\Asset;
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Server\MiddlewareInterface;
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
use Picea\Picea;
|
use Picea\Picea;
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
|
use function DI\get;
|
||||||
|
|
||||||
class ApplicationStrategy extends Strategy\ApplicationStrategy {
|
class ApplicationStrategy extends Strategy\ApplicationStrategy {
|
||||||
|
|
||||||
static array $asset_ext = [
|
public const ASSET_TRIGGER_UPDATE = [
|
||||||
"js", "mjs", "manifest", "webmanifest", "css", "png", "ico",
|
"js", "mjs", "manifest", "webmanifest", "css", "png", "ico",
|
||||||
"jpg", "jpeg", "gif", "webp", "woff", "woff2", "eot", "svg",
|
"jpg", "jpeg", "gif", "webp", "woff", "woff2", "eot", "svg",
|
||||||
"ttf"
|
"ttf"
|
||||||
];
|
];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public Picea $picea
|
protected Picea $picea,
|
||||||
|
protected ContainerInterface $di,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
public function getNotFoundDecorator(NotFoundException $exception): MiddlewareInterface
|
public function getNotFoundDecorator(NotFoundException $exception): MiddlewareInterface
|
||||||
{
|
{
|
||||||
return new class($this->picea) implements MiddlewareInterface {
|
return new class($this->picea, $this->di) implements MiddlewareInterface {
|
||||||
|
|
||||||
protected Picea $picea;
|
public function __construct(
|
||||||
|
protected Picea $picea,
|
||||||
public function __construct(Picea $picea)
|
protected ContainerInterface $di,
|
||||||
{
|
) { }
|
||||||
$this->picea = $picea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||||
{
|
{
|
||||||
|
@ -41,8 +43,16 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy {
|
||||||
|
|
||||||
public function throw404(ServerRequestInterface $request) : ResponseInterface
|
public function throw404(ServerRequestInterface $request) : ResponseInterface
|
||||||
{
|
{
|
||||||
if ( class_exists(\Picea\Asset\Asset::class) ) {
|
if ( getenv('DEBUG') && class_exists(\Picea\Asset\Asset::class) ) {
|
||||||
|
$params = $request->getServerParams();
|
||||||
|
|
||||||
|
$scpName = basename(explode('?', $params['SCRIPT_NAME'] ?? $params['REQUEST_URI'] ?? $params['PHP_SELF'] ?? "", 1)[0]);
|
||||||
|
|
||||||
|
list(, $ext) = array_pad(explode('.', $scpName), 2, null);
|
||||||
|
|
||||||
|
if ($ext && in_array($ext, ApplicationStrategy::ASSET_TRIGGER_UPDATE)) {
|
||||||
|
$this->di->get(\Picea\Asset\Asset::class)->launchInstall();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new \Laminas\Diactoros\Response\HtmlResponse($this->picea->renderHtml("lean/error/404", [], $this), 404);
|
return new \Laminas\Diactoros\Response\HtmlResponse($this->picea->renderHtml("lean/error/404", [], $this), 404);
|
||||||
|
|
|
@ -71,16 +71,35 @@ class Composer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function readComposerJson(Event $event) : ? array
|
public static function readComposerLock() : false|array
|
||||||
{
|
{
|
||||||
|
static $content = null;
|
||||||
|
|
||||||
|
$path = static::createPath('composer.lock');
|
||||||
|
|
||||||
|
if (! file_exists($path) ) {
|
||||||
|
throw new \UnexpectedValueException("Composer file 'composer.lock' could not be found within your project's root folder.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function readComposerJson() : false|array
|
||||||
|
{
|
||||||
|
static $content = null;
|
||||||
|
|
||||||
$path = static::createPath('composer.json');
|
$path = static::createPath('composer.json');
|
||||||
|
|
||||||
return file_exists($path) ? json_decode(file_get_contents($path), true) : null;
|
if (! file_exists($path) ) {
|
||||||
|
throw new \UnexpectedValueException("Composer file 'composer.json' could not be found within your project's root folder.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getNamespaceFromAutoload(Event $event) : ? string
|
protected static function getNamespaceFromAutoload(Event $event) : ? string
|
||||||
{
|
{
|
||||||
if ( null !== $composerJson = static::readComposerJson($event) ) {
|
if ( false !== $composerJson = static::readComposerJson() ) {
|
||||||
if ( $psr4 = $composerJson['autoload']['psr-4'] ?? false ) {
|
if ( $psr4 = $composerJson['autoload']['psr-4'] ?? false ) {
|
||||||
foreach($psr4 as $ns => $directory) {
|
foreach($psr4 as $ns => $directory) {
|
||||||
if ($directory === 'src/') {
|
if ($directory === 'src/') {
|
||||||
|
@ -103,6 +122,6 @@ class Composer
|
||||||
|
|
||||||
protected static function createPath(... $path) : string
|
protected static function createPath(... $path) : string
|
||||||
{
|
{
|
||||||
return implode(DIRECTORY_SEPARATOR, array_merge([ $_SERVER['PWD'] ], $path));
|
return implode(DIRECTORY_SEPARATOR, array_merge([ $_SERVER['PWD'] ?? getenv('PROJECT_PATH') ], $path));
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -110,8 +110,10 @@ class Kernel {
|
||||||
|
|
||||||
if (getenv("APP_ENV") === "prod") {
|
if (getenv("APP_ENV") === "prod") {
|
||||||
if (getenv("CACHE_PATH")) {
|
if (getenv("CACHE_PATH")) {
|
||||||
|
# check if ACPU is there first, $containerBuilder->enableDefinitionCache();
|
||||||
|
|
||||||
$containerBuilder->enableCompilation(getenv("CACHE_PATH") . "/di/");
|
$containerBuilder->enableCompilation(getenv("CACHE_PATH") . "/di/");
|
||||||
$containerBuilder->writeProxiesToFile(true, getenv("CACHE_PATH") . "/di/proxies/");
|
# No proxies yet... $containerBuilder->writeProxiesToFile(true, getenv("CACHE_PATH") . "/di/");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean;
|
||||||
|
|
||||||
|
use Picea\Extension\LanguageHandlerInterface;
|
||||||
|
use Tell;
|
||||||
|
|
||||||
|
class LanguageHandler implements LanguageHandlerInterface {
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
public Tell\I18n $tell
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function languageFromKey(string $key, array $variables = []) #: array|string
|
||||||
|
{
|
||||||
|
return $this->tell->fromKey($key, $variables) ?: "";
|
||||||
|
}
|
||||||
|
}
|
78
src/Lean.php
78
src/Lean.php
|
@ -73,19 +73,6 @@ class Lean
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getPiceaAssets() : array
|
|
||||||
{
|
|
||||||
$list = [];
|
|
||||||
|
|
||||||
foreach(array_reverse($this->applications) as $apps) {
|
|
||||||
if ( $apps->piceaAssets ?? null ) {
|
|
||||||
$list = array_merge_recursive($list, $apps->piceaAssets);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# dump($list);
|
|
||||||
return $list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getRoutable() : array
|
public function getRoutable() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->routes ?? [], $this->applications));
|
return array_merge(...array_map(fn($app) => $app->routes ?? [], $this->applications));
|
||||||
|
@ -120,6 +107,15 @@ class Lean
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getAssetPaths() : array
|
||||||
|
{
|
||||||
|
$list = array_merge(...array_map(fn($app) => $app->piceaAssets['source'] ?? [], $this->applications));
|
||||||
|
|
||||||
|
uasort($list, fn($i1, $i2) => $i1['order'] <=> $i2['order'] );
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
public function getI18n(string $reader) : ? array
|
public function getI18n(string $reader) : ? array
|
||||||
{
|
{
|
||||||
switch($reader) {
|
switch($reader) {
|
||||||
|
@ -145,7 +141,7 @@ class Lean
|
||||||
{
|
{
|
||||||
$path = dirname(__DIR__) . "/meta/definitions/";
|
$path = dirname(__DIR__) . "/meta/definitions/";
|
||||||
|
|
||||||
return array_merge(
|
return array_replace(
|
||||||
class_exists(\Mcnd\CLI\CliMiddleware::class) ? require($path . "cli.php") : [],
|
class_exists(\Mcnd\CLI\CliMiddleware::class) ? require($path . "cli.php") : [],
|
||||||
class_exists(\Cronard\CronardMiddleware::class) ? require($path . "cronard.php") : [],
|
class_exists(\Cronard\CronardMiddleware::class) ? require($path . "cronard.php") : [],
|
||||||
require($path . "email.php"),
|
require($path . "email.php"),
|
||||||
|
@ -159,4 +155,58 @@ class Lean
|
||||||
class_exists(\Picea\Picea::class) ? require($path . "template.php") : [],
|
class_exists(\Picea\Picea::class) ? require($path . "template.php") : [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function autoloadDefinitionsFromComposerExtra() : array
|
||||||
|
{
|
||||||
|
$list = [];
|
||||||
|
|
||||||
|
foreach(Composer::readComposerLock()['packages'] as $package) {
|
||||||
|
foreach($package['extra']['lean']['autoload']['definitions'] ?? [] as $autoload) {
|
||||||
|
if (is_string($autoload)) {
|
||||||
|
$vendor = getenv('VENDOR_PATH') ? getenv('VENDOR_PATH') : dirname(__DIR__, 3);
|
||||||
|
$file = $vendor . DIRECTORY_SEPARATOR . $package['name'] . DIRECTORY_SEPARATOR . $autoload;
|
||||||
|
|
||||||
|
if ( ! file_exists($file) ) {
|
||||||
|
throw new \InvalidArgumentException(sprintf("Given autoload file `%s` from package `%s` was not found or is unreachable", $autoload, $package['name']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = array_replace($list, require($file));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$func = implode('::', array_merge([ key($autoload) ], $autoload));
|
||||||
|
|
||||||
|
$list = array_replace($list, call_user_func($func));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function autoloadConfigFromComposerExtra() : array
|
||||||
|
{
|
||||||
|
$list = [];
|
||||||
|
|
||||||
|
foreach(Composer::readComposerLock()['packages'] as $package) {
|
||||||
|
foreach($package['extra']['lean']['autoload']['config'] ?? [] as $autoload) {
|
||||||
|
if (is_string($autoload)) {
|
||||||
|
$vendor = getenv('VENDOR_PATH') ? getenv('VENDOR_PATH') : dirname(__DIR__, 3);
|
||||||
|
$file = $vendor . DIRECTORY_SEPARATOR . $package['name'] . DIRECTORY_SEPARATOR . $autoload;
|
||||||
|
|
||||||
|
if ( ! file_exists($file) ) {
|
||||||
|
throw new \InvalidArgumentException(sprintf("Given autoload file `%s` from package `%s` was not found or is unreachable", $autoload, $package['name']));
|
||||||
|
}
|
||||||
|
|
||||||
|
$list = array_merge_recursive($list, require($file));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$func = implode('::', array_merge([ key($autoload) ], $autoload));
|
||||||
|
|
||||||
|
$list = array_merge_recursive($list, call_user_func($func));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean;
|
||||||
|
|
||||||
|
use Picea\Compiler;
|
||||||
|
use Picea\Language\DefaultRegistrations;
|
||||||
|
use Picea\{ Ui\Ui, Asset\Asset };
|
||||||
|
|
||||||
|
class PiceaDefaultRegistration extends DefaultRegistrations {
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
protected array $extensions,
|
||||||
|
protected array $syntaxes,
|
||||||
|
protected array $controlStructures,
|
||||||
|
public null|Ui $ui,
|
||||||
|
public null|Asset $asset,
|
||||||
|
) {
|
||||||
|
parent::__construct($this->extensions, $this->syntaxes, $this->controlStructures);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerAll(Compiler $compiler) : void
|
||||||
|
{
|
||||||
|
parent::registerAll($compiler);
|
||||||
|
|
||||||
|
$this->ui->registerFormExtension($compiler);
|
||||||
|
$this->asset->registerExtension($compiler);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue