- WIP on asset's system
This commit is contained in:
		
							parent
							
								
									0ededba2f6
								
							
						
					
					
						commit
						35b28c311e
					
				
							
								
								
									
										26
									
								
								src/Action/Install.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								src/Action/Install.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,26 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Picea\Asset\Action; | ||||
| 
 | ||||
| use Picea\Asset\Extension; | ||||
| use Picea\Compiler; | ||||
| use Picea\Compiler\Context; | ||||
| use Picea\Event\Extension\UrlBuildAssetEvent; | ||||
| use Picea\EventTrait; | ||||
| 
 | ||||
| class Install { | ||||
| 
 | ||||
|     use EventTrait; | ||||
| 
 | ||||
|     public function __construct( | ||||
|         public InstallActionInterface $action, | ||||
|     ) { } | ||||
| 
 | ||||
|     public function launch() : bool | ||||
|     { | ||||
|         $this->action->run(); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										8
									
								
								src/Action/InstallActionInterface.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/Action/InstallActionInterface.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Picea\Asset\Action; | ||||
| 
 | ||||
| interface InstallActionInterface | ||||
| { | ||||
|     public function run() : mixed; | ||||
| } | ||||
							
								
								
									
										11
									
								
								src/Action/Symlink.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/Action/Symlink.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Picea\Asset\Action; | ||||
| 
 | ||||
| class Symlink implements InstallActionInterface | ||||
| { | ||||
|     public function run() : mixed | ||||
|     { | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
| @ -1,9 +0,0 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Picea\Asset; | ||||
| 
 | ||||
| enum ActionPrepareEnum | ||||
| { | ||||
|     case Copy; | ||||
|     case Symlink; | ||||
| } | ||||
| @ -11,18 +11,20 @@ class Asset { | ||||
| 
 | ||||
|     use EventTrait; | ||||
| 
 | ||||
|     public function __construct( | ||||
|         null|Action\Install $install = null, | ||||
|     ) {} | ||||
| 
 | ||||
|     public function registerExtension(Compiler $compiler) : self | ||||
|     { | ||||
|         $compiler->registerExtension(new Extension\ImportmapExtension()); | ||||
| 
 | ||||
|         $compiler->getExtensionFromToken('asset')->eventRegister(new class() implements UrlBuildAssetEvent { | ||||
| 
 | ||||
| /*      $compiler->getExtensionFromToken('asset')->eventRegister(new class() implements UrlBuildAssetEvent { | ||||
|             public function execute(string $uri, array $parameters = [], bool $appendVersion) : void | ||||
|             { | ||||
|                 dump($uri); | ||||
|             } | ||||
| 
 | ||||
|         }); | ||||
|         }); */ | ||||
| 
 | ||||
|         return $this; | ||||
|     } | ||||
|  | ||||
							
								
								
									
										11
									
								
								src/Source/Directory.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/Source/Directory.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Picea\Asset\Source; | ||||
| 
 | ||||
| class Directory | ||||
| { | ||||
|     public function __construct( | ||||
|         public string $path, | ||||
|         public int $order, | ||||
|     ) {} | ||||
| } | ||||
							
								
								
									
										8
									
								
								src/Source/File.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/Source/File.php
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace Picea\Asset\Source; | ||||
| 
 | ||||
| class File | ||||
| { | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user