-
Notifications
You must be signed in to change notification settings - Fork 128
Expand file tree
/
Copy pathApplication.php
More file actions
1737 lines (1547 loc) · 45.5 KB
/
Application.php
File metadata and controls
1737 lines (1547 loc) · 45.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
namespace Themosis\Core;
use Closure;
use Composer\Autoload\ClassLoader;
use Illuminate\Container\Container;
use Illuminate\Contracts\Config\Repository;
use Illuminate\Contracts\Foundation\MaintenanceMode;
use Illuminate\Contracts\Foundation\Application as ApplicationContract;
use Illuminate\Contracts\Foundation\CachesConfiguration;
use Illuminate\Contracts\Foundation\CachesRoutes;
use Illuminate\Contracts\Http\Kernel as HttpKernelContract;
use Illuminate\Events\EventServiceProvider;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Http\Request;
use Illuminate\Log\LogServiceProvider;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection;
use Illuminate\Support\Env;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Symfony\Component\HttpFoundation\Response as SymfonyResponse;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Themosis\Core\Bootstrap\EnvironmentLoader;
use Themosis\Core\Events\LocaleUpdated;
use Themosis\Route\RouteServiceProvider;
class Application extends Container implements
ApplicationContract,
CachesConfiguration,
CachesRoutes,
HttpKernelInterface
{
/**
* Themosis framework version.
*/
public const THEMOSIS_VERSION = '3.0.0';
/**
* Laravel version.
*
* @var string
*/
public const VERSION = '8.0.0';
/**
* Application textdomain.
*/
public const TEXTDOMAIN = 'themosis';
/**
* Base path of the framework.
*
* @var string
*/
protected $basePath;
/**
* Path location (directory) of env files.
*
* @var string
*/
protected $environmentPath;
/**
* Environment file name base.
*
* @var string
*/
protected $environmentFile = '.env';
/**
* The deferred services and their providers.
*
* @var array
*/
protected $deferredServices = [];
/**
* All of the registered service providers.
*
* @var array
*/
protected $serviceProviders = [];
/**
* The names of the loaded service providers.
*
* @var array
*/
protected $loadedProviders = [];
/**
* Indicates if the application has been bootstrapped or not.
*
* @var bool
*/
protected $hasBeenBootstrapped = false;
/**
* Indicates if the application has booted.
*
* @var bool
*/
protected $booted = false;
/**
* List of booting callbacks.
*
* @var array
*/
protected $bootingCallbacks = [];
/**
* List of booted callbacks.
*
* @var array
*/
protected $bootedCallbacks = [];
/**
* List of terminating callbacks.
*
* @var array
*/
protected $terminatingCallbacks = [];
/**
* @var string
*/
protected $namespace;
protected $storagePath;
public function __construct($basePath = null)
{
if ($basePath) {
$this->setBasePath($basePath);
}
$this->registerBaseBindings();
$this->registerBaseServiceProviders();
$this->registerCoreContainerAliases();
}
/**
* Get the version number of the application.
*
* @return string
*/
public function version()
{
return static::VERSION;
}
/**
* Register basic bindings into the container.
*/
protected function registerBaseBindings()
{
static::setInstance($this);
$this->instance('app', $this);
$this->instance(Container::class, $this);
$this->instance(PackageManifest::class, new PackageManifest(
new Filesystem(),
$this->basePath(),
$this->getCachedPackagesPath(),
));
}
/**
* Register base service providers.
*/
protected function registerBaseServiceProviders()
{
$this->register(new EventServiceProvider($this));
$this->register(new LogServiceProvider($this));
$this->register(new RouteServiceProvider($this));
}
/**
* Register the core class aliases in the container.
*/
protected function registerCoreContainerAliases()
{
$list = [
'action' => [
\Themosis\Hook\ActionBuilder::class,
],
'ajax' => [
\Themosis\Ajax\Ajax::class,
],
'app' => [
Application::class,
\Illuminate\Contracts\Container\Container::class,
\Illuminate\Contracts\Foundation\Application::class,
\Psr\Container\ContainerInterface::class,
],
'asset' => [
\Themosis\Asset\Factory::class,
],
'auth' => [
\Illuminate\Auth\AuthManager::class,
\Illuminate\Contracts\Auth\Factory::class,
],
'auth.driver' => [
\Illuminate\Contracts\Auth\Guard::class,
],
'auth.password' => [
\Illuminate\Auth\Passwords\PasswordBrokerManager::class,
\Illuminate\Contracts\Auth\PasswordBrokerFactory::class,
],
'auth.password.broker' => [
\Illuminate\Auth\Passwords\PasswordBroker::class,
\Illuminate\Contracts\Auth\PasswordBroker::class,
],
'blade.compiler' => [
\Illuminate\View\Compilers\BladeCompiler::class,
],
'cache' => [
\Illuminate\Cache\CacheManager::class,
\Illuminate\Contracts\Cache\Factory::class,
],
'cache.store' => [
\Illuminate\Cache\Repository::class,
\Illuminate\Contracts\Cache\Repository::class,
],
'config' => [
\Illuminate\Config\Repository::class,
\Illuminate\Contracts\Config\Repository::class,
],
'cookie' => [
\Illuminate\Cookie\CookieJar::class,
\Illuminate\Contracts\Cookie\Factory::class,
\Illuminate\Contracts\Cookie\QueueingFactory::class,
],
'db' => [
\Illuminate\Database\ConnectionResolverInterface::class,
\Illuminate\Database\DatabaseManager::class,
],
'db.connection' => [
\Illuminate\Database\Connection::class,
\Illuminate\Database\ConnectionInterface::class,
],
'encrypter' => [
\Illuminate\Encryption\Encrypter::class,
\Illuminate\Contracts\Encryption\Encrypter::class,
],
'events' => [
\Illuminate\Events\Dispatcher::class,
\Illuminate\Contracts\Events\Dispatcher::class,
],
'files' => [
\Illuminate\Filesystem\Filesystem::class,
],
'filesystem' => [
\Illuminate\Filesystem\FilesystemManager::class,
\Illuminate\Contracts\Filesystem\Factory::class,
],
'filesystem.disk' => [
\Illuminate\Contracts\Filesystem\Filesystem::class,
],
'filesystem.cloud' => [
\Illuminate\Contracts\Filesystem\Cloud::class,
],
'filter' => [
\Themosis\Hook\FilterBuilder::class,
],
'form' => [
\Themosis\Forms\FormFactory::class,
],
'hash' => [
\Illuminate\Hashing\HashManager::class,
],
'hash.driver' => [
\Illuminate\Contracts\Hashing\Hasher::class,
],
'html' => [
\Themosis\Html\HtmlBuilder::class,
],
'log' => [
\Illuminate\Log\LogManager::class,
\Psr\Log\LoggerInterface::class,
],
'mailer' => [
\Illuminate\Mail\Mailer::class,
\Illuminate\Contracts\Mail\Mailer::class,
\Illuminate\Contracts\Mail\MailQueue::class,
],
'metabox' => [
\Themosis\Metabox\Factory::class,
],
'posttype' => [
\Themosis\PostType\Factory::class,
],
'queue' => [
\Illuminate\Queue\QueueManager::class,
\Illuminate\Contracts\Queue\Factory::class,
\Illuminate\Contracts\Queue\Monitor::class,
],
'queue.connection' => [
\Illuminate\Contracts\Queue\Queue::class,
],
'queue.failer' => [
\Illuminate\Queue\Failed\FailedJobProviderInterface::class,
],
'redirect' => [
\Illuminate\Routing\Redirector::class,
],
'redis' => [
\Illuminate\Redis\RedisManager::class,
\Illuminate\Contracts\Redis\Factory::class,
],
'request' => [
\Illuminate\Http\Request::class,
\Symfony\Component\HttpFoundation\Request::class,
],
'router' => [
\Themosis\Route\Router::class,
\Illuminate\Routing\Router::class,
\Illuminate\Contracts\Routing\Registrar::class,
\Illuminate\Contracts\Routing\BindingRegistrar::class,
],
'session' => [
\Illuminate\Session\SessionManager::class,
],
'session.store' => [
\Illuminate\Session\Store::class,
\Illuminate\Contracts\Session\Session::class,
],
'taxonomy' => [
\Themosis\Taxonomy\Factory::class,
],
'taxonomy.field' => [
\Themosis\Taxonomy\TaxonomyFieldFactory::class,
],
'translator' => [
\Illuminate\Translation\Translator::class,
\Illuminate\Contracts\Translation\Translator::class,
],
'twig' => [
\Twig_Environment::class,
],
'url' => [
\Illuminate\Routing\UrlGenerator::class,
\Illuminate\Contracts\Routing\UrlGenerator::class,
],
'validator' => [
\Illuminate\Validation\Factory::class,
\Illuminate\Contracts\Validation\Factory::class,
],
'view' => [
\Illuminate\View\Factory::class,
\Illuminate\Contracts\View\Factory::class,
],
];
foreach ($list as $key => $aliases) {
foreach ($aliases as $alias) {
$this->alias($key, $alias);
}
}
}
/**
* Get the base path of the Laravel installation.
*
* @param string $path Optional path to append to the base path.
*
* @return string
*/
public function basePath($path = '')
{
return $this->basePath . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Set the base path for the application.
*
* @param string $basePath
*
* @return $this
*/
public function setBasePath($basePath)
{
$this->basePath = rtrim($basePath, '\/');
$this->bindPathsInContainer();
return $this;
}
/**
* Bind all of the application paths in the container.
*/
protected function bindPathsInContainer()
{
// Core
$this->instance('path', $this->path());
// Base
$this->instance('path.base', $this->basePath());
// Content
$this->instance('path.content', $this->contentPath());
// Mu-plugins
$this->instance('path.muplugins', $this->mupluginsPath());
// Plugins
$this->instance('path.plugins', $this->pluginsPath());
// Themes
$this->instance('path.themes', $this->themesPath());
// Application
$this->instance('path.application', $this->applicationPath());
// Resources
$this->instance('path.resources', $this->resourcePath());
// Languages
$this->instance('path.lang', $this->langPath());
// Web root
$this->instance('path.web', $this->webPath());
// Root
$this->instance('path.root', $this->rootPath());
// Config
$this->instance('path.config', $this->configPath());
// Public
$this->instance('path.public', $this->webPath());
// Storage
$this->instance('path.storage', $this->storagePath());
// Database
$this->instance('path.database', $this->databasePath());
// Bootstrap
$this->instance('path.bootstrap', $this->bootstrapPath());
// WordPress
$this->instance('path.wp', $this->wordpressPath());
}
/**
* Get the path to the application "themosis-application" directory.
*
* @param string $path
*
* @return string
*/
public function path($path = '')
{
return $this->basePath . DIRECTORY_SEPARATOR . 'app' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the WordPress "content" directory.
*
* @param string $path
*
* @return string
*/
public function contentPath($path = '')
{
return WP_CONTENT_DIR . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the WordPress "mu-plugins" directory.
*
* @param string $path
*
* @return string
*/
public function mupluginsPath($path = '')
{
return $this->contentPath('mu-plugins') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the WordPress "plugins" directory.
*
* @param string $path
*
* @return string
*/
public function pluginsPath($path = '')
{
return $this->contentPath('plugins') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the WordPress "themes" directory.
*
* @param string $path
*
* @return string
*/
public function themesPath($path = '')
{
return $this->contentPath('themes') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the application directory.
*
* @param string $path
*
* @return string
*/
public function applicationPath($path = '')
{
return $this->basePath('app') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the resources directory path.
*
* @param string $path
*
* @return string
*/
public function resourcePath($path = '')
{
return $this->basePath('resources') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the path to the resources "languages" directory.
*
* @param string $path
*
* @return string
*/
public function langPath($path = '')
{
return $this->resourcePath('languages') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the path of the web server root.
*
* @param string $path
*
* @return string
*/
public function webPath($path = '')
{
return $this->basePath(THEMOSIS_PUBLIC_DIR) . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the root path of the project.
*
* @param string $path
*
* @return string
*/
public function rootPath($path = '')
{
if (defined('THEMOSIS_ROOT')) {
return THEMOSIS_ROOT . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
return $this->webPath($path);
}
/**
* Get the main application plugin configuration directory.
*
* @param string $path
*
* @return string
*/
public function configPath($path = '')
{
return $this->basePath('config') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the storage directory path.
*
* @param string $path
*
* @return string
*/
public function storagePath($path = '')
{
if (defined('THEMOSIS_ROOT')) {
return $this->rootPath('storage') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
return $this->contentPath('storage') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Set the storage directory.
*
* @param string $path
*
* @return $this
*/
public function useStoragePath($path)
{
$this->storagePath = $path;
$this->instance('path.storage', $path);
return $this;
}
/**
* Get the database directory path.
*
* @param string $path
*
* @return string
*/
public function databasePath($path = '')
{
return $this->rootPath('database') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the bootstrap directory path.
*
* @param string $path
*
* @return string
*/
public function bootstrapPath($path = '')
{
return $this->rootPath('bootstrap') . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Get the WordPress directory path.
*
* @param string $path
*
* @throws \Illuminate\Container\EntryNotFoundException
*
* @return string
*/
public function wordpressPath($path = '')
{
return $this->webPath(env('WP_DIR', 'cms')) . ($path ? DIRECTORY_SEPARATOR . $path : $path);
}
/**
* Set the environment file to be loaded during bootstrapping.
*
* @param string $file
*
* @return $this
*/
public function loadEnvironmentFrom($file)
{
$this->environmentFile = $file;
return $this;
}
/**
* Return the environment path directory.
*
* @return string
*/
public function environmentPath()
{
return $this->environmentPath ?: $this->basePath();
}
/**
* Set the directory for the environment file.
*
* @param string $path
*
* @return $this
*/
public function useEnvironmentPath($path)
{
$this->environmentPath = $path;
return $this;
}
/**
* Return the environment file name base.
*
* @return string
*/
public function environmentFile()
{
return $this->environmentFile ?: '.env';
}
/**
* Return the environment file path.
*
* @return string
*/
public function environmentFilePath()
{
return $this->environmentPath() . DIRECTORY_SEPARATOR . $this->environmentFile();
}
/**
* Get or check the current application environment.
*
* @param string|array $environments
*
* @return string|bool
*/
public function environment(...$environments)
{
if (count($environments) > 0) {
$patterns = is_array($environments[0]) ? $environments[0] : $environments;
return Str::is($patterns, $this['env']);
}
return $this['env'];
}
/**
* Detech application's current environment.
*
* @param Closure $callback
*
* @return string
*/
public function detectEnvironment(Closure $callback)
{
$args = $_SERVER['argv'] ?? null;
return $this['env'] = (new EnvironmentDetector())->detect($callback, $args);
}
/**
* Determine if we are running in the console.
*
* @return bool
*/
public function runningInConsole()
{
return php_sapi_name() == 'cli' || php_sapi_name() == 'phpdbg';
}
/**
* Determine if the application is currently down for maintenance.
*
* @throws \Illuminate\Container\EntryNotFoundException
*
* @return bool
*/
public function isDownForMaintenance()
{
$filePath = $this->wordpressPath('.maintenance');
if (function_exists('wp_installing') && ! file_exists($filePath)) {
return \wp_installing();
}
return file_exists($filePath);
}
/**
* Register all of the configured providers.
*/
public function registerConfiguredProviders()
{
$providers = Collection::make($this->config['app.providers'])
->partition(function ($provider) {
return Str::startsWith($provider, 'Illuminate\\');
});
$providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]);
(new ProviderRepository($this, new Filesystem(), $this->getCachedServicesPath()))
->load($providers->collapse()->toArray());
}
/**
* Register a deferred provider and service.
*
* @param string $provider
* @param string|null $service
*/
public function registerDeferredProvider($provider, $service = null)
{
if ($service) {
unset($this->deferredServices[$service]);
}
$this->register($instance = new $provider($this));
if (! $this->booted) {
$this->booting(function () use ($instance) {
$this->bootProvider($instance);
});
}
}
/**
* Add an array of services to the application's deferred services.
*
* @param array $services
*/
public function addDeferredServices(array $services)
{
$this->deferredServices = array_merge($this->deferredServices, $services);
}
/**
* Get the application's deferred services.
*
* @return array
*/
public function getDeferredServices()
{
return $this->deferredServices;
}
/**
* Set the application's deferred services.
*
* @param array $services
*/
public function setDeferredServices(array $services)
{
$this->deferredServices = $services;
}
/**
* Verify if the application has been bootstrapped before.
*
* @return bool
*/
public function hasBeenBootstrapped()
{
return $this->hasBeenBootstrapped;
}
/**
* Bootstrap the application with given list of bootstrap
* classes.
*
* @param array $bootstrappers
*/
public function bootstrapWith(array $bootstrappers)
{
$this->hasBeenBootstrapped = true;
foreach ($bootstrappers as $bootstrapper) {
$this['events']->dispatch('bootstrapping: ' . $bootstrapper, [$this]);
/*
* Instantiate each bootstrap class and call its "bootstrap" method
* with the Application as a parameter.
*/
$this->make($bootstrapper)->bootstrap($this);
$this['events']->dispatch('bootstrapped: ' . $bootstrapper, [$this]);
}
}
/**
* Boot the application's service providers.
*/
public function boot()
{
if ($this->booted) {
return;
}
/*
* Once the application has booted we will also fire some "booted" callbacks
* for any listeners that need to do work after this initial booting gets
* finished. This is useful when ordering the boot-up processes we run.
*/
$this->fireAppCallbacks($this->bootingCallbacks);
array_walk($this->serviceProviders, function ($provider) {
$this->bootProvider($provider);
});
$this->booted = true;
$this->fireAppCallbacks($this->bootedCallbacks);
}
/**
* Call the booting callbacks for the application.
*
* @param array $callbacks
*/
protected function fireAppCallbacks(array $callbacks)
{
foreach ($callbacks as $callback) {
call_user_func($callback, $this);
}
}
/**
* Boot the given service provider.
*
* @param ServiceProvider $provider
*/
protected function bootProvider(ServiceProvider $provider)
{
$provider->callBootingCallbacks();
if (method_exists($provider, 'boot')) {
$this->call([$provider, 'boot']);
}
$provider->callBootedCallbacks();
}
/**
* Register a new boot listener.
*
* @param mixed $callback
*/
public function booting($callback)
{
$this->bootingCallbacks[] = $callback;
}
/**
* Register a new "booted" listener.
*
* @param mixed $callback
*/
public function booted($callback)
{
$this->bootedCallbacks[] = $callback;
if ($this->isBooted()) {
$this->fireAppCallbacks([$callback]);
}
}
/**
* Get the path to the cached services.php file.
*
* @return string
*/
public function getCachedServicesPath()
{
return $this->normalizeCachePath('APP_SERVICES_CACHE', 'cache/services.php');
}
/**
* Get the path to the cached packages.php file.
*
* @return string
*/
public function getCachedPackagesPath()
{
return $this->normalizeCachePath('APP_PACKAGES_CACHE', 'cache/packages.php');
}
/**
* Determine if the application configuration is cached.
*
* @return bool
*/
public function configurationIsCached()
{
return file_exists($this->getCachedConfigPath());
}
/**
* Get the path to the configuration cache file.
*
* @return string
*/
public function getCachedConfigPath()
{
return $this->normalizeCachePath('APP_CONFIG_CACHE', 'cache/config.php');
}
/**
* Handles a Request to convert it to a Response.
*
* When $catch is true, the implementation must catch all exceptions
* and do its best to convert them to a Response instance.
*
* @param SymfonyRequest $request A Request instance
* @param int $type The type of the request
* (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)
* @param bool $catch Whether to catch exceptions or not
*
* @throws \Exception When an Exception occurs during processing
*
* @return SymfonyResponse A Response instance
*/
public function handle(SymfonyRequest $request, int $type = self::MAIN_REQUEST, bool $catch = true): SymfonyResponse
{
return $this[HttpKernelContract::class]->handle(Request::createFromBase($request));
}
/**