From 250db97299078c8a61ccbc1403b0e8b318261cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 8 Mar 2021 11:44:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- System/Snowflake.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/System/Snowflake.php b/System/Snowflake.php index ad7f8f57..a10f973f 100644 --- a/System/Snowflake.php +++ b/System/Snowflake.php @@ -382,6 +382,33 @@ class Snowflake } + /** + * @return bool + */ + public static function isTask(): bool + { + return static::getEnvironmental() == static::TASK; + } + + + /** + * @return bool + */ + public static function isWorker(): bool + { + return static::getEnvironmental() == static::WORKER; + } + + + /** + * @return bool + */ + public static function isProcess(): bool + { + return static::getEnvironmental() == static::PROCESS; + } + + /** * @param $class * @param $file