for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Hhxsv5\LaravelS\Components\Apollo;
use Hhxsv5\LaravelS\Swoole\Coroutine\Context;
use Hhxsv5\LaravelS\Swoole\Process\CustomProcessInterface;
use Swoole\Coroutine;
use Swoole\Http\Server;
use Swoole\Process as SwooleProcess;
class Process implements CustomProcessInterface
{
/**@var Client $apollo */
protected static $apollo;
public static function getDefinition()
return [
'apollo' => [
'class' => self::class,
'redirect' => false,
'pipe' => 0,
],
];
}
public static function callback(Server $swoole, SwooleProcess $process)
$filename = base_path('.env');
$env = getenv('LARAVELS_ENV');
if ($env) {
$filename .= '.' . $env;
self::$apollo = Client::createFromEnv();
self::$apollo->startWatchNotification(function (array $notifications) use ($process, $filename) {
$notifications
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
self::$apollo->startWatchNotification(function (/** @scrutinizer ignore-unused */ array $notifications) use ($process, $filename) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$configs = self::$apollo->pullAllAndSave($filename);
app('log')->info('[ApolloProcess] Pull all configurations', $configs);
$process->exec(PHP_BINARY, [base_path('bin/laravels'), 'reload']);
if (Context::inCoroutine()) {
Coroutine::sleep(5);
} else {
sleep(5);
});
public static function onReload(Server $swoole, SwooleProcess $process)
// Stop the process...
self::$apollo->stopWatchNotification();
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.