Completed
Push — master ( d6d8a1...fab734 )
by Elf
04:41
created
src/Services/Agent/Client.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace ElfSundae\Laravel\Support\Services\Agent;
4 4
 
5
-use Illuminate\Support\Arr;
6 5
 use Jenssegers\Agent\Agent;
7 6
 use Illuminate\Support\Fluent;
8 7
 use ElfSundae\Laravel\Support\Traits\FluentArrayAccess;
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     {
81 81
         $version = $this->agent->version($propertyName, $type);
82 82
 
83
-        return is_string($version) ? str_replace(['_', '+'], '.', $version) : $version;
83
+        return is_string($version) ? str_replace([ '_', '+' ], '.', $version) : $version;
84 84
     }
85 85
 
86 86
     /**
@@ -106,10 +106,10 @@  discard block
 block discarded – undo
106 106
         if (func_num_args() > 0) {
107 107
             $checkChannels = is_array(func_get_arg(0)) ? func_get_arg(0) : func_get_args();
108 108
 
109
-            return in_arrayi($this->attributes['appChannel'], $checkChannels);
109
+            return in_arrayi($this->attributes[ 'appChannel' ], $checkChannels);
110 110
         }
111 111
 
112
-        return $this->attributes['appChannel'];
112
+        return $this->attributes[ 'appChannel' ];
113 113
     }
114 114
 
115 115
     /**
@@ -153,15 +153,15 @@  discard block
 block discarded – undo
153 153
         ];
154 154
 
155 155
         if ($this->agent->is('iOS')) {
156
-            $info['os'] = 'iOS';
156
+            $info[ 'os' ] = 'iOS';
157 157
         }
158 158
 
159 159
         if ($this->agent->is('AndroidOS')) {
160
-            $info['os'] = 'Android';
160
+            $info[ 'os' ] = 'Android';
161 161
         }
162 162
 
163 163
         if (is_string($this->version('MicroMessenger'))) {
164
-            $info['isWechat'] = true;
164
+            $info[ 'isWechat' ] = true;
165 165
         }
166 166
 
167 167
         return array_filter($info);
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             $this->getAppClientData($this->agent->getUserAgent())
181 181
         );
182 182
 
183
-        if (! $data) {
183
+        if (!$data) {
184 184
             $this->resetAppClientAttributes();
185 185
         }
186 186
 
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
     protected function getAppClientData($userAgent)
197 197
     {
198 198
         if (preg_match('#client\((.+)\)#is', $userAgent, $matches)) {
199
-            if ($info = json_decode(urlsafe_base64_decode($matches[1]), true)) {
200
-                if (is_array($info) && ! empty($info)) {
199
+            if ($info = json_decode(urlsafe_base64_decode($matches[ 1 ]), true)) {
200
+                if (is_array($info) && !empty($info)) {
201 201
                     return $info;
202 202
                 }
203 203
             }
204 204
         }
205 205
 
206
-        return [];
206
+        return [ ];
207 207
     }
208 208
 
209 209
     /**
@@ -215,29 +215,29 @@  discard block
 block discarded – undo
215 215
     protected function getAppClientAttributes($info)
216 216
     {
217 217
         $info = array_filter($info);
218
-        $data = [];
218
+        $data = [ ];
219 219
 
220 220
         if (
221
-            ($data['os'] = array_get($info, 'os')) &&
222
-            ($data['osVersion'] = array_get($info, 'osV')) &&
223
-            ($data['platform'] = array_get($info, 'pf')) &&
224
-            ($data['locale'] = array_get($info, 'loc')) &&
225
-            ($data['app'] = array_get($info, 'app')) &&
226
-            ($data['appVersion'] = array_get($info, 'appV')) &&
227
-            ($data['appChannel'] = array_get($info, 'appC')) &&
228
-            ($data['network'] = array_get($info, 'net')) &&
229
-            ($data['udid'] = array_get($info, 'udid'))
221
+            ($data[ 'os' ] = array_get($info, 'os')) &&
222
+            ($data[ 'osVersion' ] = array_get($info, 'osV')) &&
223
+            ($data[ 'platform' ] = array_get($info, 'pf')) &&
224
+            ($data[ 'locale' ] = array_get($info, 'loc')) &&
225
+            ($data[ 'app' ] = array_get($info, 'app')) &&
226
+            ($data[ 'appVersion' ] = array_get($info, 'appV')) &&
227
+            ($data[ 'appChannel' ] = array_get($info, 'appC')) &&
228
+            ($data[ 'network' ] = array_get($info, 'net')) &&
229
+            ($data[ 'udid' ] = array_get($info, 'udid'))
230 230
         ) {
231
-            if ($data['os'] === 'iPhone OS') {
232
-                $data['os'] = 'iOS';
231
+            if ($data[ 'os' ] === 'iPhone OS') {
232
+                $data[ 'os' ] = 'iOS';
233 233
             }
234 234
 
235
-            $data['isAppClient'] = true;
235
+            $data[ 'isAppClient' ] = true;
236 236
 
237 237
             return array_filter($data);
238 238
         }
239 239
 
240
-        return [];
240
+        return [ ];
241 241
     }
242 242
 
243 243
     /**
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
     protected function resetAppClientAttributes()
247 247
     {
248 248
         unset(
249
-            $this->attributes['app'],
250
-            $this->attributes['appVersion'],
251
-            $this->attributes['appChannel'],
252
-            $this->attributes['network'],
253
-            $this->attributes['udid'],
254
-            $this->attributes['isAppClient']
249
+            $this->attributes[ 'app' ],
250
+            $this->attributes[ 'appVersion' ],
251
+            $this->attributes[ 'appChannel' ],
252
+            $this->attributes[ 'network' ],
253
+            $this->attributes[ 'udid' ],
254
+            $this->attributes[ 'isAppClient' ]
255 255
         );
256 256
     }
257 257
 
@@ -264,6 +264,6 @@  discard block
 block discarded – undo
264 264
      */
265 265
     public function __call($method, $parameters)
266 266
     {
267
-        return call_user_func_array([$this->agent, $method], $parameters);
267
+        return call_user_func_array([ $this->agent, $method ], $parameters);
268 268
     }
269 269
 }
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 use Ramsey\Uuid\Uuid;
4 4
 
5
-if (! function_exists('is_domain')) {
5
+if (!function_exists('is_domain')) {
6 6
     /**
7 7
      * Determines the current domain equals to the given domain identifier.
8 8
      *
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     }
16 16
 }
17 17
 
18
-if (! function_exists('app_url')) {
18
+if (!function_exists('app_url')) {
19 19
     /**
20 20
      * Generate an URL for the application.
21 21
      *
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
     function app_url($path = '', $parameters = null, $identifier = 'site')
28 28
     {
29 29
         $path = trim($path, '/');
30
-        if (! empty($path) && ! starts_with($path, ['?', '&', '#'])) {
30
+        if (!empty($path) && !starts_with($path, [ '?', '&', '#' ])) {
31 31
             $path = '/'.$path;
32 32
         }
33 33
 
34
-        if (! is_null($parameters)) {
34
+        if (!is_null($parameters)) {
35 35
             $query = http_build_query($parameters);
36
-            if (! empty($query)) {
37
-                $path .= (str_contains($path, ['?', '&', '#']) ? '&' : '?').$query;
36
+            if (!empty($query)) {
37
+                $path .= (str_contains($path, [ '?', '&', '#' ]) ? '&' : '?').$query;
38 38
             }
39 39
         }
40 40
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     }
47 47
 }
48 48
 
49
-if (! function_exists('revision')) {
49
+if (!function_exists('revision')) {
50 50
     /**
51 51
      * Get the revisioned asset path.
52 52
      *
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     }
64 64
 }
65 65
 
66
-if (! function_exists('asset_from')) {
66
+if (!function_exists('asset_from')) {
67 67
     /**
68 68
      * Generate the URL to an asset from a custom root domain such as CDN, etc.
69 69
      *
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     }
79 79
 }
80 80
 
81
-if (! function_exists('asset_url')) {
81
+if (!function_exists('asset_url')) {
82 82
     /**
83 83
      * Generate an asset URL.
84 84
      *
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     }
96 96
 }
97 97
 
98
-if (! function_exists('cdn_url')) {
98
+if (!function_exists('cdn_url')) {
99 99
     /**
100 100
      * Generate an asset CDN URL.
101 101
      *
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     }
109 109
 }
110 110
 
111
-if (! function_exists('gravatar')) {
111
+if (!function_exists('gravatar')) {
112 112
     /**
113 113
      * Generate a Gravatar url.
114 114
      *
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
     }
139 139
 }
140 140
 
141
-if (! function_exists('optimus_encode')) {
141
+if (!function_exists('optimus_encode')) {
142 142
     /**
143 143
      * Encode a number with Optimus.
144 144
      *
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     }
152 152
 }
153 153
 
154
-if (! function_exists('optimus_decode')) {
154
+if (!function_exists('optimus_decode')) {
155 155
     /**
156 156
      * Decode a number with Optimus.
157 157
      *
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     }
165 165
 }
166 166
 
167
-if (! function_exists('random_uuid')) {
167
+if (!function_exists('random_uuid')) {
168 168
     /**
169 169
      * Generate a version 4 (random) UUID.
170 170
      *
Please login to merge, or discard this patch.
src/Services/Agent/AgentServiceProvider.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function boot()
16 16
     {
17
-        $this->app['view']->share('client', $this->app['client']);
17
+        $this->app[ 'view' ]->share('client', $this->app[ 'client' ]);
18 18
     }
19 19
 
20 20
     /**
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
      */
37 37
     protected function registerAgent()
38 38
     {
39
-        if (! $this->app->bound('agent')) {
40
-            $this->app->singleton('agent', function () {
39
+        if (!$this->app->bound('agent')) {
40
+            $this->app->singleton('agent', function() {
41 41
                 return new Agent;
42 42
             });
43 43
 
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function registerClient()
54 54
     {
55
-        $this->app->singleton('client', function ($app) {
55
+        $this->app->singleton('client', function($app) {
56 56
             return (new Client)->setAgent($app->make('agent'));
57 57
         });
58 58
 
Please login to merge, or discard this patch.