Completed
Pull Request — master (#266)
by
unknown
06:19 queued 02:53
created
src/Components/HttpClient/SimpleHttpTrait.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
             $parts = parse_url($url);
32 32
             $path = isset($parts['path']) ? $parts['path'] : '/';
33 33
             if (isset($parts['query'])) {
34
-                $path .= '?' . $parts['query'];
34
+                $path .= '?'.$parts['query'];
35 35
             }
36 36
             if (isset($parts['fragment'])) {
37
-                $path .= '#' . $parts['fragment'];
37
+                $path .= '#'.$parts['fragment'];
38 38
             }
39 39
             $client = new CoroutineClient($parts['host'], isset($parts['port']) ? $parts['port'] : 80, isset($parts['scheme']) && $parts['scheme'] === 'https');
40 40
             if (isset($options['timeout'])) {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
                     continue;
90 90
                 }
91 91
                 if (isset($headers[$key])) {
92
-                    $headers[$key] = (array)$headers[$key];
92
+                    $headers[$key] = (array) $headers[$key];
93 93
                     $headers[$key][] = isset($middle[1]) ? trim($middle[1]) : '';
94 94
                 } else {
95 95
                     $headers[$key] = isset($middle[1]) ? trim($middle[1]) : '';
Please login to merge, or discard this patch.
src/Components/Apollo/Process.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
                 'class'    => self::class,
21 21
                 'redirect' => false,
22 22
                 'pipe'     => 0,
23
-                'enable'   => (bool)getenv('ENABLE_APOLLO'),
23
+                'enable'   => (bool) getenv('ENABLE_APOLLO'),
24 24
             ],
25 25
         ];
26 26
     }
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
         $filename = base_path('.env');
31 31
         $env = getenv('LARAVELS_ENV');
32 32
         if ($env !== false) {
33
-            $filename .= '.' . $env;
33
+            $filename .= '.'.$env;
34 34
         }
35 35
 
36 36
         self::$apollo = Client::createFromEnv();
37
-        self::$apollo->startWatchNotification(function (array $notifications) use ($process, $filename) {
37
+        self::$apollo->startWatchNotification(function(array $notifications) use ($process, $filename) {
38 38
             $configs = self::$apollo->pullAllAndSave($filename);
39 39
             app('log')->info('[ApolloProcess] Pull all configurations', $configs);
40 40
             $process->exec(PHP_BINARY, [base_path('bin/laravels'), 'reload']);
Please login to merge, or discard this patch.
src/Components/Apollo/Client.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
             $this->clientIp = current(swoole_get_local_ip()) ?: null;
42 42
         }
43 43
         if (isset($settings['pull_timeout'])) {
44
-            $this->pullTimeout = (int)$settings['pull_timeout'];
44
+            $this->pullTimeout = (int) $settings['pull_timeout'];
45 45
         }
46 46
         if (isset($settings['backup_old_env'])) {
47
-            $this->backupOldEnv = (bool)$settings['backup_old_env'];
47
+            $this->backupOldEnv = (bool) $settings['backup_old_env'];
48 48
         }
49 49
     }
50 50
 
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
         $settings = [
74 74
             'server'         => getenv('APOLLO_SERVER'),
75 75
             'app_id'         => getenv('APOLLO_APP_ID'),
76
-            'cluster'        => ($cluster = (string)getenv('APOLLO_CLUSTER')) !== '' ? $cluster : null,
77
-            'namespaces'     => ($namespaces = (string)getenv('APOLLO_NAMESPACES')) !== '' ? explode(',', $namespaces) : null,
78
-            'client_ip'      => ($clientIp = (string)getenv('APOLLO_CLIENT_IP')) !== '' ? $clientIp : null,
79
-            'pull_timeout'   => ($pullTimeout = (int)getenv('APOLLO_PULL_TIMEOUT')) > 0 ? $pullTimeout : null,
80
-            'backup_old_env' => ($backupOldEnv = (bool)getenv('APOLLO_BACKUP_OLD_ENV')) ? $backupOldEnv : null,
76
+            'cluster'        => ($cluster = (string) getenv('APOLLO_CLUSTER')) !== '' ? $cluster : null,
77
+            'namespaces'     => ($namespaces = (string) getenv('APOLLO_NAMESPACES')) !== '' ? explode(',', $namespaces) : null,
78
+            'client_ip'      => ($clientIp = (string) getenv('APOLLO_CLIENT_IP')) !== '' ? $clientIp : null,
79
+            'pull_timeout'   => ($pullTimeout = (int) getenv('APOLLO_PULL_TIMEOUT')) > 0 ? $pullTimeout : null,
80
+            'backup_old_env' => ($backupOldEnv = (bool) getenv('APOLLO_BACKUP_OLD_ENV')) ? $backupOldEnv : null,
81 81
         ];
82 82
         return new static($settings);
83 83
     }
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
             'cluster'        => isset($options['apollo-cluster']) && $options['apollo-cluster'] !== '' ? $options['apollo-cluster'] : null,
94 94
             'namespaces'     => !empty($options['apollo-namespaces']) ? $options['apollo-namespaces'] : null,
95 95
             'client_ip'      => isset($options['apollo-client-ip']) && $options['apollo-client-ip'] !== '' ? $options['apollo-client-ip'] : null,
96
-            'pull_timeout'   => isset($options['apollo-pull-timeout']) ? (int)$options['apollo-pull-timeout'] : null,
97
-            'backup_old_env' => isset($options['apollo-backup-old-env']) ? (bool)$options['apollo-backup-old-env'] : null,
96
+            'pull_timeout'   => isset($options['apollo-pull-timeout']) ? (int) $options['apollo-pull-timeout'] : null,
97
+            'backup_old_env' => isset($options['apollo-backup-old-env']) ? (bool) $options['apollo-backup-old-env'] : null,
98 98
         ];
99 99
         return new static($settings);
100 100
     }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
         $configs = [];
117 117
         $uri = sprintf('%s/configs/%s/%s/', $this->server, $this->appId, $this->cluster);
118 118
         foreach ($namespaces as $namespace) {
119
-            $url = $uri . $namespace . '?' . http_build_query([
119
+            $url = $uri.$namespace.'?'.http_build_query([
120 120
                     'releaseKey' => $withReleaseKey && isset($this->releaseKeys[$namespace]) ? $this->releaseKeys[$namespace] : null,
121 121
                     'ip'         => $this->clientIp,
122 122
                 ]);
@@ -146,11 +146,11 @@  discard block
 block discarded – undo
146 146
         $all = $this->pullAll(false, $options);
147 147
         if (count($all) !== count($this->namespaces)) {
148 148
             $lackNamespaces = array_diff($this->namespaces, array_keys($all));
149
-            throw new \RuntimeException('Missing Apollo configurations for namespaces ' . implode(',', $lackNamespaces));
149
+            throw new \RuntimeException('Missing Apollo configurations for namespaces '.implode(',', $lackNamespaces));
150 150
         }
151 151
         $configs = [];
152 152
         foreach ($all as $namespace => $config) {
153
-            $configs[] = '# Namespace: ' . $config['namespaceName'];
153
+            $configs[] = '# Namespace: '.$config['namespaceName'];
154 154
             ksort($config['configurations']);
155 155
             foreach ($config['configurations'] as $key => $value) {
156 156
                 $configs[] = sprintf('%s=%s', $key, $value);
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             throw new \RuntimeException('Empty Apollo configuration list');
161 161
         }
162 162
         if ($this->backupOldEnv && file_exists($filepath)) {
163
-            rename($filepath, $filepath . '.' . date('YmdHis'));
163
+            rename($filepath, $filepath.'.'.date('YmdHis'));
164 164
         }
165 165
         $fileContent = implode(PHP_EOL, $configs);
166 166
         if (Context::inCoroutine()) {
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                 if (!empty($this->notifications) && current($this->notifications)['notificationId'] !== -1) { // Ignore the first pull
201 201
                     $callback($notifications);
202 202
                 }
203
-                array_walk($notifications, function (&$notification) {
203
+                array_walk($notifications, function(&$notification) {
204 204
                     unset($notification['messages']);
205 205
                 });
206 206
                 $this->notifications = array_merge($this->notifications, array_column($notifications, null, 'namespaceName'));
Please login to merge, or discard this patch.
src/Illuminate/Laravel.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
         self::autoload($this->conf['root_path']);
81 81
 
82 82
         // Make kernel for Laravel
83
-        $app = require $this->conf['root_path'] . '/bootstrap/app.php';
83
+        $app = require $this->conf['root_path'].'/bootstrap/app.php';
84 84
         $kernel = $this->isLumen() ? null : $app->make(HttpKernel::class);
85 85
 
86 86
         // Load all Configurations for Lumen
@@ -104,14 +104,14 @@  discard block
 block discarded – undo
104 104
     {
105 105
         $cfgPaths = [
106 106
             // Framework default configuration
107
-            $this->conf['root_path'] . '/vendor/laravel/lumen-framework/config/',
107
+            $this->conf['root_path'].'/vendor/laravel/lumen-framework/config/',
108 108
             // App configuration
109
-            $this->conf['root_path'] . '/config/',
109
+            $this->conf['root_path'].'/config/',
110 110
         ];
111 111
 
112 112
         $keys = [];
113 113
         foreach ($cfgPaths as $cfgPath) {
114
-            $configs = (array)glob($cfgPath . '*.php');
114
+            $configs = (array) glob($cfgPath.'*.php');
115 115
             foreach ($configs as $config) {
116 116
                 $config = substr(basename($config), 0, -4);
117 117
                 $keys[$config] = $config;
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
 
126 126
     public static function autoload($rootPath)
127 127
     {
128
-        $autoload = $rootPath . '/bootstrap/autoload.php';
128
+        $autoload = $rootPath.'/bootstrap/autoload.php';
129 129
         if (file_exists($autoload)) {
130 130
             require_once $autoload;
131 131
         } else {
132
-            require_once $rootPath . '/vendor/autoload.php';
132
+            require_once $rootPath.'/vendor/autoload.php';
133 133
         }
134 134
     }
135 135
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             if ($response instanceof SymfonyResponse) {
148 148
                 $content = $response->getContent();
149 149
             } else {
150
-                $content = (string)$response;
150
+                $content = (string) $response;
151 151
             }
152 152
 
153 153
             $this->reflectionApp->callTerminableMiddleware($response);
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         $uri = urldecode($uri);
177 177
 
178 178
         $publicPath = $this->conf['static_path'];
179
-        $requestFile = $publicPath . $uri;
179
+        $requestFile = $publicPath.$uri;
180 180
         if (is_file($requestFile)) {
181 181
             return $this->createStaticResponse($requestFile, $request);
182 182
         } elseif (is_dir($requestFile)) {
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
     protected function lookupIndex($folder)
195 195
     {
196
-        $folder = rtrim($folder, '/') . '/';
196
+        $folder = rtrim($folder, '/').'/';
197 197
         foreach (['index.html', 'index.htm'] as $index) {
198
-            $tmpFile = $folder . $index;
198
+            $tmpFile = $folder.$index;
199 199
             if (is_file($tmpFile)) {
200 200
                 return $tmpFile;
201 201
             }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 
237 237
     public function bindSwoole($swoole)
238 238
     {
239
-        $this->currentApp->singleton('swoole', function () use ($swoole) {
239
+        $this->currentApp->singleton('swoole', function() use ($swoole) {
240 240
             return $swoole;
241 241
         });
242 242
     }
Please login to merge, or discard this patch.
src/Illuminate/LaravelScheduleJob.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 
16 16
     public function interval()
17 17
     {
18
-        return 60 * 1000;// Run every 1 minute
18
+        return 60 * 1000; // Run every 1 minute
19 19
     }
20 20
 
21 21
     public function isImmediate()
Please login to merge, or discard this patch.
src/Illuminate/LaravelSServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@
 block discarded – undo
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([
Please login to merge, or discard this patch.
src/Illuminate/CleanerManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.
src/Illuminate/LaravelSCommand.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 
21 21
     public function handle()
22 22
     {
23
-        $action = (string)$this->argument('action');
23
+        $action = (string) $this->argument('action');
24 24
         switch ($action) {
25 25
             case 'publish':
26 26
                 $this->publish();
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     {
53 53
         // Load configuration laravel.php manually for Lumen
54 54
         $basePath = config('laravels.laravel_base_path') ?: base_path();
55
-        if ($this->isLumen() && file_exists($basePath . '/config/laravels.php')) {
55
+        if ($this->isLumen() && file_exists($basePath.'/config/laravels.php')) {
56 56
             $this->getLaravel()->configure('laravels');
57 57
         }
58 58
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     {
85 85
         $this->comment('>>> Components');
86 86
         $laravelSVersion = '-';
87
-        $cfg = (array)json_decode(file_get_contents(base_path('composer.lock')), true);
87
+        $cfg = (array) json_decode(file_get_contents(base_path('composer.lock')), true);
88 88
         if (isset($cfg['packages'])) {
89 89
             $packages = array_merge($cfg['packages'], Arr::get($cfg, 'packages-dev', []));
90 90
             foreach ($packages as $package) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
                 $laravelSVersion,
109 109
             ],
110 110
             [
111
-                $this->getApplication()->getName() . ' [<info>' . env('APP_ENV', config('app.env')) . '</info>]',
111
+                $this->getApplication()->getName().' [<info>'.env('APP_ENV', config('app.env')).'</info>]',
112 112
                 $this->getApplication()->getVersion(),
113 113
             ],
114 114
         ]);
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     {
119 119
         $this->comment('>>> Protocols');
120 120
 
121
-        $config = (array)json_decode(file_get_contents(base_path('storage/laravels.json')), true);
121
+        $config = (array) json_decode(file_get_contents(base_path('storage/laravels.json')), true);
122 122
         $socketType = isset($config['server']['socket_type']) ? $config['server']['socket_type'] : SWOOLE_SOCK_TCP;
123 123
         if (in_array($socketType, [SWOOLE_SOCK_UNIX_DGRAM, SWOOLE_SOCK_UNIX_STREAM])) {
124 124
             $listenAt = $config['server']['listen_ip'];
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 continue;
158 158
             }
159 159
 
160
-            $name = 'Port#' . $key . ' ';
160
+            $name = 'Port#'.$key.' ';
161 161
             $name .= isset($socketTypeNames[$socket['type']]) ? $socketTypeNames[$socket['type']] : 'Unknown socket';
162 162
             $tableRows [] = [
163 163
                 $name,
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
         $laravelConf = [
186 186
             'root_path'           => $svrConf['laravel_base_path'],
187 187
             'static_path'         => $svrConf['swoole']['document_root'],
188
-            'cleaners'            => array_unique((array)Arr::get($svrConf, 'cleaners', [])),
189
-            'register_providers'  => array_unique((array)Arr::get($svrConf, 'register_providers', [])),
188
+            'cleaners'            => array_unique((array) Arr::get($svrConf, 'cleaners', [])),
189
+            'register_providers'  => array_unique((array) Arr::get($svrConf, 'register_providers', [])),
190 190
             'destroy_controllers' => Arr::get($svrConf, 'destroy_controllers', []),
191 191
             'is_lumen'            => $this->isLumen(),
192 192
             '_SERVER'             => $_SERVER,
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             $svrConf['ignore_check_pid'] = false;
216 216
         }
217 217
         if (empty($svrConf['swoole']['document_root'])) {
218
-            $svrConf['swoole']['document_root'] = $svrConf['laravel_base_path'] . '/public';
218
+            $svrConf['swoole']['document_root'] = $svrConf['laravel_base_path'].'/public';
219 219
         }
220 220
         if ($this->option('daemonize')) {
221 221
             $svrConf['swoole']['daemonize'] = true;
@@ -251,34 +251,34 @@  discard block
 block discarded – undo
251 251
     public function publish()
252 252
     {
253 253
         $basePath = config('laravels.laravel_base_path') ?: base_path();
254
-        $configPath = $basePath . '/config/laravels.php';
254
+        $configPath = $basePath.'/config/laravels.php';
255 255
         $todoList = [
256 256
             [
257
-                'from' => realpath(__DIR__ . '/../../config/laravels.php'),
257
+                'from' => realpath(__DIR__.'/../../config/laravels.php'),
258 258
                 'to'   => $configPath,
259 259
                 'mode' => 0644,
260 260
             ],
261 261
             [
262
-                'from' => realpath(__DIR__ . '/../../bin/laravels'),
263
-                'to'   => $basePath . '/bin/laravels',
262
+                'from' => realpath(__DIR__.'/../../bin/laravels'),
263
+                'to'   => $basePath.'/bin/laravels',
264 264
                 'mode' => 0755,
265 265
                 'link' => true,
266 266
             ],
267 267
             [
268
-                'from' => realpath(__DIR__ . '/../../bin/fswatch'),
269
-                'to'   => $basePath . '/bin/fswatch',
268
+                'from' => realpath(__DIR__.'/../../bin/fswatch'),
269
+                'to'   => $basePath.'/bin/fswatch',
270 270
                 'mode' => 0755,
271 271
                 'link' => true,
272 272
             ],
273 273
             [
274
-                'from' => realpath(__DIR__ . '/../../bin/inotify'),
275
-                'to'   => $basePath . '/bin/inotify',
274
+                'from' => realpath(__DIR__.'/../../bin/inotify'),
275
+                'to'   => $basePath.'/bin/inotify',
276 276
                 'mode' => 0755,
277 277
                 'link' => true,
278 278
             ],
279 279
         ];
280 280
         if (file_exists($configPath)) {
281
-            $choice = $this->anticipate($configPath . ' already exists, do you want to override it ? Y/N',
281
+            $choice = $this->anticipate($configPath.' already exists, do you want to override it ? Y/N',
282 282
                 ['Y', 'N'],
283 283
                 'N'
284 284
             );
Please login to merge, or discard this patch.
src/Illuminate/ListPropertiesCommand.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.