1 | <?php |
||||||
2 | |||||||
3 | /** |
||||||
4 | * Copyright © 2016-present Spryker Systems GmbH. All rights reserved. |
||||||
5 | * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file. |
||||||
6 | */ |
||||||
7 | |||||||
8 | namespace Spryker\Yves\Application; |
||||||
9 | |||||||
10 | use Spryker\Service\Container\ContainerInterface; |
||||||
11 | use Spryker\Shared\Application\Application; |
||||||
12 | use Spryker\Yves\Kernel\AbstractBundleDependencyProvider; |
||||||
13 | use Spryker\Yves\Kernel\Application as SilexApplication; |
||||||
14 | use Spryker\Yves\Kernel\BundleDependencyProviderResolverAwareTrait; |
||||||
15 | use Spryker\Yves\Kernel\Container; |
||||||
16 | use Spryker\Yves\Kernel\Dependency\Injector\DependencyInjectorInterface; |
||||||
17 | |||||||
18 | /** |
||||||
19 | * @deprecated Use {@link \SprykerShop\Yves\ShopApplication\YvesBootstrap} instead. |
||||||
20 | */ |
||||||
21 | abstract class YvesBootstrap |
||||||
22 | { |
||||||
23 | use BundleDependencyProviderResolverAwareTrait; |
||||||
24 | |||||||
25 | /** |
||||||
26 | * @var \Spryker\Yves\Kernel\Application |
||||||
27 | */ |
||||||
28 | protected $application; |
||||||
29 | |||||||
30 | /** |
||||||
31 | * @var \Spryker\Yves\Application\ApplicationConfig |
||||||
32 | */ |
||||||
33 | protected $config; |
||||||
34 | |||||||
35 | /** |
||||||
36 | * @var \Spryker\Shared\Application\Application|null |
||||||
37 | */ |
||||||
38 | protected $sprykerApplication; |
||||||
39 | |||||||
40 | public function __construct() |
||||||
41 | { |
||||||
42 | $this->application = new SilexApplication(); |
||||||
0 ignored issues
–
show
Deprecated Code
introduced
by
Loading history...
|
|||||||
43 | |||||||
44 | if ($this->application instanceof ContainerInterface) { |
||||||
45 | $this->sprykerApplication = new Application($this->application); |
||||||
46 | } |
||||||
47 | |||||||
48 | $this->config = new ApplicationConfig(); |
||||||
49 | } |
||||||
50 | |||||||
51 | /** |
||||||
52 | * @return \Spryker\Shared\Application\Application|\Spryker\Yves\Kernel\Application |
||||||
53 | */ |
||||||
54 | public function boot() |
||||||
55 | { |
||||||
56 | $this->registerServiceProviders(); |
||||||
57 | |||||||
58 | if ($this->sprykerApplication !== null) { |
||||||
59 | $this->setupApplication(); |
||||||
60 | } |
||||||
61 | |||||||
62 | $this->registerRouters(); |
||||||
63 | $this->registerControllerProviders(); |
||||||
64 | |||||||
65 | $this->application->boot(); |
||||||
66 | |||||||
67 | if ($this->sprykerApplication === null) { |
||||||
68 | return $this->application; |
||||||
69 | } |
||||||
70 | |||||||
71 | $this->sprykerApplication->boot(); |
||||||
72 | |||||||
73 | return $this->sprykerApplication; |
||||||
74 | } |
||||||
75 | |||||||
76 | /** |
||||||
77 | * @return void |
||||||
78 | */ |
||||||
79 | protected function setupApplication(): void |
||||||
80 | { |
||||||
81 | foreach ($this->getApplicationPlugins() as $applicationPlugin) { |
||||||
82 | $this->sprykerApplication->registerApplicationPlugin($applicationPlugin); |
||||||
0 ignored issues
–
show
The method
registerApplicationPlugin() does not exist on null .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces. This is most likely a typographical error or the method has been renamed.
Loading history...
|
|||||||
83 | } |
||||||
84 | } |
||||||
85 | |||||||
86 | /** |
||||||
87 | * @return array<\Spryker\Shared\ApplicationExtension\Dependency\Plugin\ApplicationPluginInterface> |
||||||
88 | */ |
||||||
89 | protected function getApplicationPlugins(): array |
||||||
90 | { |
||||||
91 | return $this->getProvidedDependency(ApplicationDependencyProvider::PLUGINS_APPLICATION); |
||||||
92 | } |
||||||
93 | |||||||
94 | /** |
||||||
95 | * @param \Spryker\Yves\Kernel\AbstractBundleDependencyProvider $dependencyProvider |
||||||
96 | * @param \Spryker\Yves\Kernel\Container $container |
||||||
97 | * |
||||||
98 | * @return \Spryker\Yves\Kernel\Container |
||||||
99 | */ |
||||||
100 | protected function provideExternalDependencies(AbstractBundleDependencyProvider $dependencyProvider, Container $container): Container |
||||||
101 | { |
||||||
102 | $container = $dependencyProvider->provideDependencies($container); |
||||||
103 | |||||||
104 | return $container; |
||||||
105 | } |
||||||
106 | |||||||
107 | /** |
||||||
108 | * @param \Spryker\Yves\Kernel\Dependency\Injector\DependencyInjectorInterface $dependencyInjector |
||||||
109 | * @param \Spryker\Yves\Kernel\Container $container |
||||||
110 | * |
||||||
111 | * @return \Spryker\Yves\Kernel\Container |
||||||
112 | */ |
||||||
113 | protected function injectExternalDependencies(DependencyInjectorInterface $dependencyInjector, Container $container): Container |
||||||
114 | { |
||||||
115 | return $dependencyInjector->inject($container); |
||||||
116 | } |
||||||
117 | |||||||
118 | /** |
||||||
119 | * @return void |
||||||
120 | */ |
||||||
121 | protected function registerServiceProviders() |
||||||
122 | { |
||||||
123 | } |
||||||
124 | |||||||
125 | /** |
||||||
126 | * @return void |
||||||
127 | */ |
||||||
128 | protected function registerRouters() |
||||||
129 | { |
||||||
130 | } |
||||||
131 | |||||||
132 | /** |
||||||
133 | * @return void |
||||||
134 | */ |
||||||
135 | protected function registerControllerProviders() |
||||||
136 | { |
||||||
137 | } |
||||||
138 | } |
||||||
139 |