Total Complexity | 5 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | class Process implements CustomProcessInterface |
||
12 | { |
||
13 | /**@var Client $apollo */ |
||
14 | protected static $apollo; |
||
15 | |||
16 | public static function getDefinition() |
||
23 | ], |
||
24 | ]; |
||
25 | } |
||
26 | |||
27 | public static function callback(Server $swoole, SwooleProcess $process) |
||
28 | { |
||
29 | $filename = base_path('.env'); |
||
30 | $env = getenv('LARAVELS_ENV'); |
||
31 | if ($env) { |
||
32 | $filename .= '.' . $env; |
||
33 | } |
||
34 | |||
35 | self::$apollo = Client::createFromEnv(); |
||
36 | self::$apollo->startWatchNotification(function (array $notifications) use ($process, $filename) { |
||
|
|||
37 | $configs = self::$apollo->pullAllAndSave($filename); |
||
38 | app('log')->info('[ApolloProcess] Pull all configurations', $configs); |
||
39 | $process->exec(PHP_BINARY, [base_path('bin/laravels'), 'reload']); |
||
40 | if (Context::inCoroutine()) { |
||
41 | Coroutine::sleep(5); |
||
42 | } else { |
||
43 | sleep(5); |
||
44 | } |
||
45 | }); |
||
46 | } |
||
47 | |||
48 | public static function onReload(Server $swoole, SwooleProcess $process) |
||
52 | } |
||
53 | } |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.