diff --git a/src/Action/Install.php b/src/Action/Install.php new file mode 100644 index 0000000..62bbd6f --- /dev/null +++ b/src/Action/Install.php @@ -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; + } + +} diff --git a/src/Action/InstallActionInterface.php b/src/Action/InstallActionInterface.php new file mode 100644 index 0000000..7b6a5bf --- /dev/null +++ b/src/Action/InstallActionInterface.php @@ -0,0 +1,8 @@ +<?php + +namespace Picea\Asset\Action; + +interface InstallActionInterface +{ + public function run() : mixed; +} \ No newline at end of file diff --git a/src/Action/Symlink.php b/src/Action/Symlink.php new file mode 100644 index 0000000..55555e8 --- /dev/null +++ b/src/Action/Symlink.php @@ -0,0 +1,11 @@ +<?php + +namespace Picea\Asset\Action; + +class Symlink implements InstallActionInterface +{ + public function run() : mixed + { + return null; + } +} \ No newline at end of file diff --git a/src/ActionPrepareEnum.php b/src/ActionPrepareEnum.php deleted file mode 100644 index 2f5495d..0000000 --- a/src/ActionPrepareEnum.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -namespace Picea\Asset; - -enum ActionPrepareEnum -{ - case Copy; - case Symlink; -} diff --git a/src/Asset.php b/src/Asset.php index 7b8e8d8..f483e29 100644 --- a/src/Asset.php +++ b/src/Asset.php @@ -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; } diff --git a/src/Source/Directory.php b/src/Source/Directory.php new file mode 100644 index 0000000..6851776 --- /dev/null +++ b/src/Source/Directory.php @@ -0,0 +1,11 @@ +<?php + +namespace Picea\Asset\Source; + +class Directory +{ + public function __construct( + public string $path, + public int $order, + ) {} +} \ No newline at end of file diff --git a/src/Source/File.php b/src/Source/File.php new file mode 100644 index 0000000..9351fef --- /dev/null +++ b/src/Source/File.php @@ -0,0 +1,8 @@ +<?php + +namespace Picea\Asset\Source; + +class File +{ + +} \ No newline at end of file