改名
This commit is contained in:
@@ -39,9 +39,9 @@ class Context extends BaseContext
|
|||||||
public static function increment($id, int $value = 1, $coroutineId = null): bool|int
|
public static function increment($id, int $value = 1, $coroutineId = null): bool|int
|
||||||
{
|
{
|
||||||
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
||||||
return Coroutine::getContext($coroutineId)[$id] += $value;
|
Coroutine::getContext($coroutineId)[$id] = 0;
|
||||||
}
|
}
|
||||||
return false;
|
return Coroutine::getContext($coroutineId)[$id] += $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,14 +52,11 @@ class Context extends BaseContext
|
|||||||
*/
|
*/
|
||||||
public static function decrement($id, int $value = 1, $coroutineId = null): bool|int
|
public static function decrement($id, int $value = 1, $coroutineId = null): bool|int
|
||||||
{
|
{
|
||||||
if (!static::hasContext($id)) {
|
if (!isset(Coroutine::getContext($coroutineId)[$id])) {
|
||||||
return false;
|
Coroutine::getContext($coroutineId)[$id] = 0;
|
||||||
}
|
}
|
||||||
if (isset(Coroutine::getContext($coroutineId)[$id])) {
|
|
||||||
return Coroutine::getContext($coroutineId)[$id] -= $value;
|
return Coroutine::getContext($coroutineId)[$id] -= $value;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @param $id
|
||||||
|
|||||||
Reference in New Issue
Block a user