1 | <?php |
||
26 | class ApplicationPackage implements RegistrationInterface |
||
27 | { |
||
28 | /** @var array $config */ |
||
29 | private $config; |
||
30 | |||
31 | /** @var Router $router */ |
||
32 | private $router; |
||
33 | |||
34 | /** |
||
35 | * ApplicationPackage constructor. |
||
36 | * @param array $config |
||
37 | * @param Router $router |
||
38 | */ |
||
39 | 9 | public function __construct(array $config, Router $router) |
|
44 | |||
45 | /** |
||
46 | * @param Container $c |
||
47 | * @throws \Bone\Exception |
||
48 | * @throws \Exception |
||
49 | */ |
||
50 | 9 | public function addToContainer(Container $c) |
|
64 | |||
65 | /** |
||
66 | * @param Container $c |
||
67 | */ |
||
68 | 9 | private function setConfigArray(Container $c) |
|
74 | |||
75 | /** |
||
76 | * @param Container $c |
||
77 | */ |
||
78 | 9 | private function setupViewEngine(Container $c) |
|
83 | |||
84 | /** |
||
85 | * @param Container $c |
||
86 | */ |
||
87 | 9 | private function setupPackages(Container $c) |
|
88 | { |
||
89 | // set up the modules and vendor package modules |
||
90 | 9 | $packages = $c->get('packages'); |
|
91 | 9 | $i18n = $c->get('i18n'); |
|
92 | /** @var Translator $translator */ |
||
93 | 9 | $translator = $c->get(Translator::class); |
|
94 | |||
95 | 9 | foreach ($packages as $packageName) { |
|
96 | 9 | if (class_exists($packageName)) { |
|
97 | /** @var RegistrationInterface $package */ |
||
98 | 9 | $package = new $packageName(); |
|
99 | |||
100 | 9 | if ($package->hasEntityPath()) { |
|
101 | 9 | $paths = $c['entity_paths']; |
|
102 | 9 | $paths[] = $package->getEntityPath(); |
|
103 | 9 | $c['entity_paths'] = $paths; |
|
104 | } |
||
105 | } |
||
106 | } |
||
107 | 9 | reset($packages); |
|
108 | 9 | foreach ($packages as $packageName) { |
|
109 | 9 | if (class_exists($packageName)) { |
|
110 | /** @var RegistrationInterface $package */ |
||
111 | 9 | $package = new $packageName(); |
|
112 | 9 | $package->addToContainer($c); |
|
113 | |||
114 | 9 | if ($package instanceof RouterConfigInterface) { |
|
115 | 9 | $package->addRoutes($c, $this->router); |
|
116 | } |
||
117 | |||
118 | 9 | if ($package instanceof I18nRegistrationInterface) { |
|
119 | 9 | foreach ($i18n['supported_locales'] as $locale) { |
|
120 | 9 | $factory = new TranslatorFactory(); |
|
121 | 9 | $factory->addPackageTranslations($translator, $package, $locale); |
|
122 | } |
||
123 | } |
||
124 | |||
125 | 9 | if ($package instanceof MiddlewareAwareInterface) { |
|
126 | $stack = $c->get(Stack::class); |
||
127 | 9 | $package->addMiddleware($stack, $c); |
|
128 | } |
||
129 | } |
||
130 | } |
||
131 | 9 | } |
|
132 | |||
133 | /** |
||
134 | * @param Container $c |
||
135 | * @throws \Bone\Exception |
||
136 | */ |
||
137 | 9 | private function setupTranslator(Container $c) |
|
143 | |||
144 | |||
145 | /** |
||
146 | * @param Container $c |
||
147 | * @throws \Bone\Exception |
||
148 | */ |
||
149 | 9 | private function setupPdoConnection(Container $c) |
|
154 | |||
155 | /** |
||
156 | * @param Container $c |
||
157 | */ |
||
158 | 9 | private function setupDownloadController(Container $c): void |
|
166 | |||
167 | /** |
||
168 | * @param Container $c |
||
169 | */ |
||
170 | 9 | private function setupRouteFirewall(Container $c): void |
|
175 | |||
176 | /** |
||
177 | * @param Container $c |
||
178 | * @throws \Exception |
||
179 | */ |
||
180 | 9 | private function setupLogs(Container $c) |
|
185 | |||
186 | /** |
||
187 | * @param Container $c |
||
188 | */ |
||
189 | 9 | private function setupVendorViewOverrides(Container $c): void |
|
200 | |||
201 | /** |
||
202 | * @param string $view |
||
203 | * @param string $folder |
||
204 | * @param array $registeredViews |
||
205 | * @param ViewEngine $viewEngine |
||
|
|||
206 | */ |
||
207 | 9 | private function overrideViewFolder(string $view, string $folder, Folders $registeredViews): void |
|
215 | |||
216 | /** |
||
217 | * @return string |
||
218 | */ |
||
219 | 1 | public function getEntityPath(): string |
|
223 | |||
224 | /** |
||
225 | * @return bool |
||
226 | */ |
||
227 | 1 | public function hasEntityPath(): bool |
|
231 | |||
232 | /** |
||
233 | * @param Container $c |
||
234 | */ |
||
235 | 9 | private function initMiddlewareStack(Container $c): void |
|
240 | |||
241 | /** |
||
242 | * @param Container $c |
||
243 | */ |
||
244 | 9 | private function setupMiddlewareStack(Container $c): void |
|
259 | } |
||
260 |
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.