mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 14:55:39 +08:00
Add lib skeleton command and sort config, spc_mode suuport, etc...
This commit is contained in:
@@ -1,9 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace StaticPHP\Skeleton;
|
||||
|
||||
use StaticPHP\Exception\ValidationException;
|
||||
use StaticPHP\Runtime\Executor\Executor;
|
||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||
|
||||
class ExecutorGenerator
|
||||
{
|
||||
@@ -13,4 +18,19 @@ class ExecutorGenerator
|
||||
throw new ValidationException('Executor class must extend ' . Executor::class);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the code to create an instance of the executor.
|
||||
*
|
||||
* @return array{0: string, 1: string} an array containing the class name and the code string
|
||||
*/
|
||||
public function generateCode(): array
|
||||
{
|
||||
return match ($this->class) {
|
||||
UnixCMakeExecutor::class => [UnixCMakeExecutor::class, 'UnixCMakeExecutor::create($package)->build();'],
|
||||
UnixAutoconfExecutor::class => [UnixAutoconfExecutor::class, 'UnixAutoconfExecutor::create($package)->build();'],
|
||||
WindowsCMakeExecutor::class => [WindowsCMakeExecutor::class, 'WindowsCMakeExecutor::create($package)->build();'],
|
||||
default => throw new ValidationException("Unsupported executor class: {$this->class}"),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user