1 | <?php |
||||||
2 | |||||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||||
3 | namespace Hhxsv5\LaravelS\Components\Apollo; |
||||||
4 | |||||||
5 | use Hhxsv5\LaravelS\Console\Portal; |
||||||
6 | use Hhxsv5\LaravelS\Swoole\Coroutine\Context; |
||||||
7 | use Hhxsv5\LaravelS\Swoole\Process\CustomProcessInterface; |
||||||
8 | use Swoole\Coroutine; |
||||||
9 | use Swoole\Http\Server; |
||||||
10 | use Swoole\Process as SwooleProcess; |
||||||
11 | |||||||
12 | class Process implements CustomProcessInterface |
||||||
0 ignored issues
–
show
|
|||||||
13 | { |
||||||
14 | /**@var Client $apollo */ |
||||||
0 ignored issues
–
show
|
|||||||
15 | protected static $apollo; |
||||||
16 | |||||||
17 | public static function getDefinition() |
||||||
0 ignored issues
–
show
|
|||||||
18 | { |
||||||
19 | return [ |
||||||
20 | 'apollo' => [ |
||||||
21 | 'class' => static::class, |
||||||
22 | 'redirect' => false, |
||||||
23 | 'pipe' => 0, |
||||||
24 | 'enable' => (bool)getenv('ENABLE_APOLLO'), |
||||||
25 | ], |
||||||
26 | ]; |
||||||
27 | } |
||||||
28 | |||||||
29 | public static function callback(Server $swoole, SwooleProcess $process) |
||||||
0 ignored issues
–
show
|
|||||||
30 | { |
||||||
31 | $filename = base_path('.env'); |
||||||
0 ignored issues
–
show
The function
base_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
32 | if (isset($_ENV['_ENV'])) { |
||||||
33 | $filename .= '.' . $_ENV['_ENV']; |
||||||
34 | } |
||||||
35 | |||||||
36 | self::$apollo = Client::createFromEnv(); |
||||||
37 | self::$apollo->startWatchNotification(function (array $notifications) use ($process, $filename) { |
||||||
0 ignored issues
–
show
The parameter
$notifications is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. ![]() |
|||||||
38 | $configs = self::$apollo->pullAllAndSave($filename); |
||||||
39 | app('log')->info('[ApolloProcess] Pull all configurations', $configs); |
||||||
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
40 | Portal::runLaravelSCommand(base_path(), 'reload'); |
||||||
0 ignored issues
–
show
The function
base_path was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||||
41 | if (Context::inCoroutine()) { |
||||||
42 | Coroutine::sleep(5); |
||||||
43 | } else { |
||||||
44 | sleep(5); |
||||||
45 | } |
||||||
46 | }); |
||||||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||||||
47 | } |
||||||
48 | |||||||
49 | public static function onReload(Server $swoole, SwooleProcess $process) |
||||||
0 ignored issues
–
show
|
|||||||
50 | { |
||||||
51 | // Stop the process... |
||||||
52 | self::$apollo->stopWatchNotification(); |
||||||
53 | } |
||||||
54 | } |