Completed
Push — develop ( e2688f...d26e21 )
by Zack
29:42 queued 09:43
created
vendor/illuminate/contracts/Pagination/LengthAwarePaginator.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -4,26 +4,26 @@
 block discarded – undo
4 4
 
5 5
 interface LengthAwarePaginator extends Paginator
6 6
 {
7
-    /**
8
-     * Create a range of pagination URLs.
9
-     *
10
-     * @param  int  $start
11
-     * @param  int  $end
12
-     * @return array
13
-     */
14
-    public function getUrlRange($start, $end);
7
+	/**
8
+	 * Create a range of pagination URLs.
9
+	 *
10
+	 * @param  int  $start
11
+	 * @param  int  $end
12
+	 * @return array
13
+	 */
14
+	public function getUrlRange($start, $end);
15 15
 
16
-    /**
17
-     * Determine the total number of items in the data store.
18
-     *
19
-     * @return int
20
-     */
21
-    public function total();
16
+	/**
17
+	 * Determine the total number of items in the data store.
18
+	 *
19
+	 * @return int
20
+	 */
21
+	public function total();
22 22
 
23
-    /**
24
-     * Get the page number of the last available page.
25
-     *
26
-     * @return int
27
-     */
28
-    public function lastPage();
23
+	/**
24
+	 * Get the page number of the last available page.
25
+	 *
26
+	 * @return int
27
+	 */
28
+	public function lastPage();
29 29
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      * @param  int  $end
12 12
      * @return array
13 13
      */
14
-    public function getUrlRange($start, $end);
14
+    public function getUrlRange( $start, $end );
15 15
 
16 16
     /**
17 17
      * Determine the total number of items in the data store.
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Illuminate\Contracts\Pagination;
4 4
 
5
-interface LengthAwarePaginator extends Paginator
6
-{
5
+interface LengthAwarePaginator extends Paginator {
7 6
     /**
8 7
      * Create a range of pagination URLs.
9 8
      *
Please login to merge, or discard this patch.
vendor/illuminate/contracts/Validation/ValidatesWhenResolved.php 2 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Illuminate\Contracts\Validation;
4 4
 
5
-interface ValidatesWhenResolved
6
-{
5
+interface ValidatesWhenResolved {
7 6
     /**
8 7
      * Validate the given class instance.
9 8
      *
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@
 block discarded – undo
10 10
 
11 11
 interface ValidatesWhenResolved
12 12
 {
13
-    /**
14
-     * Validate the given class instance.
15
-     *
16
-     * @return void
17
-     */
18
-    public function validate();
13
+	/**
14
+	 * Validate the given class instance.
15
+	 *
16
+	 * @return void
17
+	 */
18
+	public function validate();
19 19
 }
Please login to merge, or discard this patch.
vendor/illuminate/contracts/Validation/Factory.php 3 patches
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@
 block discarded – undo
2 2
 
3 3
 namespace Illuminate\Contracts\Validation;
4 4
 
5
-interface Factory
6
-{
5
+interface Factory {
7 6
     /**
8 7
      * Create a new Validator instance.
9 8
      *
Please login to merge, or discard this patch.
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -4,43 +4,43 @@
 block discarded – undo
4 4
 
5 5
 interface Factory
6 6
 {
7
-    /**
8
-     * Create a new Validator instance.
9
-     *
10
-     * @param  array  $data
11
-     * @param  array  $rules
12
-     * @param  array  $messages
13
-     * @param  array  $customAttributes
14
-     * @return \Illuminate\Contracts\Validation\Validator
15
-     */
16
-    public function make(array $data, array $rules, array $messages = [], array $customAttributes = []);
7
+	/**
8
+	 * Create a new Validator instance.
9
+	 *
10
+	 * @param  array  $data
11
+	 * @param  array  $rules
12
+	 * @param  array  $messages
13
+	 * @param  array  $customAttributes
14
+	 * @return \Illuminate\Contracts\Validation\Validator
15
+	 */
16
+	public function make(array $data, array $rules, array $messages = [], array $customAttributes = []);
17 17
 
18
-    /**
19
-     * Register a custom validator extension.
20
-     *
21
-     * @param  string  $rule
22
-     * @param  \Closure|string  $extension
23
-     * @param  string  $message
24
-     * @return void
25
-     */
26
-    public function extend($rule, $extension, $message = null);
18
+	/**
19
+	 * Register a custom validator extension.
20
+	 *
21
+	 * @param  string  $rule
22
+	 * @param  \Closure|string  $extension
23
+	 * @param  string  $message
24
+	 * @return void
25
+	 */
26
+	public function extend($rule, $extension, $message = null);
27 27
 
28
-    /**
29
-     * Register a custom implicit validator extension.
30
-     *
31
-     * @param  string   $rule
32
-     * @param  \Closure|string  $extension
33
-     * @param  string  $message
34
-     * @return void
35
-     */
36
-    public function extendImplicit($rule, $extension, $message = null);
28
+	/**
29
+	 * Register a custom implicit validator extension.
30
+	 *
31
+	 * @param  string   $rule
32
+	 * @param  \Closure|string  $extension
33
+	 * @param  string  $message
34
+	 * @return void
35
+	 */
36
+	public function extendImplicit($rule, $extension, $message = null);
37 37
 
38
-    /**
39
-     * Register a custom implicit validator message replacer.
40
-     *
41
-     * @param  string   $rule
42
-     * @param  \Closure|string  $replacer
43
-     * @return void
44
-     */
45
-    public function replacer($rule, $replacer);
38
+	/**
39
+	 * Register a custom implicit validator message replacer.
40
+	 *
41
+	 * @param  string   $rule
42
+	 * @param  \Closure|string  $replacer
43
+	 * @return void
44
+	 */
45
+	public function replacer($rule, $replacer);
46 46
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
      * @param  array  $customAttributes
14 14
      * @return \Illuminate\Contracts\Validation\Validator
15 15
      */
16
-    public function make(array $data, array $rules, array $messages = [], array $customAttributes = []);
16
+    public function make( array $data, array $rules, array $messages = [ ], array $customAttributes = [ ] );
17 17
 
18 18
     /**
19 19
      * Register a custom validator extension.
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param  string  $message
24 24
      * @return void
25 25
      */
26
-    public function extend($rule, $extension, $message = null);
26
+    public function extend( $rule, $extension, $message = null );
27 27
 
28 28
     /**
29 29
      * Register a custom implicit validator extension.
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param  string  $message
34 34
      * @return void
35 35
      */
36
-    public function extendImplicit($rule, $extension, $message = null);
36
+    public function extendImplicit( $rule, $extension, $message = null );
37 37
 
38 38
     /**
39 39
      * Register a custom implicit validator message replacer.
@@ -42,5 +42,5 @@  discard block
 block discarded – undo
42 42
      * @param  \Closure|string  $replacer
43 43
      * @return void
44 44
      */
45
-    public function replacer($rule, $replacer);
45
+    public function replacer( $rule, $replacer );
46 46
 }
Please login to merge, or discard this patch.
vendor/composer/ClassLoader.php 3 patches
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     /**
104 104
      * @param ?string $vendorDir
105 105
      */
106
-    public function __construct($vendorDir = null)
106
+    public function __construct( $vendorDir = null )
107 107
     {
108 108
         $this->vendorDir = $vendorDir;
109 109
     }
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
      */
114 114
     public function getPrefixes()
115 115
     {
116
-        if (!empty($this->prefixesPsr0)) {
117
-            return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
116
+        if ( ! empty( $this->prefixesPsr0 ) ) {
117
+            return call_user_func_array( 'array_merge', array_values( $this->prefixesPsr0 ) );
118 118
         }
119 119
 
120 120
         return array();
@@ -162,10 +162,10 @@  discard block
 block discarded – undo
162 162
      *
163 163
      * @return void
164 164
      */
165
-    public function addClassMap(array $classMap)
165
+    public function addClassMap( array $classMap )
166 166
     {
167
-        if ($this->classMap) {
168
-            $this->classMap = array_merge($this->classMap, $classMap);
167
+        if ( $this->classMap ) {
168
+            $this->classMap = array_merge( $this->classMap, $classMap );
169 169
         } else {
170 170
             $this->classMap = $classMap;
171 171
         }
@@ -181,39 +181,39 @@  discard block
 block discarded – undo
181 181
      *
182 182
      * @return void
183 183
      */
184
-    public function add($prefix, $paths, $prepend = false)
184
+    public function add( $prefix, $paths, $prepend = false )
185 185
     {
186
-        if (!$prefix) {
187
-            if ($prepend) {
186
+        if ( ! $prefix ) {
187
+            if ( $prepend ) {
188 188
                 $this->fallbackDirsPsr0 = array_merge(
189
-                    (array) $paths,
189
+                    (array)$paths,
190 190
                     $this->fallbackDirsPsr0
191 191
                 );
192 192
             } else {
193 193
                 $this->fallbackDirsPsr0 = array_merge(
194 194
                     $this->fallbackDirsPsr0,
195
-                    (array) $paths
195
+                    (array)$paths
196 196
                 );
197 197
             }
198 198
 
199 199
             return;
200 200
         }
201 201
 
202
-        $first = $prefix[0];
203
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
204
-            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
202
+        $first = $prefix[ 0 ];
203
+        if ( ! isset( $this->prefixesPsr0[ $first ][ $prefix ] ) ) {
204
+            $this->prefixesPsr0[ $first ][ $prefix ] = (array)$paths;
205 205
 
206 206
             return;
207 207
         }
208
-        if ($prepend) {
209
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
210
-                (array) $paths,
211
-                $this->prefixesPsr0[$first][$prefix]
208
+        if ( $prepend ) {
209
+            $this->prefixesPsr0[ $first ][ $prefix ] = array_merge(
210
+                (array)$paths,
211
+                $this->prefixesPsr0[ $first ][ $prefix ]
212 212
             );
213 213
         } else {
214
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
215
-                $this->prefixesPsr0[$first][$prefix],
216
-                (array) $paths
214
+            $this->prefixesPsr0[ $first ][ $prefix ] = array_merge(
215
+                $this->prefixesPsr0[ $first ][ $prefix ],
216
+                (array)$paths
217 217
             );
218 218
         }
219 219
     }
@@ -230,40 +230,40 @@  discard block
 block discarded – undo
230 230
      *
231 231
      * @return void
232 232
      */
233
-    public function addPsr4($prefix, $paths, $prepend = false)
233
+    public function addPsr4( $prefix, $paths, $prepend = false )
234 234
     {
235
-        if (!$prefix) {
235
+        if ( ! $prefix ) {
236 236
             // Register directories for the root namespace.
237
-            if ($prepend) {
237
+            if ( $prepend ) {
238 238
                 $this->fallbackDirsPsr4 = array_merge(
239
-                    (array) $paths,
239
+                    (array)$paths,
240 240
                     $this->fallbackDirsPsr4
241 241
                 );
242 242
             } else {
243 243
                 $this->fallbackDirsPsr4 = array_merge(
244 244
                     $this->fallbackDirsPsr4,
245
-                    (array) $paths
245
+                    (array)$paths
246 246
                 );
247 247
             }
248
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
248
+        } elseif ( ! isset( $this->prefixDirsPsr4[ $prefix ] ) ) {
249 249
             // Register directories for a new namespace.
250
-            $length = strlen($prefix);
251
-            if ('\\' !== $prefix[$length - 1]) {
252
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
250
+            $length = strlen( $prefix );
251
+            if ( '\\' !== $prefix[ $length - 1 ] ) {
252
+                throw new \InvalidArgumentException( "A non-empty PSR-4 prefix must end with a namespace separator." );
253 253
             }
254
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
255
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
256
-        } elseif ($prepend) {
254
+            $this->prefixLengthsPsr4[ $prefix[ 0 ] ][ $prefix ] = $length;
255
+            $this->prefixDirsPsr4[ $prefix ] = (array)$paths;
256
+        } elseif ( $prepend ) {
257 257
             // Prepend directories for an already registered namespace.
258
-            $this->prefixDirsPsr4[$prefix] = array_merge(
259
-                (array) $paths,
260
-                $this->prefixDirsPsr4[$prefix]
258
+            $this->prefixDirsPsr4[ $prefix ] = array_merge(
259
+                (array)$paths,
260
+                $this->prefixDirsPsr4[ $prefix ]
261 261
             );
262 262
         } else {
263 263
             // Append directories for an already registered namespace.
264
-            $this->prefixDirsPsr4[$prefix] = array_merge(
265
-                $this->prefixDirsPsr4[$prefix],
266
-                (array) $paths
264
+            $this->prefixDirsPsr4[ $prefix ] = array_merge(
265
+                $this->prefixDirsPsr4[ $prefix ],
266
+                (array)$paths
267 267
             );
268 268
         }
269 269
     }
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
      *
278 278
      * @return void
279 279
      */
280
-    public function set($prefix, $paths)
280
+    public function set( $prefix, $paths )
281 281
     {
282
-        if (!$prefix) {
283
-            $this->fallbackDirsPsr0 = (array) $paths;
282
+        if ( ! $prefix ) {
283
+            $this->fallbackDirsPsr0 = (array)$paths;
284 284
         } else {
285
-            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
285
+            $this->prefixesPsr0[ $prefix[ 0 ] ][ $prefix ] = (array)$paths;
286 286
         }
287 287
     }
288 288
 
@@ -297,17 +297,17 @@  discard block
 block discarded – undo
297 297
      *
298 298
      * @return void
299 299
      */
300
-    public function setPsr4($prefix, $paths)
300
+    public function setPsr4( $prefix, $paths )
301 301
     {
302
-        if (!$prefix) {
303
-            $this->fallbackDirsPsr4 = (array) $paths;
302
+        if ( ! $prefix ) {
303
+            $this->fallbackDirsPsr4 = (array)$paths;
304 304
         } else {
305
-            $length = strlen($prefix);
306
-            if ('\\' !== $prefix[$length - 1]) {
307
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
305
+            $length = strlen( $prefix );
306
+            if ( '\\' !== $prefix[ $length - 1 ] ) {
307
+                throw new \InvalidArgumentException( "A non-empty PSR-4 prefix must end with a namespace separator." );
308 308
             }
309
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
310
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
309
+            $this->prefixLengthsPsr4[ $prefix[ 0 ] ][ $prefix ] = $length;
310
+            $this->prefixDirsPsr4[ $prefix ] = (array)$paths;
311 311
         }
312 312
     }
313 313
 
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
      *
319 319
      * @return void
320 320
      */
321
-    public function setUseIncludePath($useIncludePath)
321
+    public function setUseIncludePath( $useIncludePath )
322 322
     {
323 323
         $this->useIncludePath = $useIncludePath;
324 324
     }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      *
343 343
      * @return void
344 344
      */
345
-    public function setClassMapAuthoritative($classMapAuthoritative)
345
+    public function setClassMapAuthoritative( $classMapAuthoritative )
346 346
     {
347 347
         $this->classMapAuthoritative = $classMapAuthoritative;
348 348
     }
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
      *
365 365
      * @return void
366 366
      */
367
-    public function setApcuPrefix($apcuPrefix)
367
+    public function setApcuPrefix( $apcuPrefix )
368 368
     {
369
-        $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
369
+        $this->apcuPrefix = function_exists( 'apcu_fetch' ) && filter_var( ini_get( 'apc.enabled' ), FILTER_VALIDATE_BOOLEAN ) ? $apcuPrefix : null;
370 370
     }
371 371
 
372 372
     /**
@@ -386,19 +386,19 @@  discard block
 block discarded – undo
386 386
      *
387 387
      * @return void
388 388
      */
389
-    public function register($prepend = false)
389
+    public function register( $prepend = false )
390 390
     {
391
-        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
391
+        spl_autoload_register( array( $this, 'loadClass' ), true, $prepend );
392 392
 
393
-        if (null === $this->vendorDir) {
393
+        if ( null === $this->vendorDir ) {
394 394
             return;
395 395
         }
396 396
 
397
-        if ($prepend) {
398
-            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
397
+        if ( $prepend ) {
398
+            self::$registeredLoaders = array( $this->vendorDir => $this ) + self::$registeredLoaders;
399 399
         } else {
400
-            unset(self::$registeredLoaders[$this->vendorDir]);
401
-            self::$registeredLoaders[$this->vendorDir] = $this;
400
+            unset( self::$registeredLoaders[ $this->vendorDir ] );
401
+            self::$registeredLoaders[ $this->vendorDir ] = $this;
402 402
         }
403 403
     }
404 404
 
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
      */
410 410
     public function unregister()
411 411
     {
412
-        spl_autoload_unregister(array($this, 'loadClass'));
412
+        spl_autoload_unregister( array( $this, 'loadClass' ) );
413 413
 
414
-        if (null !== $this->vendorDir) {
415
-            unset(self::$registeredLoaders[$this->vendorDir]);
414
+        if ( null !== $this->vendorDir ) {
415
+            unset( self::$registeredLoaders[ $this->vendorDir ] );
416 416
         }
417 417
     }
418 418
 
@@ -422,10 +422,10 @@  discard block
 block discarded – undo
422 422
      * @param  string    $class The name of the class
423 423
      * @return true|null True if loaded, null otherwise
424 424
      */
425
-    public function loadClass($class)
425
+    public function loadClass( $class )
426 426
     {
427
-        if ($file = $this->findFile($class)) {
428
-            includeFile($file);
427
+        if ( $file = $this->findFile( $class ) ) {
428
+            includeFile( $file );
429 429
 
430 430
             return true;
431 431
         }
@@ -440,36 +440,36 @@  discard block
 block discarded – undo
440 440
      *
441 441
      * @return string|false The path if found, false otherwise
442 442
      */
443
-    public function findFile($class)
443
+    public function findFile( $class )
444 444
     {
445 445
         // class map lookup
446
-        if (isset($this->classMap[$class])) {
447
-            return $this->classMap[$class];
446
+        if ( isset( $this->classMap[ $class ] ) ) {
447
+            return $this->classMap[ $class ];
448 448
         }
449
-        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
449
+        if ( $this->classMapAuthoritative || isset( $this->missingClasses[ $class ] ) ) {
450 450
             return false;
451 451
         }
452
-        if (null !== $this->apcuPrefix) {
453
-            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
454
-            if ($hit) {
452
+        if ( null !== $this->apcuPrefix ) {
453
+            $file = apcu_fetch( $this->apcuPrefix . $class, $hit );
454
+            if ( $hit ) {
455 455
                 return $file;
456 456
             }
457 457
         }
458 458
 
459
-        $file = $this->findFileWithExtension($class, '.php');
459
+        $file = $this->findFileWithExtension( $class, '.php' );
460 460
 
461 461
         // Search for Hack files if we are running on HHVM
462
-        if (false === $file && defined('HHVM_VERSION')) {
463
-            $file = $this->findFileWithExtension($class, '.hh');
462
+        if ( false === $file && defined( 'HHVM_VERSION' ) ) {
463
+            $file = $this->findFileWithExtension( $class, '.hh' );
464 464
         }
465 465
 
466
-        if (null !== $this->apcuPrefix) {
467
-            apcu_add($this->apcuPrefix.$class, $file);
466
+        if ( null !== $this->apcuPrefix ) {
467
+            apcu_add( $this->apcuPrefix . $class, $file );
468 468
         }
469 469
 
470
-        if (false === $file) {
470
+        if ( false === $file ) {
471 471
             // Remember that this class does not exist.
472
-            $this->missingClasses[$class] = true;
472
+            $this->missingClasses[ $class ] = true;
473 473
         }
474 474
 
475 475
         return $file;
@@ -490,21 +490,21 @@  discard block
 block discarded – undo
490 490
      * @param  string       $ext
491 491
      * @return string|false
492 492
      */
493
-    private function findFileWithExtension($class, $ext)
493
+    private function findFileWithExtension( $class, $ext )
494 494
     {
495 495
         // PSR-4 lookup
496
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
496
+        $logicalPathPsr4 = strtr( $class, '\\', DIRECTORY_SEPARATOR ) . $ext;
497 497
 
498
-        $first = $class[0];
499
-        if (isset($this->prefixLengthsPsr4[$first])) {
498
+        $first = $class[ 0 ];
499
+        if ( isset( $this->prefixLengthsPsr4[ $first ] ) ) {
500 500
             $subPath = $class;
501
-            while (false !== $lastPos = strrpos($subPath, '\\')) {
502
-                $subPath = substr($subPath, 0, $lastPos);
501
+            while ( false !== $lastPos = strrpos( $subPath, '\\' ) ) {
502
+                $subPath = substr( $subPath, 0, $lastPos );
503 503
                 $search = $subPath . '\\';
504
-                if (isset($this->prefixDirsPsr4[$search])) {
505
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
506
-                    foreach ($this->prefixDirsPsr4[$search] as $dir) {
507
-                        if (file_exists($file = $dir . $pathEnd)) {
504
+                if ( isset( $this->prefixDirsPsr4[ $search ] ) ) {
505
+                    $pathEnd = DIRECTORY_SEPARATOR . substr( $logicalPathPsr4, $lastPos + 1 );
506
+                    foreach ( $this->prefixDirsPsr4[ $search ] as $dir ) {
507
+                        if ( file_exists( $file = $dir . $pathEnd ) ) {
508 508
                             return $file;
509 509
                         }
510 510
                     }
@@ -513,27 +513,27 @@  discard block
 block discarded – undo
513 513
         }
514 514
 
515 515
         // PSR-4 fallback dirs
516
-        foreach ($this->fallbackDirsPsr4 as $dir) {
517
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
516
+        foreach ( $this->fallbackDirsPsr4 as $dir ) {
517
+            if ( file_exists( $file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4 ) ) {
518 518
                 return $file;
519 519
             }
520 520
         }
521 521
 
522 522
         // PSR-0 lookup
523
-        if (false !== $pos = strrpos($class, '\\')) {
523
+        if ( false !== $pos = strrpos( $class, '\\' ) ) {
524 524
             // namespaced class name
525
-            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
526
-                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
525
+            $logicalPathPsr0 = substr( $logicalPathPsr4, 0, $pos + 1 )
526
+                . strtr( substr( $logicalPathPsr4, $pos + 1 ), '_', DIRECTORY_SEPARATOR );
527 527
         } else {
528 528
             // PEAR-like class name
529
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
529
+            $logicalPathPsr0 = strtr( $class, '_', DIRECTORY_SEPARATOR ) . $ext;
530 530
         }
531 531
 
532
-        if (isset($this->prefixesPsr0[$first])) {
533
-            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
534
-                if (0 === strpos($class, $prefix)) {
535
-                    foreach ($dirs as $dir) {
536
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
532
+        if ( isset( $this->prefixesPsr0[ $first ] ) ) {
533
+            foreach ( $this->prefixesPsr0[ $first ] as $prefix => $dirs ) {
534
+                if ( 0 === strpos( $class, $prefix ) ) {
535
+                    foreach ( $dirs as $dir ) {
536
+                        if ( file_exists( $file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0 ) ) {
537 537
                             return $file;
538 538
                         }
539 539
                     }
@@ -542,14 +542,14 @@  discard block
 block discarded – undo
542 542
         }
543 543
 
544 544
         // PSR-0 fallback dirs
545
-        foreach ($this->fallbackDirsPsr0 as $dir) {
546
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
545
+        foreach ( $this->fallbackDirsPsr0 as $dir ) {
546
+            if ( file_exists( $file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0 ) ) {
547 547
                 return $file;
548 548
             }
549 549
         }
550 550
 
551 551
         // PSR-0 include paths.
552
-        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
552
+        if ( $this->useIncludePath && $file = stream_resolve_include_path( $logicalPathPsr0 ) ) {
553 553
             return $file;
554 554
         }
555 555
 
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
  * @return void
567 567
  * @private
568 568
  */
569
-function includeFile($file)
569
+function includeFile( $file )
570 570
 {
571 571
     include $file;
572 572
 }
Please login to merge, or discard this patch.
Indentation   +514 added lines, -514 removed lines patch added patch discarded remove patch
@@ -42,519 +42,519 @@  discard block
 block discarded – undo
42 42
  */
43 43
 class ClassLoader
44 44
 {
45
-    /** @var ?string */
46
-    private $vendorDir;
47
-
48
-    // PSR-4
49
-    /**
50
-     * @var array[]
51
-     * @psalm-var array<string, array<string, int>>
52
-     */
53
-    private $prefixLengthsPsr4 = array();
54
-    /**
55
-     * @var array[]
56
-     * @psalm-var array<string, array<int, string>>
57
-     */
58
-    private $prefixDirsPsr4 = array();
59
-    /**
60
-     * @var array[]
61
-     * @psalm-var array<string, string>
62
-     */
63
-    private $fallbackDirsPsr4 = array();
64
-
65
-    // PSR-0
66
-    /**
67
-     * @var array[]
68
-     * @psalm-var array<string, array<string, string[]>>
69
-     */
70
-    private $prefixesPsr0 = array();
71
-    /**
72
-     * @var array[]
73
-     * @psalm-var array<string, string>
74
-     */
75
-    private $fallbackDirsPsr0 = array();
76
-
77
-    /** @var bool */
78
-    private $useIncludePath = false;
79
-
80
-    /**
81
-     * @var string[]
82
-     * @psalm-var array<string, string>
83
-     */
84
-    private $classMap = array();
85
-
86
-    /** @var bool */
87
-    private $classMapAuthoritative = false;
88
-
89
-    /**
90
-     * @var bool[]
91
-     * @psalm-var array<string, bool>
92
-     */
93
-    private $missingClasses = array();
94
-
95
-    /** @var ?string */
96
-    private $apcuPrefix;
97
-
98
-    /**
99
-     * @var self[]
100
-     */
101
-    private static $registeredLoaders = array();
102
-
103
-    /**
104
-     * @param ?string $vendorDir
105
-     */
106
-    public function __construct($vendorDir = null)
107
-    {
108
-        $this->vendorDir = $vendorDir;
109
-    }
110
-
111
-    /**
112
-     * @return string[]
113
-     */
114
-    public function getPrefixes()
115
-    {
116
-        if (!empty($this->prefixesPsr0)) {
117
-            return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
118
-        }
119
-
120
-        return array();
121
-    }
122
-
123
-    /**
124
-     * @return array[]
125
-     * @psalm-return array<string, array<int, string>>
126
-     */
127
-    public function getPrefixesPsr4()
128
-    {
129
-        return $this->prefixDirsPsr4;
130
-    }
131
-
132
-    /**
133
-     * @return array[]
134
-     * @psalm-return array<string, string>
135
-     */
136
-    public function getFallbackDirs()
137
-    {
138
-        return $this->fallbackDirsPsr0;
139
-    }
140
-
141
-    /**
142
-     * @return array[]
143
-     * @psalm-return array<string, string>
144
-     */
145
-    public function getFallbackDirsPsr4()
146
-    {
147
-        return $this->fallbackDirsPsr4;
148
-    }
149
-
150
-    /**
151
-     * @return string[] Array of classname => path
152
-     * @psalm-return array<string, string>
153
-     */
154
-    public function getClassMap()
155
-    {
156
-        return $this->classMap;
157
-    }
158
-
159
-    /**
160
-     * @param string[] $classMap Class to filename map
161
-     * @psalm-param array<string, string> $classMap
162
-     *
163
-     * @return void
164
-     */
165
-    public function addClassMap(array $classMap)
166
-    {
167
-        if ($this->classMap) {
168
-            $this->classMap = array_merge($this->classMap, $classMap);
169
-        } else {
170
-            $this->classMap = $classMap;
171
-        }
172
-    }
173
-
174
-    /**
175
-     * Registers a set of PSR-0 directories for a given prefix, either
176
-     * appending or prepending to the ones previously set for this prefix.
177
-     *
178
-     * @param string          $prefix  The prefix
179
-     * @param string[]|string $paths   The PSR-0 root directories
180
-     * @param bool            $prepend Whether to prepend the directories
181
-     *
182
-     * @return void
183
-     */
184
-    public function add($prefix, $paths, $prepend = false)
185
-    {
186
-        if (!$prefix) {
187
-            if ($prepend) {
188
-                $this->fallbackDirsPsr0 = array_merge(
189
-                    (array) $paths,
190
-                    $this->fallbackDirsPsr0
191
-                );
192
-            } else {
193
-                $this->fallbackDirsPsr0 = array_merge(
194
-                    $this->fallbackDirsPsr0,
195
-                    (array) $paths
196
-                );
197
-            }
198
-
199
-            return;
200
-        }
201
-
202
-        $first = $prefix[0];
203
-        if (!isset($this->prefixesPsr0[$first][$prefix])) {
204
-            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
205
-
206
-            return;
207
-        }
208
-        if ($prepend) {
209
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
210
-                (array) $paths,
211
-                $this->prefixesPsr0[$first][$prefix]
212
-            );
213
-        } else {
214
-            $this->prefixesPsr0[$first][$prefix] = array_merge(
215
-                $this->prefixesPsr0[$first][$prefix],
216
-                (array) $paths
217
-            );
218
-        }
219
-    }
220
-
221
-    /**
222
-     * Registers a set of PSR-4 directories for a given namespace, either
223
-     * appending or prepending to the ones previously set for this namespace.
224
-     *
225
-     * @param string          $prefix  The prefix/namespace, with trailing '\\'
226
-     * @param string[]|string $paths   The PSR-4 base directories
227
-     * @param bool            $prepend Whether to prepend the directories
228
-     *
229
-     * @throws \InvalidArgumentException
230
-     *
231
-     * @return void
232
-     */
233
-    public function addPsr4($prefix, $paths, $prepend = false)
234
-    {
235
-        if (!$prefix) {
236
-            // Register directories for the root namespace.
237
-            if ($prepend) {
238
-                $this->fallbackDirsPsr4 = array_merge(
239
-                    (array) $paths,
240
-                    $this->fallbackDirsPsr4
241
-                );
242
-            } else {
243
-                $this->fallbackDirsPsr4 = array_merge(
244
-                    $this->fallbackDirsPsr4,
245
-                    (array) $paths
246
-                );
247
-            }
248
-        } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
249
-            // Register directories for a new namespace.
250
-            $length = strlen($prefix);
251
-            if ('\\' !== $prefix[$length - 1]) {
252
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
253
-            }
254
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
255
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
256
-        } elseif ($prepend) {
257
-            // Prepend directories for an already registered namespace.
258
-            $this->prefixDirsPsr4[$prefix] = array_merge(
259
-                (array) $paths,
260
-                $this->prefixDirsPsr4[$prefix]
261
-            );
262
-        } else {
263
-            // Append directories for an already registered namespace.
264
-            $this->prefixDirsPsr4[$prefix] = array_merge(
265
-                $this->prefixDirsPsr4[$prefix],
266
-                (array) $paths
267
-            );
268
-        }
269
-    }
270
-
271
-    /**
272
-     * Registers a set of PSR-0 directories for a given prefix,
273
-     * replacing any others previously set for this prefix.
274
-     *
275
-     * @param string          $prefix The prefix
276
-     * @param string[]|string $paths  The PSR-0 base directories
277
-     *
278
-     * @return void
279
-     */
280
-    public function set($prefix, $paths)
281
-    {
282
-        if (!$prefix) {
283
-            $this->fallbackDirsPsr0 = (array) $paths;
284
-        } else {
285
-            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
286
-        }
287
-    }
288
-
289
-    /**
290
-     * Registers a set of PSR-4 directories for a given namespace,
291
-     * replacing any others previously set for this namespace.
292
-     *
293
-     * @param string          $prefix The prefix/namespace, with trailing '\\'
294
-     * @param string[]|string $paths  The PSR-4 base directories
295
-     *
296
-     * @throws \InvalidArgumentException
297
-     *
298
-     * @return void
299
-     */
300
-    public function setPsr4($prefix, $paths)
301
-    {
302
-        if (!$prefix) {
303
-            $this->fallbackDirsPsr4 = (array) $paths;
304
-        } else {
305
-            $length = strlen($prefix);
306
-            if ('\\' !== $prefix[$length - 1]) {
307
-                throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
308
-            }
309
-            $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
310
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
311
-        }
312
-    }
313
-
314
-    /**
315
-     * Turns on searching the include path for class files.
316
-     *
317
-     * @param bool $useIncludePath
318
-     *
319
-     * @return void
320
-     */
321
-    public function setUseIncludePath($useIncludePath)
322
-    {
323
-        $this->useIncludePath = $useIncludePath;
324
-    }
325
-
326
-    /**
327
-     * Can be used to check if the autoloader uses the include path to check
328
-     * for classes.
329
-     *
330
-     * @return bool
331
-     */
332
-    public function getUseIncludePath()
333
-    {
334
-        return $this->useIncludePath;
335
-    }
336
-
337
-    /**
338
-     * Turns off searching the prefix and fallback directories for classes
339
-     * that have not been registered with the class map.
340
-     *
341
-     * @param bool $classMapAuthoritative
342
-     *
343
-     * @return void
344
-     */
345
-    public function setClassMapAuthoritative($classMapAuthoritative)
346
-    {
347
-        $this->classMapAuthoritative = $classMapAuthoritative;
348
-    }
349
-
350
-    /**
351
-     * Should class lookup fail if not found in the current class map?
352
-     *
353
-     * @return bool
354
-     */
355
-    public function isClassMapAuthoritative()
356
-    {
357
-        return $this->classMapAuthoritative;
358
-    }
359
-
360
-    /**
361
-     * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
362
-     *
363
-     * @param string|null $apcuPrefix
364
-     *
365
-     * @return void
366
-     */
367
-    public function setApcuPrefix($apcuPrefix)
368
-    {
369
-        $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
370
-    }
371
-
372
-    /**
373
-     * The APCu prefix in use, or null if APCu caching is not enabled.
374
-     *
375
-     * @return string|null
376
-     */
377
-    public function getApcuPrefix()
378
-    {
379
-        return $this->apcuPrefix;
380
-    }
381
-
382
-    /**
383
-     * Registers this instance as an autoloader.
384
-     *
385
-     * @param bool $prepend Whether to prepend the autoloader or not
386
-     *
387
-     * @return void
388
-     */
389
-    public function register($prepend = false)
390
-    {
391
-        spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392
-
393
-        if (null === $this->vendorDir) {
394
-            return;
395
-        }
396
-
397
-        if ($prepend) {
398
-            self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
399
-        } else {
400
-            unset(self::$registeredLoaders[$this->vendorDir]);
401
-            self::$registeredLoaders[$this->vendorDir] = $this;
402
-        }
403
-    }
404
-
405
-    /**
406
-     * Unregisters this instance as an autoloader.
407
-     *
408
-     * @return void
409
-     */
410
-    public function unregister()
411
-    {
412
-        spl_autoload_unregister(array($this, 'loadClass'));
413
-
414
-        if (null !== $this->vendorDir) {
415
-            unset(self::$registeredLoaders[$this->vendorDir]);
416
-        }
417
-    }
418
-
419
-    /**
420
-     * Loads the given class or interface.
421
-     *
422
-     * @param  string    $class The name of the class
423
-     * @return true|null True if loaded, null otherwise
424
-     */
425
-    public function loadClass($class)
426
-    {
427
-        if ($file = $this->findFile($class)) {
428
-            includeFile($file);
429
-
430
-            return true;
431
-        }
432
-
433
-        return null;
434
-    }
435
-
436
-    /**
437
-     * Finds the path to the file where the class is defined.
438
-     *
439
-     * @param string $class The name of the class
440
-     *
441
-     * @return string|false The path if found, false otherwise
442
-     */
443
-    public function findFile($class)
444
-    {
445
-        // class map lookup
446
-        if (isset($this->classMap[$class])) {
447
-            return $this->classMap[$class];
448
-        }
449
-        if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
450
-            return false;
451
-        }
452
-        if (null !== $this->apcuPrefix) {
453
-            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
454
-            if ($hit) {
455
-                return $file;
456
-            }
457
-        }
458
-
459
-        $file = $this->findFileWithExtension($class, '.php');
460
-
461
-        // Search for Hack files if we are running on HHVM
462
-        if (false === $file && defined('HHVM_VERSION')) {
463
-            $file = $this->findFileWithExtension($class, '.hh');
464
-        }
465
-
466
-        if (null !== $this->apcuPrefix) {
467
-            apcu_add($this->apcuPrefix.$class, $file);
468
-        }
469
-
470
-        if (false === $file) {
471
-            // Remember that this class does not exist.
472
-            $this->missingClasses[$class] = true;
473
-        }
474
-
475
-        return $file;
476
-    }
477
-
478
-    /**
479
-     * Returns the currently registered loaders indexed by their corresponding vendor directories.
480
-     *
481
-     * @return self[]
482
-     */
483
-    public static function getRegisteredLoaders()
484
-    {
485
-        return self::$registeredLoaders;
486
-    }
487
-
488
-    /**
489
-     * @param  string       $class
490
-     * @param  string       $ext
491
-     * @return string|false
492
-     */
493
-    private function findFileWithExtension($class, $ext)
494
-    {
495
-        // PSR-4 lookup
496
-        $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
497
-
498
-        $first = $class[0];
499
-        if (isset($this->prefixLengthsPsr4[$first])) {
500
-            $subPath = $class;
501
-            while (false !== $lastPos = strrpos($subPath, '\\')) {
502
-                $subPath = substr($subPath, 0, $lastPos);
503
-                $search = $subPath . '\\';
504
-                if (isset($this->prefixDirsPsr4[$search])) {
505
-                    $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
506
-                    foreach ($this->prefixDirsPsr4[$search] as $dir) {
507
-                        if (file_exists($file = $dir . $pathEnd)) {
508
-                            return $file;
509
-                        }
510
-                    }
511
-                }
512
-            }
513
-        }
514
-
515
-        // PSR-4 fallback dirs
516
-        foreach ($this->fallbackDirsPsr4 as $dir) {
517
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
518
-                return $file;
519
-            }
520
-        }
521
-
522
-        // PSR-0 lookup
523
-        if (false !== $pos = strrpos($class, '\\')) {
524
-            // namespaced class name
525
-            $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
526
-                . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
527
-        } else {
528
-            // PEAR-like class name
529
-            $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
530
-        }
531
-
532
-        if (isset($this->prefixesPsr0[$first])) {
533
-            foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
534
-                if (0 === strpos($class, $prefix)) {
535
-                    foreach ($dirs as $dir) {
536
-                        if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
537
-                            return $file;
538
-                        }
539
-                    }
540
-                }
541
-            }
542
-        }
543
-
544
-        // PSR-0 fallback dirs
545
-        foreach ($this->fallbackDirsPsr0 as $dir) {
546
-            if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
547
-                return $file;
548
-            }
549
-        }
550
-
551
-        // PSR-0 include paths.
552
-        if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
553
-            return $file;
554
-        }
555
-
556
-        return false;
557
-    }
45
+	/** @var ?string */
46
+	private $vendorDir;
47
+
48
+	// PSR-4
49
+	/**
50
+	 * @var array[]
51
+	 * @psalm-var array<string, array<string, int>>
52
+	 */
53
+	private $prefixLengthsPsr4 = array();
54
+	/**
55
+	 * @var array[]
56
+	 * @psalm-var array<string, array<int, string>>
57
+	 */
58
+	private $prefixDirsPsr4 = array();
59
+	/**
60
+	 * @var array[]
61
+	 * @psalm-var array<string, string>
62
+	 */
63
+	private $fallbackDirsPsr4 = array();
64
+
65
+	// PSR-0
66
+	/**
67
+	 * @var array[]
68
+	 * @psalm-var array<string, array<string, string[]>>
69
+	 */
70
+	private $prefixesPsr0 = array();
71
+	/**
72
+	 * @var array[]
73
+	 * @psalm-var array<string, string>
74
+	 */
75
+	private $fallbackDirsPsr0 = array();
76
+
77
+	/** @var bool */
78
+	private $useIncludePath = false;
79
+
80
+	/**
81
+	 * @var string[]
82
+	 * @psalm-var array<string, string>
83
+	 */
84
+	private $classMap = array();
85
+
86
+	/** @var bool */
87
+	private $classMapAuthoritative = false;
88
+
89
+	/**
90
+	 * @var bool[]
91
+	 * @psalm-var array<string, bool>
92
+	 */
93
+	private $missingClasses = array();
94
+
95
+	/** @var ?string */
96
+	private $apcuPrefix;
97
+
98
+	/**
99
+	 * @var self[]
100
+	 */
101
+	private static $registeredLoaders = array();
102
+
103
+	/**
104
+	 * @param ?string $vendorDir
105
+	 */
106
+	public function __construct($vendorDir = null)
107
+	{
108
+		$this->vendorDir = $vendorDir;
109
+	}
110
+
111
+	/**
112
+	 * @return string[]
113
+	 */
114
+	public function getPrefixes()
115
+	{
116
+		if (!empty($this->prefixesPsr0)) {
117
+			return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
118
+		}
119
+
120
+		return array();
121
+	}
122
+
123
+	/**
124
+	 * @return array[]
125
+	 * @psalm-return array<string, array<int, string>>
126
+	 */
127
+	public function getPrefixesPsr4()
128
+	{
129
+		return $this->prefixDirsPsr4;
130
+	}
131
+
132
+	/**
133
+	 * @return array[]
134
+	 * @psalm-return array<string, string>
135
+	 */
136
+	public function getFallbackDirs()
137
+	{
138
+		return $this->fallbackDirsPsr0;
139
+	}
140
+
141
+	/**
142
+	 * @return array[]
143
+	 * @psalm-return array<string, string>
144
+	 */
145
+	public function getFallbackDirsPsr4()
146
+	{
147
+		return $this->fallbackDirsPsr4;
148
+	}
149
+
150
+	/**
151
+	 * @return string[] Array of classname => path
152
+	 * @psalm-return array<string, string>
153
+	 */
154
+	public function getClassMap()
155
+	{
156
+		return $this->classMap;
157
+	}
158
+
159
+	/**
160
+	 * @param string[] $classMap Class to filename map
161
+	 * @psalm-param array<string, string> $classMap
162
+	 *
163
+	 * @return void
164
+	 */
165
+	public function addClassMap(array $classMap)
166
+	{
167
+		if ($this->classMap) {
168
+			$this->classMap = array_merge($this->classMap, $classMap);
169
+		} else {
170
+			$this->classMap = $classMap;
171
+		}
172
+	}
173
+
174
+	/**
175
+	 * Registers a set of PSR-0 directories for a given prefix, either
176
+	 * appending or prepending to the ones previously set for this prefix.
177
+	 *
178
+	 * @param string          $prefix  The prefix
179
+	 * @param string[]|string $paths   The PSR-0 root directories
180
+	 * @param bool            $prepend Whether to prepend the directories
181
+	 *
182
+	 * @return void
183
+	 */
184
+	public function add($prefix, $paths, $prepend = false)
185
+	{
186
+		if (!$prefix) {
187
+			if ($prepend) {
188
+				$this->fallbackDirsPsr0 = array_merge(
189
+					(array) $paths,
190
+					$this->fallbackDirsPsr0
191
+				);
192
+			} else {
193
+				$this->fallbackDirsPsr0 = array_merge(
194
+					$this->fallbackDirsPsr0,
195
+					(array) $paths
196
+				);
197
+			}
198
+
199
+			return;
200
+		}
201
+
202
+		$first = $prefix[0];
203
+		if (!isset($this->prefixesPsr0[$first][$prefix])) {
204
+			$this->prefixesPsr0[$first][$prefix] = (array) $paths;
205
+
206
+			return;
207
+		}
208
+		if ($prepend) {
209
+			$this->prefixesPsr0[$first][$prefix] = array_merge(
210
+				(array) $paths,
211
+				$this->prefixesPsr0[$first][$prefix]
212
+			);
213
+		} else {
214
+			$this->prefixesPsr0[$first][$prefix] = array_merge(
215
+				$this->prefixesPsr0[$first][$prefix],
216
+				(array) $paths
217
+			);
218
+		}
219
+	}
220
+
221
+	/**
222
+	 * Registers a set of PSR-4 directories for a given namespace, either
223
+	 * appending or prepending to the ones previously set for this namespace.
224
+	 *
225
+	 * @param string          $prefix  The prefix/namespace, with trailing '\\'
226
+	 * @param string[]|string $paths   The PSR-4 base directories
227
+	 * @param bool            $prepend Whether to prepend the directories
228
+	 *
229
+	 * @throws \InvalidArgumentException
230
+	 *
231
+	 * @return void
232
+	 */
233
+	public function addPsr4($prefix, $paths, $prepend = false)
234
+	{
235
+		if (!$prefix) {
236
+			// Register directories for the root namespace.
237
+			if ($prepend) {
238
+				$this->fallbackDirsPsr4 = array_merge(
239
+					(array) $paths,
240
+					$this->fallbackDirsPsr4
241
+				);
242
+			} else {
243
+				$this->fallbackDirsPsr4 = array_merge(
244
+					$this->fallbackDirsPsr4,
245
+					(array) $paths
246
+				);
247
+			}
248
+		} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
249
+			// Register directories for a new namespace.
250
+			$length = strlen($prefix);
251
+			if ('\\' !== $prefix[$length - 1]) {
252
+				throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
253
+			}
254
+			$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
255
+			$this->prefixDirsPsr4[$prefix] = (array) $paths;
256
+		} elseif ($prepend) {
257
+			// Prepend directories for an already registered namespace.
258
+			$this->prefixDirsPsr4[$prefix] = array_merge(
259
+				(array) $paths,
260
+				$this->prefixDirsPsr4[$prefix]
261
+			);
262
+		} else {
263
+			// Append directories for an already registered namespace.
264
+			$this->prefixDirsPsr4[$prefix] = array_merge(
265
+				$this->prefixDirsPsr4[$prefix],
266
+				(array) $paths
267
+			);
268
+		}
269
+	}
270
+
271
+	/**
272
+	 * Registers a set of PSR-0 directories for a given prefix,
273
+	 * replacing any others previously set for this prefix.
274
+	 *
275
+	 * @param string          $prefix The prefix
276
+	 * @param string[]|string $paths  The PSR-0 base directories
277
+	 *
278
+	 * @return void
279
+	 */
280
+	public function set($prefix, $paths)
281
+	{
282
+		if (!$prefix) {
283
+			$this->fallbackDirsPsr0 = (array) $paths;
284
+		} else {
285
+			$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
286
+		}
287
+	}
288
+
289
+	/**
290
+	 * Registers a set of PSR-4 directories for a given namespace,
291
+	 * replacing any others previously set for this namespace.
292
+	 *
293
+	 * @param string          $prefix The prefix/namespace, with trailing '\\'
294
+	 * @param string[]|string $paths  The PSR-4 base directories
295
+	 *
296
+	 * @throws \InvalidArgumentException
297
+	 *
298
+	 * @return void
299
+	 */
300
+	public function setPsr4($prefix, $paths)
301
+	{
302
+		if (!$prefix) {
303
+			$this->fallbackDirsPsr4 = (array) $paths;
304
+		} else {
305
+			$length = strlen($prefix);
306
+			if ('\\' !== $prefix[$length - 1]) {
307
+				throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
308
+			}
309
+			$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
310
+			$this->prefixDirsPsr4[$prefix] = (array) $paths;
311
+		}
312
+	}
313
+
314
+	/**
315
+	 * Turns on searching the include path for class files.
316
+	 *
317
+	 * @param bool $useIncludePath
318
+	 *
319
+	 * @return void
320
+	 */
321
+	public function setUseIncludePath($useIncludePath)
322
+	{
323
+		$this->useIncludePath = $useIncludePath;
324
+	}
325
+
326
+	/**
327
+	 * Can be used to check if the autoloader uses the include path to check
328
+	 * for classes.
329
+	 *
330
+	 * @return bool
331
+	 */
332
+	public function getUseIncludePath()
333
+	{
334
+		return $this->useIncludePath;
335
+	}
336
+
337
+	/**
338
+	 * Turns off searching the prefix and fallback directories for classes
339
+	 * that have not been registered with the class map.
340
+	 *
341
+	 * @param bool $classMapAuthoritative
342
+	 *
343
+	 * @return void
344
+	 */
345
+	public function setClassMapAuthoritative($classMapAuthoritative)
346
+	{
347
+		$this->classMapAuthoritative = $classMapAuthoritative;
348
+	}
349
+
350
+	/**
351
+	 * Should class lookup fail if not found in the current class map?
352
+	 *
353
+	 * @return bool
354
+	 */
355
+	public function isClassMapAuthoritative()
356
+	{
357
+		return $this->classMapAuthoritative;
358
+	}
359
+
360
+	/**
361
+	 * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
362
+	 *
363
+	 * @param string|null $apcuPrefix
364
+	 *
365
+	 * @return void
366
+	 */
367
+	public function setApcuPrefix($apcuPrefix)
368
+	{
369
+		$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
370
+	}
371
+
372
+	/**
373
+	 * The APCu prefix in use, or null if APCu caching is not enabled.
374
+	 *
375
+	 * @return string|null
376
+	 */
377
+	public function getApcuPrefix()
378
+	{
379
+		return $this->apcuPrefix;
380
+	}
381
+
382
+	/**
383
+	 * Registers this instance as an autoloader.
384
+	 *
385
+	 * @param bool $prepend Whether to prepend the autoloader or not
386
+	 *
387
+	 * @return void
388
+	 */
389
+	public function register($prepend = false)
390
+	{
391
+		spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392
+
393
+		if (null === $this->vendorDir) {
394
+			return;
395
+		}
396
+
397
+		if ($prepend) {
398
+			self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
399
+		} else {
400
+			unset(self::$registeredLoaders[$this->vendorDir]);
401
+			self::$registeredLoaders[$this->vendorDir] = $this;
402
+		}
403
+	}
404
+
405
+	/**
406
+	 * Unregisters this instance as an autoloader.
407
+	 *
408
+	 * @return void
409
+	 */
410
+	public function unregister()
411
+	{
412
+		spl_autoload_unregister(array($this, 'loadClass'));
413
+
414
+		if (null !== $this->vendorDir) {
415
+			unset(self::$registeredLoaders[$this->vendorDir]);
416
+		}
417
+	}
418
+
419
+	/**
420
+	 * Loads the given class or interface.
421
+	 *
422
+	 * @param  string    $class The name of the class
423
+	 * @return true|null True if loaded, null otherwise
424
+	 */
425
+	public function loadClass($class)
426
+	{
427
+		if ($file = $this->findFile($class)) {
428
+			includeFile($file);
429
+
430
+			return true;
431
+		}
432
+
433
+		return null;
434
+	}
435
+
436
+	/**
437
+	 * Finds the path to the file where the class is defined.
438
+	 *
439
+	 * @param string $class The name of the class
440
+	 *
441
+	 * @return string|false The path if found, false otherwise
442
+	 */
443
+	public function findFile($class)
444
+	{
445
+		// class map lookup
446
+		if (isset($this->classMap[$class])) {
447
+			return $this->classMap[$class];
448
+		}
449
+		if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
450
+			return false;
451
+		}
452
+		if (null !== $this->apcuPrefix) {
453
+			$file = apcu_fetch($this->apcuPrefix.$class, $hit);
454
+			if ($hit) {
455
+				return $file;
456
+			}
457
+		}
458
+
459
+		$file = $this->findFileWithExtension($class, '.php');
460
+
461
+		// Search for Hack files if we are running on HHVM
462
+		if (false === $file && defined('HHVM_VERSION')) {
463
+			$file = $this->findFileWithExtension($class, '.hh');
464
+		}
465
+
466
+		if (null !== $this->apcuPrefix) {
467
+			apcu_add($this->apcuPrefix.$class, $file);
468
+		}
469
+
470
+		if (false === $file) {
471
+			// Remember that this class does not exist.
472
+			$this->missingClasses[$class] = true;
473
+		}
474
+
475
+		return $file;
476
+	}
477
+
478
+	/**
479
+	 * Returns the currently registered loaders indexed by their corresponding vendor directories.
480
+	 *
481
+	 * @return self[]
482
+	 */
483
+	public static function getRegisteredLoaders()
484
+	{
485
+		return self::$registeredLoaders;
486
+	}
487
+
488
+	/**
489
+	 * @param  string       $class
490
+	 * @param  string       $ext
491
+	 * @return string|false
492
+	 */
493
+	private function findFileWithExtension($class, $ext)
494
+	{
495
+		// PSR-4 lookup
496
+		$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
497
+
498
+		$first = $class[0];
499
+		if (isset($this->prefixLengthsPsr4[$first])) {
500
+			$subPath = $class;
501
+			while (false !== $lastPos = strrpos($subPath, '\\')) {
502
+				$subPath = substr($subPath, 0, $lastPos);
503
+				$search = $subPath . '\\';
504
+				if (isset($this->prefixDirsPsr4[$search])) {
505
+					$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
506
+					foreach ($this->prefixDirsPsr4[$search] as $dir) {
507
+						if (file_exists($file = $dir . $pathEnd)) {
508
+							return $file;
509
+						}
510
+					}
511
+				}
512
+			}
513
+		}
514
+
515
+		// PSR-4 fallback dirs
516
+		foreach ($this->fallbackDirsPsr4 as $dir) {
517
+			if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
518
+				return $file;
519
+			}
520
+		}
521
+
522
+		// PSR-0 lookup
523
+		if (false !== $pos = strrpos($class, '\\')) {
524
+			// namespaced class name
525
+			$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
526
+				. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
527
+		} else {
528
+			// PEAR-like class name
529
+			$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
530
+		}
531
+
532
+		if (isset($this->prefixesPsr0[$first])) {
533
+			foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
534
+				if (0 === strpos($class, $prefix)) {
535
+					foreach ($dirs as $dir) {
536
+						if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
537
+							return $file;
538
+						}
539
+					}
540
+				}
541
+			}
542
+		}
543
+
544
+		// PSR-0 fallback dirs
545
+		foreach ($this->fallbackDirsPsr0 as $dir) {
546
+			if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
547
+				return $file;
548
+			}
549
+		}
550
+
551
+		// PSR-0 include paths.
552
+		if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
553
+			return $file;
554
+		}
555
+
556
+		return false;
557
+	}
558 558
 }
559 559
 
560 560
 /**
@@ -568,5 +568,5 @@  discard block
 block discarded – undo
568 568
  */
569 569
 function includeFile($file)
570 570
 {
571
-    include $file;
571
+	include $file;
572 572
 }
Please login to merge, or discard this patch.
Braces   +25 added lines, -50 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@  discard block
 block discarded – undo
40 40
  * @see    https://www.php-fig.org/psr/psr-0/
41 41
  * @see    https://www.php-fig.org/psr/psr-4/
42 42
  */
43
-class ClassLoader
44
-{
43
+class ClassLoader {
45 44
     /** @var ?string */
46 45
     private $vendorDir;
47 46
 
@@ -103,16 +102,14 @@  discard block
 block discarded – undo
103 102
     /**
104 103
      * @param ?string $vendorDir
105 104
      */
106
-    public function __construct($vendorDir = null)
107
-    {
105
+    public function __construct($vendorDir = null) {
108 106
         $this->vendorDir = $vendorDir;
109 107
     }
110 108
 
111 109
     /**
112 110
      * @return string[]
113 111
      */
114
-    public function getPrefixes()
115
-    {
112
+    public function getPrefixes() {
116 113
         if (!empty($this->prefixesPsr0)) {
117 114
             return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
118 115
         }
@@ -124,8 +121,7 @@  discard block
 block discarded – undo
124 121
      * @return array[]
125 122
      * @psalm-return array<string, array<int, string>>
126 123
      */
127
-    public function getPrefixesPsr4()
128
-    {
124
+    public function getPrefixesPsr4() {
129 125
         return $this->prefixDirsPsr4;
130 126
     }
131 127
 
@@ -133,8 +129,7 @@  discard block
 block discarded – undo
133 129
      * @return array[]
134 130
      * @psalm-return array<string, string>
135 131
      */
136
-    public function getFallbackDirs()
137
-    {
132
+    public function getFallbackDirs() {
138 133
         return $this->fallbackDirsPsr0;
139 134
     }
140 135
 
@@ -142,8 +137,7 @@  discard block
 block discarded – undo
142 137
      * @return array[]
143 138
      * @psalm-return array<string, string>
144 139
      */
145
-    public function getFallbackDirsPsr4()
146
-    {
140
+    public function getFallbackDirsPsr4() {
147 141
         return $this->fallbackDirsPsr4;
148 142
     }
149 143
 
@@ -151,8 +145,7 @@  discard block
 block discarded – undo
151 145
      * @return string[] Array of classname => path
152 146
      * @psalm-return array<string, string>
153 147
      */
154
-    public function getClassMap()
155
-    {
148
+    public function getClassMap() {
156 149
         return $this->classMap;
157 150
     }
158 151
 
@@ -162,8 +155,7 @@  discard block
 block discarded – undo
162 155
      *
163 156
      * @return void
164 157
      */
165
-    public function addClassMap(array $classMap)
166
-    {
158
+    public function addClassMap(array $classMap) {
167 159
         if ($this->classMap) {
168 160
             $this->classMap = array_merge($this->classMap, $classMap);
169 161
         } else {
@@ -181,8 +173,7 @@  discard block
 block discarded – undo
181 173
      *
182 174
      * @return void
183 175
      */
184
-    public function add($prefix, $paths, $prepend = false)
185
-    {
176
+    public function add($prefix, $paths, $prepend = false) {
186 177
         if (!$prefix) {
187 178
             if ($prepend) {
188 179
                 $this->fallbackDirsPsr0 = array_merge(
@@ -230,8 +221,7 @@  discard block
 block discarded – undo
230 221
      *
231 222
      * @return void
232 223
      */
233
-    public function addPsr4($prefix, $paths, $prepend = false)
234
-    {
224
+    public function addPsr4($prefix, $paths, $prepend = false) {
235 225
         if (!$prefix) {
236 226
             // Register directories for the root namespace.
237 227
             if ($prepend) {
@@ -277,8 +267,7 @@  discard block
 block discarded – undo
277 267
      *
278 268
      * @return void
279 269
      */
280
-    public function set($prefix, $paths)
281
-    {
270
+    public function set($prefix, $paths) {
282 271
         if (!$prefix) {
283 272
             $this->fallbackDirsPsr0 = (array) $paths;
284 273
         } else {
@@ -297,8 +286,7 @@  discard block
 block discarded – undo
297 286
      *
298 287
      * @return void
299 288
      */
300
-    public function setPsr4($prefix, $paths)
301
-    {
289
+    public function setPsr4($prefix, $paths) {
302 290
         if (!$prefix) {
303 291
             $this->fallbackDirsPsr4 = (array) $paths;
304 292
         } else {
@@ -318,8 +306,7 @@  discard block
 block discarded – undo
318 306
      *
319 307
      * @return void
320 308
      */
321
-    public function setUseIncludePath($useIncludePath)
322
-    {
309
+    public function setUseIncludePath($useIncludePath) {
323 310
         $this->useIncludePath = $useIncludePath;
324 311
     }
325 312
 
@@ -329,8 +316,7 @@  discard block
 block discarded – undo
329 316
      *
330 317
      * @return bool
331 318
      */
332
-    public function getUseIncludePath()
333
-    {
319
+    public function getUseIncludePath() {
334 320
         return $this->useIncludePath;
335 321
     }
336 322
 
@@ -342,8 +328,7 @@  discard block
 block discarded – undo
342 328
      *
343 329
      * @return void
344 330
      */
345
-    public function setClassMapAuthoritative($classMapAuthoritative)
346
-    {
331
+    public function setClassMapAuthoritative($classMapAuthoritative) {
347 332
         $this->classMapAuthoritative = $classMapAuthoritative;
348 333
     }
349 334
 
@@ -352,8 +337,7 @@  discard block
 block discarded – undo
352 337
      *
353 338
      * @return bool
354 339
      */
355
-    public function isClassMapAuthoritative()
356
-    {
340
+    public function isClassMapAuthoritative() {
357 341
         return $this->classMapAuthoritative;
358 342
     }
359 343
 
@@ -364,8 +348,7 @@  discard block
 block discarded – undo
364 348
      *
365 349
      * @return void
366 350
      */
367
-    public function setApcuPrefix($apcuPrefix)
368
-    {
351
+    public function setApcuPrefix($apcuPrefix) {
369 352
         $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
370 353
     }
371 354
 
@@ -374,8 +357,7 @@  discard block
 block discarded – undo
374 357
      *
375 358
      * @return string|null
376 359
      */
377
-    public function getApcuPrefix()
378
-    {
360
+    public function getApcuPrefix() {
379 361
         return $this->apcuPrefix;
380 362
     }
381 363
 
@@ -386,8 +368,7 @@  discard block
 block discarded – undo
386 368
      *
387 369
      * @return void
388 370
      */
389
-    public function register($prepend = false)
390
-    {
371
+    public function register($prepend = false) {
391 372
         spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392 373
 
393 374
         if (null === $this->vendorDir) {
@@ -407,8 +388,7 @@  discard block
 block discarded – undo
407 388
      *
408 389
      * @return void
409 390
      */
410
-    public function unregister()
411
-    {
391
+    public function unregister() {
412 392
         spl_autoload_unregister(array($this, 'loadClass'));
413 393
 
414 394
         if (null !== $this->vendorDir) {
@@ -422,8 +402,7 @@  discard block
 block discarded – undo
422 402
      * @param  string    $class The name of the class
423 403
      * @return true|null True if loaded, null otherwise
424 404
      */
425
-    public function loadClass($class)
426
-    {
405
+    public function loadClass($class) {
427 406
         if ($file = $this->findFile($class)) {
428 407
             includeFile($file);
429 408
 
@@ -440,8 +419,7 @@  discard block
 block discarded – undo
440 419
      *
441 420
      * @return string|false The path if found, false otherwise
442 421
      */
443
-    public function findFile($class)
444
-    {
422
+    public function findFile($class) {
445 423
         // class map lookup
446 424
         if (isset($this->classMap[$class])) {
447 425
             return $this->classMap[$class];
@@ -480,8 +458,7 @@  discard block
 block discarded – undo
480 458
      *
481 459
      * @return self[]
482 460
      */
483
-    public static function getRegisteredLoaders()
484
-    {
461
+    public static function getRegisteredLoaders() {
485 462
         return self::$registeredLoaders;
486 463
     }
487 464
 
@@ -490,8 +467,7 @@  discard block
 block discarded – undo
490 467
      * @param  string       $ext
491 468
      * @return string|false
492 469
      */
493
-    private function findFileWithExtension($class, $ext)
494
-    {
470
+    private function findFileWithExtension($class, $ext) {
495 471
         // PSR-4 lookup
496 472
         $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
497 473
 
@@ -566,7 +542,6 @@  discard block
 block discarded – undo
566 542
  * @return void
567 543
  * @private
568 544
  */
569
-function includeFile($file)
570
-{
545
+function includeFile($file) {
571 546
     include $file;
572 547
 }
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-total.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @return array Blocklist, with "total" added. If not edit context, original field blocklist. Otherwise, blocklist including total.
54 54
 	 */
55
-	public function add_to_blocklist( $blocklist = array(), $context = NULL  ){
55
+	public function add_to_blocklist( $blocklist = array(), $context = NULL ) {
56 56
 
57
-		if( empty( $context ) || $context !== 'edit' ) {
57
+		if ( empty( $context ) || $context !== 'edit' ) {
58 58
 			return $blocklist;
59 59
 		}
60 60
 
61
-		$blocklist[] = 'total';
61
+		$blocklist[ ] = 'total';
62 62
 
63 63
 		return $blocklist;
64 64
 	}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	function edit_entry_recalculate_totals( $form = array(), $entry_id = 0, $Edit_Entry_Render = null ) {
78 78
 
79
-		$original_form = GFAPI::get_form( $form['id'] );
79
+		$original_form = GFAPI::get_form( $form[ 'id' ] );
80 80
 
81 81
 		$total_fields = GFCommon::get_fields_by_type( $original_form, 'total' );
82 82
 
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
 
88 88
 			/** @type GF_Field_Total $total_field */
89 89
 			foreach ( $total_fields as $total_field ) {
90
-				$entry["{$total_field->id}"] = GFCommon::get_order_total( $original_form, $entry );
90
+				$entry[ "{$total_field->id}" ] = GFCommon::get_order_total( $original_form, $entry );
91 91
 			}
92 92
 
93 93
 			$return_entry = GFAPI::update_entry( $entry );
94 94
 
95
-			if( is_wp_error( $return_entry ) ) {
95
+			if ( is_wp_error( $return_entry ) ) {
96 96
 				gravityview()->log->error( 'Updating the entry total fields failed', array( 'data' => $return_entry ) );
97 97
 			} else {
98 98
 				gravityview()->log->debug( 'Updating the entry total fields succeeded' );
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 *
53 53
 	 * @return array Blocklist, with "total" added. If not edit context, original field blocklist. Otherwise, blocklist including total.
54 54
 	 */
55
-	public function add_to_blocklist( $blocklist = array(), $context = NULL  ){
55
+	public function add_to_blocklist( $blocklist = array(), $context = NULL  ) {
56 56
 
57 57
 		if( empty( $context ) || $context !== 'edit' ) {
58 58
 			return $blocklist;
Please login to merge, or discard this patch.
includes/fields/class-gravityview-field-calculation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -49,8 +49,8 @@
 block discarded – undo
49 49
 	public function blocklist_field_types( $field_types = array(), $context = '' ) {
50 50
 
51 51
 		// Allow Calculation field in Edit Entry
52
-		if( 'edit' !== $context ) {
53
-			$field_types[] = $this->name;
52
+		if ( 'edit' !== $context ) {
53
+			$field_types[ ] = $this->name;
54 54
 		}
55 55
 
56 56
 		return $field_types;
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-coupon.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		 */
54 54
 		$hide_coupon_fields = apply_filters( 'gravityview/edit_entry/hide-coupon-fields', $has_transaction_data );
55 55
 
56
-		return (bool) $hide_coupon_fields;
56
+		return (bool)$hide_coupon_fields;
57 57
 	}
58 58
 
59 59
 	/**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	public function edit_entry_field_blocklist( $blocklist = array(), $entry = array() ) {
79 79
 
80 80
 		if ( $this->should_hide_coupon_fields( $entry ) ) {
81
-			$blocklist[] = 'coupon';
81
+			$blocklist[ ] = 'coupon';
82 82
 		}
83 83
 
84 84
 		return $blocklist;
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 		// No coupons match the codes provided
117 117
 		$discounts = gf_coupons()->get_coupons_by_codes( $coupon_codes, $form );
118 118
 
119
-		if( ! $discounts ) {
119
+		if ( ! $discounts ) {
120 120
 			return $value;
121 121
 		}
122 122
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 		 * @see GF_Field_Coupon::get_field_input
126 126
 		 */
127 127
 		$_POST = ! isset( $_POST ) ? array() : $_POST;
128
-		$_POST[ 'gf_coupons_' . $form['id'] ] = json_encode( (array) $discounts );
128
+		$_POST[ 'gf_coupons_' . $form[ 'id' ] ] = json_encode( (array)$discounts );
129 129
 		$_POST[ 'input_' . $field->id ] = implode( ',', $coupon_codes );
130 130
 
131 131
 		return $value;
Please login to merge, or discard this patch.
plugin-and-theme-hooks/class-gravityview-plugin-hooks-elegant-themes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,11 +79,11 @@  discard block
 block discarded – undo
79 79
 		}
80 80
 
81 81
 		$sidebars_widgets = wp_get_sidebars_widgets();
82
-		if ( empty( $sidebars_widgets[ $matches[1] ] ) ) {
82
+		if ( empty( $sidebars_widgets[ $matches[ 1 ] ] ) ) {
83 83
 			return $shortcodes;
84 84
 		}
85 85
 
86
-		foreach ( $sidebars_widgets[ $matches[1] ] as $widgets ) {
86
+		foreach ( $sidebars_widgets[ $matches[ 1 ] ] as $widgets ) {
87 87
 			if (
88 88
 				/**
89 89
 				 * Blocklisted widgets.
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 				strpos( $widgets, 'gv_recent_entries' ) === 0
93 93
 			) {
94 94
 
95
-					$shortcodes []= 'et_pb_sidebar';
95
+					$shortcodes [ ] = 'et_pb_sidebar';
96 96
 					break;
97 97
 			}
98 98
 		}
Please login to merge, or discard this patch.
class-gravityview-plugin-hooks-gravity-forms-signature.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		$signature_fields = GFAPI::get_fields_by_type( $form, 'signature' );
54 54
 
55 55
 		foreach ( $signature_fields as $field ) {
56
-			unset( $_POST["input_{$field->id}"] );
56
+			unset( $_POST[ "input_{$field->id}" ] );
57 57
 		}
58 58
 	}
59 59
 
@@ -72,19 +72,19 @@  discard block
 block discarded – undo
72 72
 	 */
73 73
 	function edit_entry_field_input( $field_content = '', $field = null, $value = '', $lead_id = 0, $form_id = 0 ) {
74 74
 
75
-		$context = function_exists('gravityview_get_context') ? gravityview_get_context() : '';
75
+		$context = function_exists( 'gravityview_get_context' ) ? gravityview_get_context() : '';
76 76
 
77
-		if( 'signature' !== $field->type || 'edit' !== $context ) {
77
+		if ( 'signature' !== $field->type || 'edit' !== $context ) {
78 78
 			return $field_content;
79 79
 		}
80 80
 
81 81
 		// We need to fetch a fresh version of the entry, since the saved entry hasn't refreshed in GV yet.
82 82
 		$entry = GravityView_View::getInstance()->getCurrentEntry();
83
-		$entry = GFAPI::get_entry( $entry['id'] );
83
+		$entry = GFAPI::get_entry( $entry[ 'id' ] );
84 84
 		$entry_value = \GV\Utils::get( $entry, $field->id );
85 85
 
86
-		$_POST["input_{$field->id}"] = $entry_value; // Used when Edit Entry form *is* submitted
87
-		$_POST["input_{$form_id}_{$field->id}_signature_filename"] = $entry_value; // Used when Edit Entry form *is not* submitted
86
+		$_POST[ "input_{$field->id}" ] = $entry_value; // Used when Edit Entry form *is* submitted
87
+		$_POST[ "input_{$form_id}_{$field->id}_signature_filename" ] = $entry_value; // Used when Edit Entry form *is not* submitted
88 88
 
89 89
 		return ''; // Return empty string to force using $_POST values instead
90 90
 	}
Please login to merge, or discard this patch.