Completed
Push — master ( 50e245...46828e )
by CodexShaper
07:06
created
bootstrap/app.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,19 +9,19 @@  discard block
 block discarded – undo
9 9
  * @subpackage WPB/bootstrap
10 10
  */
11 11
 
12
-require_once ABSPATH . 'wp-includes/pluggable.php';
13
-require_once __DIR__ . '/../vendor/autoload.php';
14
-require_once __DIR__ . '/../src/helpers.php';
12
+require_once ABSPATH.'wp-includes/pluggable.php';
13
+require_once __DIR__.'/../vendor/autoload.php';
14
+require_once __DIR__.'/../src/helpers.php';
15 15
 
16 16
 use WPB\Application;
17 17
 
18
-$app = ( new Application(
18
+$app = (new Application(
19 19
 	array(
20 20
 		'paths' => array(
21 21
 			'root' => WPB_APP_ROOT,
22 22
 		),
23 23
 	)
24
-) );
24
+));
25 25
 
26 26
 global $wpb_app;
27 27
 
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
 	\WPB\App\Exceptions\Handler::class
37 37
 );
38 38
 
39
-if ( \WPB\Support\Facades\Route::exists( \Illuminate\Http\Request::capture() ) ) {
39
+if (\WPB\Support\Facades\Route::exists(\Illuminate\Http\Request::capture())) {
40 40
 	try {
41 41
 
42
-		$kernel = $container->make( \Illuminate\Contracts\Http\Kernel::class );
42
+		$kernel = $container->make(\Illuminate\Contracts\Http\Kernel::class);
43 43
 
44
-		$response = $kernel->handle( \Illuminate\Http\Request::capture() );
44
+		$response = $kernel->handle(\Illuminate\Http\Request::capture());
45 45
 
46 46
 		$response->send();
47 47
 
48
-	} catch ( \Exception $ex ) {
49
-		if ( ! \WPB\Support\Facades\Route::current() ) {
48
+	} catch (\Exception $ex) {
49
+		if (!\WPB\Support\Facades\Route::current()) {
50 50
 			return true;
51 51
 		}
52
-		throw new \Exception( $ex, 1 );
52
+		throw new \Exception($ex, 1);
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.
src/helpers.php 1 patch
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 use Illuminate\Contracts\Validation\Factory as ValidationFactory;
31 31
 use Illuminate\Contracts\Broadcasting\Factory as BroadcastFactory;
32 32
 
33
-if ( ! function_exists( 'wpb_csrf_token' ) ) {
33
+if (!function_exists('wpb_csrf_token')) {
34 34
 	/**
35 35
 	 * Generate wp nonce.
36 36
 	 *
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return null|string
40 40
 	 */
41
-	function wpb_csrf_token( $action = 'wpb_nonce' ) {
42
-		return wp_create_nonce( $action );
41
+	function wpb_csrf_token($action = 'wpb_nonce') {
42
+		return wp_create_nonce($action);
43 43
 	}
44 44
 }
45 45
 
46
-if ( ! function_exists( 'wpb_config' ) ) {
46
+if (!function_exists('wpb_config')) {
47 47
 	/**
48 48
 	 * Get / set the specified configuration value.
49 49
 	 *
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 	 *
55 55
 	 * @return mixed|\Illuminate\Config\Repository
56 56
 	 */
57
-	function wpb_config( $key = null, $default = null ) {
58
-		if ( is_null( $key ) ) {
59
-			return app( 'config' );
57
+	function wpb_config($key = null, $default = null) {
58
+		if (is_null($key)) {
59
+			return app('config');
60 60
 		}
61 61
 
62
-		if ( is_array( $key ) ) {
63
-			return app( 'config' )->set( $key );
62
+		if (is_array($key)) {
63
+			return app('config')->set($key);
64 64
 		}
65 65
 
66
-		return app( 'config' )->get( $key, $default );
66
+		return app('config')->get($key, $default);
67 67
 	}
68 68
 }
69 69
 
70
-if ( ! function_exists( 'wpb_view' ) ) {
70
+if (!function_exists('wpb_view')) {
71 71
 	/**
72 72
 	 * Render blade view.
73 73
 	 *
@@ -78,16 +78,16 @@  discard block
 block discarded – undo
78 78
 	 * @throws \Exception This will throw an exception if view class doesn't exists.
79 79
 	 * @return null|string
80 80
 	 */
81
-	function wpb_view( $view, $data = array(), $merge_data = array() ) {
82
-		if ( ! class_exists( \CodexShaper\Blade\View::class ) ) {
83
-			throw new \Exception( 'View not resolved. Please install View' );
81
+	function wpb_view($view, $data = array(), $merge_data = array()) {
82
+		if (!class_exists(\CodexShaper\Blade\View::class)) {
83
+			throw new \Exception('View not resolved. Please install View');
84 84
 		}
85 85
 
86
-		return ( new \CodexShaper\Blade\View( array( __DIR__ . '/../resources/views' ), __DIR__ . '/../storage/cache' ) )->make( $view, $data = array(), $merge_data = array() );
86
+		return (new \CodexShaper\Blade\View(array(__DIR__.'/../resources/views'), __DIR__.'/../storage/cache'))->make($view, $data = array(), $merge_data = array());
87 87
 	}
88 88
 }
89 89
 
90
-if (! function_exists('wpb_abort')) {
90
+if (!function_exists('wpb_abort')) {
91 91
     /**
92 92
      * Throw an HttpException with the given data.
93 93
      *
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
     }
112 112
 }
113 113
 
114
-if (! function_exists('wpb_abort_if')) {
114
+if (!function_exists('wpb_abort_if')) {
115 115
     /**
116 116
      * Throw an HttpException with the given data if the given condition is true.
117 117
      *
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
     }
133 133
 }
134 134
 
135
-if (! function_exists('wpb_abort_unless')) {
135
+if (!function_exists('wpb_abort_unless')) {
136 136
     /**
137 137
      * Throw an HttpException with the given data unless the given condition is true.
138 138
      *
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
      */
148 148
     function wpb_abort_unless($boolean, $code, $message = '', array $headers = [])
149 149
     {
150
-        if (! $boolean) {
150
+        if (!$boolean) {
151 151
             wpb_abort($code, $message, $headers);
152 152
         }
153 153
     }
154 154
 }
155 155
 
156
-if (! function_exists('wpb_action')) {
156
+if (!function_exists('wpb_action')) {
157 157
     /**
158 158
      * Generate the URL to a controller action.
159 159
      *
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
     }
169 169
 }
170 170
 
171
-if (! function_exists('wpb_app')) {
171
+if (!function_exists('wpb_app')) {
172 172
     /**
173 173
      * Get the available container instance.
174 174
      *
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     }
189 189
 }
190 190
 
191
-if (! function_exists('wpb_app_path')) {
191
+if (!function_exists('wpb_app_path')) {
192 192
     /**
193 193
      * Get the path to the application folder.
194 194
      *
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     }
202 202
 }
203 203
 
204
-if (! function_exists('wpb_asset')) {
204
+if (!function_exists('wpb_asset')) {
205 205
     /**
206 206
      * Generate an asset path for the application.
207 207
      *
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
     }
216 216
 }
217 217
 
218
-if (! function_exists('wpb_auth')) {
218
+if (!function_exists('wpb_auth')) {
219 219
     /**
220 220
      * Get the available auth instance.
221 221
      *
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     }
233 233
 }
234 234
 
235
-if (! function_exists('wpb_back')) {
235
+if (!function_exists('wpb_back')) {
236 236
     /**
237 237
      * Create a new redirect response to the previous location.
238 238
      *
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     }
248 248
 }
249 249
 
250
-if (! function_exists('wpb_base_path')) {
250
+if (!function_exists('wpb_base_path')) {
251 251
     /**
252 252
      * Get the path to the base of the install.
253 253
      *
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
     }
261 261
 }
262 262
 
263
-if (! function_exists('wpb_bcrypt')) {
263
+if (!function_exists('wpb_bcrypt')) {
264 264
     /**
265 265
      * Hash the given value against the bcrypt algorithm.
266 266
      *
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
     }
275 275
 }
276 276
 
277
-if (! function_exists('wpb_broadcast')) {
277
+if (!function_exists('wpb_broadcast')) {
278 278
     /**
279 279
      * Begin broadcasting an event.
280 280
      *
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     }
288 288
 }
289 289
 
290
-if (! function_exists('wpb_cache')) {
290
+if (!function_exists('wpb_cache')) {
291 291
     /**
292 292
      * Get / set the specified cache value.
293 293
      *
@@ -310,13 +310,13 @@  discard block
 block discarded – undo
310 310
             return wpb_app('cache')->get($arguments[0], $arguments[1] ?? null);
311 311
         }
312 312
 
313
-        if (! is_array($arguments[0])) {
313
+        if (!is_array($arguments[0])) {
314 314
             throw new Exception(
315 315
                 'When setting a value in the cache, you must pass an array of key / value pairs.'
316 316
             );
317 317
         }
318 318
 
319
-        if (! isset($arguments[1])) {
319
+        if (!isset($arguments[1])) {
320 320
             throw new Exception(
321 321
                 'You must specify an expiration time when setting a value in the cache.'
322 322
             );
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
     }
327 327
 }
328 328
 
329
-if (! function_exists('wpb_config_path')) {
329
+if (!function_exists('wpb_config_path')) {
330 330
     /**
331 331
      * Get the configuration path.
332 332
      *
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
     }
340 340
 }
341 341
 
342
-if (! function_exists('wpb_cookie')) {
342
+if (!function_exists('wpb_cookie')) {
343 343
     /**
344 344
      * Create a new cookie instance.
345 345
      *
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
     }
367 367
 }
368 368
 
369
-if (! function_exists('wpb_csrf_field')) {
369
+if (!function_exists('wpb_csrf_field')) {
370 370
     /**
371 371
      * Generate a CSRF token form field.
372 372
      *
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
     }
379 379
 }
380 380
 
381
-if (! function_exists('wpb_database_path')) {
381
+if (!function_exists('wpb_database_path')) {
382 382
     /**
383 383
      * Get the database path.
384 384
      *
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     }
392 392
 }
393 393
 
394
-if (! function_exists('wpb_decrypt')) {
394
+if (!function_exists('wpb_decrypt')) {
395 395
     /**
396 396
      * Decrypt the given value.
397 397
      *
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     }
406 406
 }
407 407
 
408
-if (! function_exists('wpb_dispatch')) {
408
+if (!function_exists('wpb_dispatch')) {
409 409
     /**
410 410
      * Dispatch a job to its appropriate handler.
411 411
      *
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     }
419 419
 }
420 420
 
421
-if (! function_exists('wpb_dispatch_now')) {
421
+if (!function_exists('wpb_dispatch_now')) {
422 422
     /**
423 423
      * Dispatch a command to its appropriate handler in the current process.
424 424
      *
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
     }
433 433
 }
434 434
 
435
-if (! function_exists('wpb_elixir')) {
435
+if (!function_exists('wpb_elixir')) {
436 436
     /**
437 437
      * Get the path to a versioned Elixir file.
438 438
      *
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
     }
473 473
 }
474 474
 
475
-if (! function_exists('wpb_encrypt')) {
475
+if (!function_exists('wpb_encrypt')) {
476 476
     /**
477 477
      * Encrypt the given value.
478 478
      *
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
     }
487 487
 }
488 488
 
489
-if (! function_exists('wpb_event')) {
489
+if (!function_exists('wpb_event')) {
490 490
     /**
491 491
      * Dispatch an event and call the listeners.
492 492
      *
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
     }
502 502
 }
503 503
 
504
-if (! function_exists('wpb_factory')) {
504
+if (!function_exists('wpb_factory')) {
505 505
     /**
506 506
      * Create a model factory builder for a given class, name, and amount.
507 507
      *
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
     }
525 525
 }
526 526
 
527
-if (! function_exists('wpb_info')) {
527
+if (!function_exists('wpb_info')) {
528 528
     /**
529 529
      * Write some information to the log.
530 530
      *
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
     }
539 539
 }
540 540
 
541
-if (! function_exists('wpb_logger')) {
541
+if (!function_exists('wpb_logger')) {
542 542
     /**
543 543
      * Log a debug message to the logs.
544 544
      *
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
     }
557 557
 }
558 558
 
559
-if (! function_exists('wpb_logs')) {
559
+if (!function_exists('wpb_logs')) {
560 560
     /**
561 561
      * Get a log driver instance.
562 562
      *
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
     }
570 570
 }
571 571
 
572
-if (! function_exists('wpb_method_field')) {
572
+if (!function_exists('wpb_method_field')) {
573 573
     /**
574 574
      * Generate a form field to spoof the HTTP verb used by forms.
575 575
      *
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
     }
583 583
 }
584 584
 
585
-if (! function_exists('wpb_mix')) {
585
+if (!function_exists('wpb_mix')) {
586 586
     /**
587 587
      * Get the path to a versioned Mix file.
588 588
      *
@@ -596,11 +596,11 @@  discard block
 block discarded – undo
596 596
     {
597 597
         static $manifests = [];
598 598
 
599
-        if (! Str::startsWith($path, '/')) {
599
+        if (!Str::startsWith($path, '/')) {
600 600
             $path = "/{$path}";
601 601
         }
602 602
 
603
-        if ($manifestDirectory && ! Str::startsWith($manifestDirectory, '/')) {
603
+        if ($manifestDirectory && !Str::startsWith($manifestDirectory, '/')) {
604 604
             $manifestDirectory = "/{$manifestDirectory}";
605 605
         }
606 606
 
@@ -616,8 +616,8 @@  discard block
 block discarded – undo
616 616
 
617 617
         $manifestPath = wpb_public_path($manifestDirectory.'/mix-manifest.json');
618 618
 
619
-        if (! isset($manifests[$manifestPath])) {
620
-            if (! file_exists($manifestPath)) {
619
+        if (!isset($manifests[$manifestPath])) {
620
+            if (!file_exists($manifestPath)) {
621 621
                 throw new Exception('The Mix manifest does not exist.');
622 622
             }
623 623
 
@@ -626,10 +626,10 @@  discard block
 block discarded – undo
626 626
 
627 627
         $manifest = $manifests[$manifestPath];
628 628
 
629
-        if (! isset($manifest[$path])) {
629
+        if (!isset($manifest[$path])) {
630 630
             wpb_report(new Exception("Unable to locate Mix file: {$path}."));
631 631
 
632
-            if (! wpb_app('config')->get('app.debug')) {
632
+            if (!wpb_app('config')->get('app.debug')) {
633 633
                 return $path;
634 634
             }
635 635
         }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
     }
639 639
 }
640 640
 
641
-if (! function_exists('wpb_now')) {
641
+if (!function_exists('wpb_now')) {
642 642
     /**
643 643
      * Create a new Carbon instance for the current time.
644 644
      *
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
     }
652 652
 }
653 653
 
654
-if (! function_exists('wpb_old')) {
654
+if (!function_exists('wpb_old')) {
655 655
     /**
656 656
      * Retrieve an old input item.
657 657
      *
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
     }
666 666
 }
667 667
 
668
-if (! function_exists('wpb_policy')) {
668
+if (!function_exists('wpb_policy')) {
669 669
     /**
670 670
      * Get a policy instance for a given class.
671 671
      *
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
     }
681 681
 }
682 682
 
683
-if (! function_exists('wpb_public_path')) {
683
+if (!function_exists('wpb_public_path')) {
684 684
     /**
685 685
      * Get the path to the public folder.
686 686
      *
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
     }
694 694
 }
695 695
 
696
-if (! function_exists('wpb_redirect')) {
696
+if (!function_exists('wpb_redirect')) {
697 697
     /**
698 698
      * Get an instance of the redirector.
699 699
      *
@@ -713,7 +713,7 @@  discard block
 block discarded – undo
713 713
     }
714 714
 }
715 715
 
716
-if (! function_exists('wpb_report')) {
716
+if (!function_exists('wpb_report')) {
717 717
     /**
718 718
      * Report an exception.
719 719
      *
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
     function wpb_report($exception)
724 724
     {
725 725
         if ($exception instanceof Throwable &&
726
-            ! $exception instanceof Exception) {
726
+            !$exception instanceof Exception) {
727 727
             $exception = new FatalThrowableError($exception);
728 728
         }
729 729
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
     }
732 732
 }
733 733
 
734
-if (! function_exists('wpb_request')) {
734
+if (!function_exists('wpb_request')) {
735 735
     /**
736 736
      * Get an instance of the current request or an input item from the request.
737 737
      *
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
     }
756 756
 }
757 757
 
758
-if (! function_exists('wpb_rescue')) {
758
+if (!function_exists('wpb_rescue')) {
759 759
     /**
760 760
      * Catch a potential exception and return a default value.
761 761
      *
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
     }
776 776
 }
777 777
 
778
-if (! function_exists('wpb_resolve')) {
778
+if (!function_exists('wpb_resolve')) {
779 779
     /**
780 780
      * Resolve a service from the container.
781 781
      *
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
     }
789 789
 }
790 790
 
791
-if (! function_exists('wpb_resource_path')) {
791
+if (!function_exists('wpb_resource_path')) {
792 792
     /**
793 793
      * Get the path to the resources folder.
794 794
      *
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
     }
802 802
 }
803 803
 
804
-if (! function_exists('wpb_response')) {
804
+if (!function_exists('wpb_response')) {
805 805
     /**
806 806
      * Return a new response from the application.
807 807
      *
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
     }
823 823
 }
824 824
 
825
-if (! function_exists('wpb_route')) {
825
+if (!function_exists('wpb_route')) {
826 826
     /**
827 827
      * Generate the URL to a named route.
828 828
      *
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
     }
838 838
 }
839 839
 
840
-if (! function_exists('wpb_secure_asset')) {
840
+if (!function_exists('wpb_secure_asset')) {
841 841
     /**
842 842
      * Generate an asset path for the application.
843 843
      *
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
     }
851 851
 }
852 852
 
853
-if (! function_exists('wpb_secure_url')) {
853
+if (!function_exists('wpb_secure_url')) {
854 854
     /**
855 855
      * Generate a HTTPS url for the application.
856 856
      *
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
     }
865 865
 }
866 866
 
867
-if (! function_exists('wpb_session')) {
867
+if (!function_exists('wpb_session')) {
868 868
     /**
869 869
      * Get / set the specified session value.
870 870
      *
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
     }
889 889
 }
890 890
 
891
-if (! function_exists('wpb_storage_path')) {
891
+if (!function_exists('wpb_storage_path')) {
892 892
     /**
893 893
      * Get the path to the storage folder.
894 894
      *
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
     }
902 902
 }
903 903
 
904
-if (! function_exists('wpb_today')) {
904
+if (!function_exists('wpb_today')) {
905 905
     /**
906 906
      * Create a new Carbon instance for the current date.
907 907
      *
@@ -914,7 +914,7 @@  discard block
 block discarded – undo
914 914
     }
915 915
 }
916 916
 
917
-if (! function_exists('wpb_trans')) {
917
+if (!function_exists('wpb_trans')) {
918 918
     /**
919 919
      * Translate the given message.
920 920
      *
@@ -933,7 +933,7 @@  discard block
 block discarded – undo
933 933
     }
934 934
 }
935 935
 
936
-if (! function_exists('wpb_trans_choice')) {
936
+if (!function_exists('wpb_trans_choice')) {
937 937
     /**
938 938
      * Translates the given message based on a count.
939 939
      *
@@ -949,7 +949,7 @@  discard block
 block discarded – undo
949 949
     }
950 950
 }
951 951
 
952
-if (! function_exists('__')) {
952
+if (!function_exists('__')) {
953 953
     /**
954 954
      * Translate the given message.
955 955
      *
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
     }
965 965
 }
966 966
 
967
-if (! function_exists('wpb_url')) {
967
+if (!function_exists('wpb_url')) {
968 968
     /**
969 969
      * Generate a url for the application.
970 970
      *
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
     }
984 984
 }
985 985
 
986
-if (! function_exists('wpb_validator')) {
986
+if (!function_exists('wpb_validator')) {
987 987
     /**
988 988
      * Create a new Validator instance.
989 989
      *
Please login to merge, or discard this patch.
src/Application.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -84,30 +84,30 @@  discard block
 block discarded – undo
84 84
 	 *
85 85
 	 * @return void
86 86
 	 */
87
-	public function __construct( $options = array(), ContainerInterface $container = null ) {
87
+	public function __construct($options = array(), ContainerInterface $container = null) {
88 88
 		$this->options = $options;
89 89
 
90 90
 		$this->app = $container;
91 91
 
92
-		if ( is_null( $this->app ) ) {
92
+		if (is_null($this->app)) {
93 93
 			$this->app = new Container();
94
-			Facade::setFacadeApplication( $this->app );
95
-			$this->app->instance( ContainerInterface::class, $this->app );
94
+			Facade::setFacadeApplication($this->app);
95
+			$this->app->instance(ContainerInterface::class, $this->app);
96 96
 		}
97 97
 
98 98
 		$this->app['app'] = $this->app;
99 99
 
100
-		$this->root = __DIR__ . '/../../../../';
100
+		$this->root = __DIR__.'/../../../../';
101 101
 
102
-		if ( ! empty( $this->options ) && isset( $this->options['paths']['root'] ) ) {
103
-			$this->root = rtrim( $this->options['paths']['root'], '/' ) . '/';
102
+		if (!empty($this->options) && isset($this->options['paths']['root'])) {
103
+			$this->root = rtrim($this->options['paths']['root'], '/').'/';
104 104
 		}
105 105
 
106
-		if ( ! isset( $this->app['root'] ) ) {
106
+		if (!isset($this->app['root'])) {
107 107
 			$this->app['root'] = $this->root;
108 108
 		}
109 109
 
110
-		$this->config = new Config( $this->options );
110
+		$this->config = new Config($this->options);
111 111
 
112 112
 		$this->setup_env();
113 113
 		$this->register_config();
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		$this->register_providers();
116 116
 		$this->register_request();
117 117
 		$this->register_instances();
118
-		$this->load_routes( $this->app['router'] );
118
+		$this->load_routes($this->app['router']);
119 119
 	}
120 120
 
121 121
 	/**
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 	 * @return \Illuminate\Container\Container
127 127
 	 */
128 128
 	public function get_instance() {
129
-		if ( ! $this->app ) {
129
+		if (!$this->app) {
130 130
 			new self();
131 131
 		}
132 132
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 	 * @return void
142 142
 	 */
143 143
 	protected function setup_env() {
144
-		$this->app['env'] = $this->config->get( 'app.env' );
144
+		$this->app['env'] = $this->config->get('app.env');
145 145
 	}
146 146
 
147 147
 	/**
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
 	protected function register_config() {
155 155
 		$this->app->bind(
156 156
 			'config',
157
-			function () {
157
+			function() {
158 158
 				return array(
159
-					'app'           => $this->config->get( 'app' ),
160
-					'view.paths'    => $this->config->get( 'view.paths' ),
161
-					'view.compiled' => $this->config->get( 'view.compiled' ),
159
+					'app'           => $this->config->get('app'),
160
+					'view.paths'    => $this->config->get('view.paths'),
161
+					'view.compiled' => $this->config->get('view.compiled'),
162 162
 				);
163 163
 			},
164 164
 			true
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 
193 193
 		$this->app->singleton(
194 194
 			'db',
195
-			function () {
195
+			function() {
196 196
 				return $this->db;
197 197
 			}
198 198
 		);
@@ -206,11 +206,11 @@  discard block
 block discarded – undo
206 206
 	 * @return void
207 207
 	 */
208 208
 	protected function register_providers() {
209
-		$providers = $this->config->get( 'app.providers' );
209
+		$providers = $this->config->get('app.providers');
210 210
 
211
-		if ( $providers && count( $providers ) > 0 ) {
212
-			foreach ( $providers as $provider ) {
213
-				with( new $provider( $this->app ) )->register();
211
+		if ($providers && count($providers) > 0) {
212
+			foreach ($providers as $provider) {
213
+				with(new $provider($this->app))->register();
214 214
 			}
215 215
 		}
216 216
 	}
@@ -225,14 +225,14 @@  discard block
 block discarded – undo
225 225
 	protected function register_request() {
226 226
 		$this->app->bind(
227 227
 			'request',
228
-			function ( $app ) {
228
+			function($app) {
229 229
 				$request = Request::capture();
230 230
 				$wp_user = wp_get_current_user();
231
-				if ( $wp_user ) {
232
-					$user = User::find( $wp_user->ID );
233
-					$request->merge( array( 'user' => $user ) );
231
+				if ($wp_user) {
232
+					$user = User::find($wp_user->ID);
233
+					$request->merge(array('user' => $user));
234 234
 					$request->setUserResolver(
235
-						function () use ( $user ) {
235
+						function() use ($user) {
236 236
 							return $user;
237 237
 						}
238 238
 					);
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
 	 * @return void
252 252
 	 */
253 253
 	protected function register_instances() {
254
-		$this->app->instance( \Illuminate\Http\Request::class, $this->app['request'] );
255
-		$this->app->instance( \Illuminate\Routing\Router::class, $this->app['router'] );
256
-		$this->app->instance( \WPB\Router::class, $this->app['router'] );
257
-		$this->app->instance( \Illuminate\Contracts\View\Factory::class, $this->app['view'] );
258
-		$this->app->instance( \Illuminate\Contracts\Routing\UrlGenerator::class, $this->app['url'] );
259
-		$this->app->alias( 'Route', \WPB\Support\Facades\Route::class );
254
+		$this->app->instance(\Illuminate\Http\Request::class, $this->app['request']);
255
+		$this->app->instance(\Illuminate\Routing\Router::class, $this->app['router']);
256
+		$this->app->instance(\WPB\Router::class, $this->app['router']);
257
+		$this->app->instance(\Illuminate\Contracts\View\Factory::class, $this->app['view']);
258
+		$this->app->instance(\Illuminate\Contracts\Routing\UrlGenerator::class, $this->app['url']);
259
+		$this->app->alias('Route', \WPB\Support\Facades\Route::class);
260 260
 	}
261 261
 
262 262
 	/**
@@ -268,17 +268,17 @@  discard block
 block discarded – undo
268 268
 	 *
269 269
 	 * @return void
270 270
 	 */
271
-	public function load_routes( $router, $dir = null ) {
272
-		if ( ! $dir ) {
273
-			$dir = __DIR__ . '/../routes/';
271
+	public function load_routes($router, $dir = null) {
272
+		if (!$dir) {
273
+			$dir = __DIR__.'/../routes/';
274 274
 		}
275 275
 
276
-		require $dir . 'web.php';
276
+		require $dir.'web.php';
277 277
 
278 278
 		$router->group(
279
-			array( 'prefix' => 'api' ),
280
-			function () use ( $dir, $router ) {
281
-				require $dir . 'api.php';
279
+			array('prefix' => 'api'),
280
+			function() use ($dir, $router) {
281
+				require $dir.'api.php';
282 282
 			}
283 283
 		);
284 284
 	}
Please login to merge, or discard this patch.