- WIP on Picea's Asset.

This commit is contained in:
mcndave committed 2023-10-17 20:12:39 -04:00
1 parent d5de5e665b
commit 043fb90f8d
7 files changed
+17 -32

No files matched your search

+4 -5
View File
@@ -25,11 +25,10 @@ class Compiler
public array $extensionList = [];
public ? LanguageRegistration $languageRegistration;
public function __construct(?LanguageRegistration $languageRegistration = null)
public function __construct(
public LanguageRegistration $languageRegistration
)
{
$this->languageRegistration = $languageRegistration;
$this->languageRegistration->registerAll($this);
}
@@ -158,7 +157,7 @@ class Compiler
return $this->extensionList[$tokenName];
}
public function exportFunctions() : void
{
static $caching = [];
+2 -2
View File
@@ -11,9 +11,9 @@ class LanguageExtension implements Extension, FunctionExtension {
public string $currentLanguage = "";
protected LanguageHandler $languageHandler;
protected LanguageHandlerInterface $languageHandler;
public function __construct(LanguageHandler $handler) {
public function __construct(LanguageHandlerInterface $handler) {
$this->languageHandler = $handler;
}
@@ -2,7 +2,7 @@
namespace Picea\Extension;
interface LanguageHandler
interface LanguageHandlerInterface
{
public function languageFromKey(string $key, array $variables = []); #: array|string;
}
-7
View File
@@ -43,13 +43,6 @@ PATTERN;
$this->assetToken = $assetToken;
$this->appUrl = $appUrl;
$this->forceSSL = $forceSSL;
$this->eventRegister(new class() implements BuildAssetUrl {
public function execute(string $uri, array $parameters = [], bool $appendVersion = true) : mixed
{
}
});
}
public function parse(\Picea\Compiler\Context &$context, ?string $arguments, string $token, array $options = []) : string
+5 -12
View File
@@ -6,18 +6,11 @@ use Picea\Compiler;
class DefaultRegistrations implements LanguageRegistration
{
protected array $extensions;
protected array $syntaxes;
protected array $controlStructures;
public function __construct(array $extensions = [], array $syntaxes = [], array $controlStructure = [])
{
$this->extensions = $extensions;
$this->syntaxes = $syntaxes;
$this->controlStructures = $controlStructure;
}
public function __construct(
protected array $extensions,
protected array $syntaxes,
protected array $controlStructures,
) { }
public function registerAll(Compiler $compiler) : void
{
+1 -1
View File
@@ -43,7 +43,7 @@ class Picea implements LanguageRegistration
){
$this->cache = $cache ?? new Caching\Memory("");
$this->context = $context ?? new Compiler\BaseContext();
$this->languageRegistration = $languageRegistration ?? new Language\DefaultRegistrations();
$this->languageRegistration = $languageRegistration ?? new Language\DefaultRegistrations([], [], []);
$this->builderTemplatePath = $builderTemplatePath ?? dirname(__FILE__) . static::DEFAULT_BUILDER_TEMPLATE;
$this->compiler = $compiler ?? $this->instanciateCompiler();
$this->fileFetcher = $fileFetcher ?? $this->instanciateFileFetcher();