- WIP on Picea's Asset.
This commit is contained in:
		
							parent
							
								
									d5de5e665b
								
							
						
					
					
						commit
						043fb90f8d
					
				| @ -10,7 +10,7 @@ use function DI\autowire, DI\create, DI\get; | ||||
| use Laminas\Diactoros\Response\HtmlResponse; | ||||
| 
 | ||||
| use Picea\{ Picea, Caching\Cache, Caching\Opcache, Compiler, Compiler\Context, Compiler\BaseContext, 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 }; | ||||
| 
 | ||||
| return [ | ||||
| @ -49,10 +49,10 @@ return [ | ||||
| 
 | ||||
|     Method\Pagination::class => autowire(Method\Pagination::class), | ||||
| 
 | ||||
|     LanguageExtension::class => create(LanguageExtension::class)->constructor(get(LanguageHandler::class)), | ||||
|     LanguageExtension::class => create(LanguageExtension::class)->constructor(get(LanguageHandlerInterface::class)), | ||||
| 
 | ||||
|     LanguageHandler::class => function($c) { | ||||
|         return new class( $c->get(Tell\I18n::class) ) implements LanguageHandler { | ||||
|     LanguageHandlerInterface::class => function($c) { | ||||
|         return new class( $c->get(Tell\I18n::class) ) implements LanguageHandlerInterface { | ||||
|             public Tell\I18n $tell; | ||||
| 
 | ||||
|             public function __construct(Tell\I18n $tell) { | ||||
|  | ||||
| @ -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); | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -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;
 | ||||
| } | ||||
| @ -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 | ||||
|  | ||||
| @ -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 | ||||
|     { | ||||
|  | ||||
| @ -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(); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user