@@ -9,14 +9,14 @@ |
||
| 9 | 9 | public function boot() |
| 10 | 10 | { |
| 11 | 11 | $this->publishes([ |
| 12 | - __DIR__ . '/../../config/laravels.php' => base_path('config/laravels.php'), |
|
| 12 | + __DIR__.'/../../config/laravels.php' => base_path('config/laravels.php'), |
|
| 13 | 13 | ]); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | public function register() |
| 17 | 17 | { |
| 18 | 18 | $this->mergeConfigFrom( |
| 19 | - __DIR__ . '/../../config/laravels.php', 'laravels' |
|
| 19 | + __DIR__.'/../../config/laravels.php', 'laravels' |
|
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | 22 | $this->commands([ |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | { |
| 77 | 77 | $this->cleaners = array_unique(array_merge($cleaners, $this->cleaners)); |
| 78 | 78 | foreach ($this->cleaners as $class) { |
| 79 | - $this->currentApp->singleton($class, function () use ($class) { |
|
| 79 | + $this->currentApp->singleton($class, function() use ($class) { |
|
| 80 | 80 | $cleaner = new $class($this->currentApp, $this->snapshotApp); |
| 81 | 81 | if (!($cleaner instanceof BaseCleaner)) { |
| 82 | 82 | throw new \InvalidArgumentException(sprintf( |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | private function allControllerProperties() |
| 61 | 61 | { |
| 62 | 62 | $controllers = $this->allControllers(); |
| 63 | - array_walk($controllers, function (&$properties, $controller) { |
|
| 63 | + array_walk($controllers, function(&$properties, $controller) { |
|
| 64 | 64 | $properties = []; |
| 65 | 65 | // Get parent's properties |
| 66 | 66 | $parent = get_parent_class($controller); |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | public function addFileType($type) |
| 29 | 29 | { |
| 30 | - $type = '.' . trim($type, '.'); |
|
| 30 | + $type = '.'.trim($type, '.'); |
|
| 31 | 31 | $this->fileTypes[$type] = true; |
| 32 | 32 | } |
| 33 | 33 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | public function isExcluded($path) |
| 55 | 55 | { |
| 56 | 56 | foreach ($this->excludedDirs as $excludedDir) { |
| 57 | - if ($excludedDir === $path || strpos($path, $excludedDir . '/') === 0) { |
|
| 57 | + if ($excludedDir === $path || strpos($path, $excludedDir.'/') === 0) { |
|
| 58 | 58 | return true; |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | if ($file === '.' || $file === '..' || $this->isExcluded($file)) { |
| 89 | 89 | continue; |
| 90 | 90 | } |
| 91 | - $file = $path . DIRECTORY_SEPARATOR . $file; |
|
| 91 | + $file = $path.DIRECTORY_SEPARATOR.$file; |
|
| 92 | 92 | if (is_dir($file)) { |
| 93 | 93 | $this->_watch($file); |
| 94 | 94 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | public function start() |
| 124 | 124 | { |
| 125 | - Event::add($this->fd, function ($fp) { |
|
| 125 | + Event::add($this->fd, function($fp) { |
|
| 126 | 126 | $events = inotify_read($fp); |
| 127 | 127 | foreach ($events as $event) { |
| 128 | 128 | if ($event['mask'] == IN_IGNORED) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | continue; |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - Timer::after(100, function () use ($event) { |
|
| 141 | + Timer::after(100, function() use ($event) { |
|
| 142 | 142 | call_user_func_array($this->watchHandler, [$event]); |
| 143 | 143 | $this->doing = false; |
| 144 | 144 | }); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | if ($len > $this->chunkLimit) { |
| 38 | - for ($offset = 0, $limit = (int)(0.6 * $this->chunkLimit); $offset < $len; $offset += $limit) { |
|
| 38 | + for ($offset = 0, $limit = (int) (0.6 * $this->chunkLimit); $offset < $len; $offset += $limit) { |
|
| 39 | 39 | $chunk = substr($content, $offset, $limit); |
| 40 | 40 | $this->swooleResponse->write($chunk); |
| 41 | 41 | } |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | if ($deleteFile) { |
| 48 | 48 | $fp = fopen($path, 'rb'); |
| 49 | 49 | |
| 50 | - for ($offset = 0, $limit = (int)(0.99 * $this->chunkLimit); $offset < $size; $offset += $limit) { |
|
| 50 | + for ($offset = 0, $limit = (int) (0.99 * $this->chunkLimit); $offset < $size; $offset += $limit) { |
|
| 51 | 51 | fseek($fp, $offset, SEEK_SET); |
| 52 | 52 | $chunk = fread($fp, $limit); |
| 53 | 53 | $this->swooleResponse->write($chunk); |
@@ -24,8 +24,8 @@ discard block |
||
| 24 | 24 | $config['jobs'][] = CheckGlobalTimerAliveCronJob::class; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - $callback = function (Process $process) use ($swoole, $config, $laravelConfig) { |
|
| 28 | - $pidfile = dirname($swoole->setting['pid_file']) . '/' . $this->timerPidFile; |
|
| 27 | + $callback = function(Process $process) use ($swoole, $config, $laravelConfig) { |
|
| 28 | + $pidfile = dirname($swoole->setting['pid_file']).'/'.$this->timerPidFile; |
|
| 29 | 29 | file_put_contents($pidfile, $process->pid); |
| 30 | 30 | $this->setProcessTitle(sprintf('%s laravels: timer process', $config['process_prefix'])); |
| 31 | 31 | $this->initLaravel($laravelConfig, $swoole); |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $timerIds = $this->registerTimers($config['jobs']); |
| 41 | 41 | |
| 42 | - Process::signal(SIGUSR1, function ($signo) use ($config, $timerIds, $process) { |
|
| 42 | + Process::signal(SIGUSR1, function($signo) use ($config, $timerIds, $process) { |
|
| 43 | 43 | foreach ($timerIds as $timerId) { |
| 44 | 44 | if (Timer::exists($timerId)) { |
| 45 | 45 | Timer::clear($timerId); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | - Timer::after($config['max_wait_time'] * 1000, function () use ($process) { |
|
| 48 | + Timer::after($config['max_wait_time'] * 1000, function() use ($process) { |
|
| 49 | 49 | $process->exit(0); |
| 50 | 50 | }); |
| 51 | 51 | }); |
@@ -76,9 +76,9 @@ discard block |
||
| 76 | 76 | if (empty($job->interval())) { |
| 77 | 77 | throw new \InvalidArgumentException(sprintf('The interval of %s cannot be empty', get_class($job))); |
| 78 | 78 | } |
| 79 | - $runJob = function () use ($job) { |
|
| 80 | - $runCallback = function () use ($job) { |
|
| 81 | - $this->callWithCatchException(function () use ($job) { |
|
| 79 | + $runJob = function() use ($job) { |
|
| 80 | + $runCallback = function() use ($job) { |
|
| 81 | + $this->callWithCatchException(function() use ($job) { |
|
| 82 | 82 | if (($job instanceof CheckGlobalTimerAliveCronJob) || $job::isEnable()) { |
| 83 | 83 | $job->run(); |
| 84 | 84 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function interval() |
| 13 | 13 | { |
| 14 | - return (int)(static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000; |
|
| 14 | + return (int) (static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function isImmediate() |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function interval() |
| 13 | 13 | { |
| 14 | - return (int)(static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000; |
|
| 14 | + return (int) (static::GLOBAL_TIMER_LOCK_SECONDS * 0.9) * 1000; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | public function isImmediate() |