mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
add builder() and patch_point() global functions
This commit is contained in:
parent
7620d5900e
commit
fdc00301c0
@ -43,7 +43,7 @@ class BuilderProvider
|
|||||||
/**
|
/**
|
||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
*/
|
*/
|
||||||
public function getBuilder(): BuilderBase
|
public static function getBuilder(): BuilderBase
|
||||||
{
|
{
|
||||||
if (self::$builder === null) {
|
if (self::$builder === null) {
|
||||||
throw new WrongUsageException('Builder has not been initialized');
|
throw new WrongUsageException('Builder has not been initialized');
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
use SPC\builder\BuilderBase;
|
||||||
|
use SPC\builder\BuilderProvider;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
use SPC\exception\WrongUsageException;
|
use SPC\exception\WrongUsageException;
|
||||||
use SPC\util\UnixShell;
|
use SPC\util\UnixShell;
|
||||||
@ -127,3 +129,23 @@ function cmd(?bool $debug = null): WindowsCmd
|
|||||||
{
|
{
|
||||||
return new WindowsCmd($debug);
|
return new WindowsCmd($debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current builder.
|
||||||
|
*
|
||||||
|
* @throws WrongUsageException
|
||||||
|
*/
|
||||||
|
function builder(): BuilderBase
|
||||||
|
{
|
||||||
|
return BuilderProvider::getBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current patch point.
|
||||||
|
*
|
||||||
|
* @throws WrongUsageException
|
||||||
|
*/
|
||||||
|
function patch_point(): string
|
||||||
|
{
|
||||||
|
return BuilderProvider::getBuilder()->getPatchPoint();
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user