mirror of
https://github.com/pestphp/pest.git
synced 2026-03-06 15:57:21 +01:00
feat(parallel): Adds support for plugins to filter parallel arguments
This commit is contained in:
@ -60,6 +60,9 @@ final class Parallel implements HandlesArguments
|
|||||||
return ((int) $argvValue) === 1;
|
return ((int) $argvValue) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets a global value that can be accessed by the parent process and all workers.
|
||||||
|
*/
|
||||||
public static function setGlobal(string $key, string|int|bool|Stringable $value): void
|
public static function setGlobal(string $key, string|int|bool|Stringable $value): void
|
||||||
{
|
{
|
||||||
$data = ['value' => $value instanceof Stringable ? $value->__toString() : $value];
|
$data = ['value' => $value instanceof Stringable ? $value->__toString() : $value];
|
||||||
@ -67,6 +70,9 @@ final class Parallel implements HandlesArguments
|
|||||||
$_ENV[self::GLOBAL_PREFIX.$key] = json_encode($data);
|
$_ENV[self::GLOBAL_PREFIX.$key] = json_encode($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the given global value if one has been set.
|
||||||
|
*/
|
||||||
public static function getGlobal(string $key): string|int|bool|null
|
public static function getGlobal(string $key): string|int|bool|null
|
||||||
{
|
{
|
||||||
$placesToCheck = [$_SERVER, $_ENV];
|
$placesToCheck = [$_SERVER, $_ENV];
|
||||||
|
|||||||
Reference in New Issue
Block a user