forked from sy-records/game-ddz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelper.php
37 lines (35 loc) · 795 Bytes
/
Helper.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
use Swoole\Websocket\Frame;
use Hyperf\Server\ServerFactory;
use Hyperf\Utils\ApplicationContext;
use Swoole\WebSocket\Server as WebSocketServer;
if (!function_exists('container')) {
function container()
{
return ApplicationContext::getContainer();
}
}
if (!function_exists('redis')) {
function redis()
{
return container()->get(\Redis::class);
}
}
if (!function_exists('server')) {
function server()
{
return container()->get(ServerFactory::class)->getServer()->getServer();
}
}
if (!function_exists('frame')) {
function frame()
{
return container()->get(Frame::class);
}
}
if (!function_exists('websocket')) {
function websocket()
{
return container()->get(WebSocketServer::class);
}
}