This repository has been archived by the owner on Sep 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/swooletw/laravel-swoole …
…into develop
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace SwooleTW\Http\Concerns; | ||
|
||
use Swoole\Table; | ||
use SwooleTW\Http\Table\SwooleTable; | ||
|
||
trait InteractsWithSwooleQueue | ||
{ | ||
/** | ||
* Indicates if a packet is swoole's queue job. | ||
* | ||
* @param mixed | ||
*/ | ||
protected function isSwooleQueuePacket($packet) | ||
{ | ||
if (! is_string($packet)) { | ||
return false; | ||
} | ||
|
||
$decoded = json_decode($packet, true); | ||
|
||
return JSON_ERROR_NONE === json_last_error() && isset($decoded['job']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters