@@ -30,123 +30,123 @@ |
||
30 | 30 | |
31 | 31 | class ScopedPsrLogger implements LoggerInterface { |
32 | 32 | |
33 | - /** @var LoggerInterface */ |
|
34 | - private $inner; |
|
35 | - |
|
36 | - /** @var string */ |
|
37 | - private $appId; |
|
38 | - |
|
39 | - public function __construct(LoggerInterface $inner, |
|
40 | - string $appId) { |
|
41 | - $this->inner = $inner; |
|
42 | - $this->appId = $appId; |
|
43 | - } |
|
44 | - |
|
45 | - public function emergency($message, array $context = []) { |
|
46 | - $this->inner->emergency( |
|
47 | - $message, |
|
48 | - array_merge( |
|
49 | - [ |
|
50 | - 'app' => $this->appId, |
|
51 | - ], |
|
52 | - $context |
|
53 | - ) |
|
54 | - ); |
|
55 | - } |
|
56 | - |
|
57 | - public function alert($message, array $context = []) { |
|
58 | - $this->inner->alert( |
|
59 | - $message, |
|
60 | - array_merge( |
|
61 | - [ |
|
62 | - 'app' => $this->appId, |
|
63 | - ], |
|
64 | - $context |
|
65 | - ) |
|
66 | - ); |
|
67 | - } |
|
68 | - |
|
69 | - public function critical($message, array $context = []) { |
|
70 | - $this->inner->critical( |
|
71 | - $message, |
|
72 | - array_merge( |
|
73 | - [ |
|
74 | - 'app' => $this->appId, |
|
75 | - ], |
|
76 | - $context |
|
77 | - ) |
|
78 | - ); |
|
79 | - } |
|
80 | - |
|
81 | - public function error($message, array $context = []) { |
|
82 | - $this->inner->error( |
|
83 | - $message, |
|
84 | - array_merge( |
|
85 | - [ |
|
86 | - 'app' => $this->appId, |
|
87 | - ], |
|
88 | - $context |
|
89 | - ) |
|
90 | - ); |
|
91 | - } |
|
92 | - |
|
93 | - public function warning($message, array $context = []) { |
|
94 | - $this->inner->warning( |
|
95 | - $message, |
|
96 | - array_merge( |
|
97 | - [ |
|
98 | - 'app' => $this->appId, |
|
99 | - ], |
|
100 | - $context |
|
101 | - ) |
|
102 | - ); |
|
103 | - } |
|
104 | - |
|
105 | - public function notice($message, array $context = []) { |
|
106 | - $this->inner->notice( |
|
107 | - $message, |
|
108 | - array_merge( |
|
109 | - [ |
|
110 | - 'app' => $this->appId, |
|
111 | - ], |
|
112 | - $context |
|
113 | - ) |
|
114 | - ); |
|
115 | - } |
|
116 | - |
|
117 | - public function info($message, array $context = []) { |
|
118 | - $this->inner->info( |
|
119 | - $message, |
|
120 | - array_merge( |
|
121 | - [ |
|
122 | - 'app' => $this->appId, |
|
123 | - ], |
|
124 | - $context |
|
125 | - ) |
|
126 | - ); |
|
127 | - } |
|
128 | - |
|
129 | - public function debug($message, array $context = []) { |
|
130 | - $this->inner->debug( |
|
131 | - $message, |
|
132 | - array_merge( |
|
133 | - [ |
|
134 | - 'app' => $this->appId, |
|
135 | - ], |
|
136 | - $context |
|
137 | - ) |
|
138 | - ); |
|
139 | - } |
|
140 | - |
|
141 | - public function log($level, $message, array $context = []) { |
|
142 | - $this->inner->log( |
|
143 | - $message, |
|
144 | - array_merge( |
|
145 | - [ |
|
146 | - 'app' => $this->appId, |
|
147 | - ], |
|
148 | - $context |
|
149 | - ) |
|
150 | - ); |
|
151 | - } |
|
33 | + /** @var LoggerInterface */ |
|
34 | + private $inner; |
|
35 | + |
|
36 | + /** @var string */ |
|
37 | + private $appId; |
|
38 | + |
|
39 | + public function __construct(LoggerInterface $inner, |
|
40 | + string $appId) { |
|
41 | + $this->inner = $inner; |
|
42 | + $this->appId = $appId; |
|
43 | + } |
|
44 | + |
|
45 | + public function emergency($message, array $context = []) { |
|
46 | + $this->inner->emergency( |
|
47 | + $message, |
|
48 | + array_merge( |
|
49 | + [ |
|
50 | + 'app' => $this->appId, |
|
51 | + ], |
|
52 | + $context |
|
53 | + ) |
|
54 | + ); |
|
55 | + } |
|
56 | + |
|
57 | + public function alert($message, array $context = []) { |
|
58 | + $this->inner->alert( |
|
59 | + $message, |
|
60 | + array_merge( |
|
61 | + [ |
|
62 | + 'app' => $this->appId, |
|
63 | + ], |
|
64 | + $context |
|
65 | + ) |
|
66 | + ); |
|
67 | + } |
|
68 | + |
|
69 | + public function critical($message, array $context = []) { |
|
70 | + $this->inner->critical( |
|
71 | + $message, |
|
72 | + array_merge( |
|
73 | + [ |
|
74 | + 'app' => $this->appId, |
|
75 | + ], |
|
76 | + $context |
|
77 | + ) |
|
78 | + ); |
|
79 | + } |
|
80 | + |
|
81 | + public function error($message, array $context = []) { |
|
82 | + $this->inner->error( |
|
83 | + $message, |
|
84 | + array_merge( |
|
85 | + [ |
|
86 | + 'app' => $this->appId, |
|
87 | + ], |
|
88 | + $context |
|
89 | + ) |
|
90 | + ); |
|
91 | + } |
|
92 | + |
|
93 | + public function warning($message, array $context = []) { |
|
94 | + $this->inner->warning( |
|
95 | + $message, |
|
96 | + array_merge( |
|
97 | + [ |
|
98 | + 'app' => $this->appId, |
|
99 | + ], |
|
100 | + $context |
|
101 | + ) |
|
102 | + ); |
|
103 | + } |
|
104 | + |
|
105 | + public function notice($message, array $context = []) { |
|
106 | + $this->inner->notice( |
|
107 | + $message, |
|
108 | + array_merge( |
|
109 | + [ |
|
110 | + 'app' => $this->appId, |
|
111 | + ], |
|
112 | + $context |
|
113 | + ) |
|
114 | + ); |
|
115 | + } |
|
116 | + |
|
117 | + public function info($message, array $context = []) { |
|
118 | + $this->inner->info( |
|
119 | + $message, |
|
120 | + array_merge( |
|
121 | + [ |
|
122 | + 'app' => $this->appId, |
|
123 | + ], |
|
124 | + $context |
|
125 | + ) |
|
126 | + ); |
|
127 | + } |
|
128 | + |
|
129 | + public function debug($message, array $context = []) { |
|
130 | + $this->inner->debug( |
|
131 | + $message, |
|
132 | + array_merge( |
|
133 | + [ |
|
134 | + 'app' => $this->appId, |
|
135 | + ], |
|
136 | + $context |
|
137 | + ) |
|
138 | + ); |
|
139 | + } |
|
140 | + |
|
141 | + public function log($level, $message, array $context = []) { |
|
142 | + $this->inner->log( |
|
143 | + $message, |
|
144 | + array_merge( |
|
145 | + [ |
|
146 | + 'app' => $this->appId, |
|
147 | + ], |
|
148 | + $context |
|
149 | + ) |
|
150 | + ); |
|
151 | + } |
|
152 | 152 | } |
@@ -79,384 +79,384 @@ |
||
79 | 79 | */ |
80 | 80 | class DIContainer extends SimpleContainer implements IAppContainer { |
81 | 81 | |
82 | - /** |
|
83 | - * @var array |
|
84 | - */ |
|
85 | - private $middleWares = []; |
|
86 | - |
|
87 | - /** @var ServerContainer */ |
|
88 | - private $server; |
|
89 | - |
|
90 | - /** |
|
91 | - * Put your class dependencies in here |
|
92 | - * @param string $appName the name of the app |
|
93 | - * @param array $urlParams |
|
94 | - * @param ServerContainer|null $server |
|
95 | - */ |
|
96 | - public function __construct($appName, $urlParams = [], ServerContainer $server = null) { |
|
97 | - parent::__construct(); |
|
98 | - $this['AppName'] = $appName; |
|
99 | - $this['urlParams'] = $urlParams; |
|
100 | - |
|
101 | - $this->registerAlias('Request', IRequest::class); |
|
102 | - |
|
103 | - /** @var \OC\ServerContainer $server */ |
|
104 | - if ($server === null) { |
|
105 | - $server = \OC::$server; |
|
106 | - } |
|
107 | - $this->server = $server; |
|
108 | - $this->server->registerAppContainer($appName, $this); |
|
109 | - |
|
110 | - // aliases |
|
111 | - $this->registerAlias('appName', 'AppName'); |
|
112 | - $this->registerAlias('webRoot', 'WebRoot'); |
|
113 | - $this->registerAlias('userId', 'UserId'); |
|
114 | - |
|
115 | - /** |
|
116 | - * Core services |
|
117 | - */ |
|
118 | - $this->registerService(IOutput::class, function () { |
|
119 | - return new Output($this->getServer()->getWebRoot()); |
|
120 | - }); |
|
121 | - |
|
122 | - $this->registerService(Folder::class, function () { |
|
123 | - return $this->getServer()->getUserFolder(); |
|
124 | - }); |
|
125 | - |
|
126 | - $this->registerService(IAppData::class, function (ContainerInterface $c) { |
|
127 | - return $this->getServer()->getAppDataDir($c->get('AppName')); |
|
128 | - }); |
|
129 | - |
|
130 | - $this->registerService(IL10N::class, function (ContainerInterface $c) { |
|
131 | - return $this->getServer()->getL10N($c->get('AppName')); |
|
132 | - }); |
|
133 | - |
|
134 | - // Log wrappers |
|
135 | - $this->registerService(LoggerInterface::class, function (ContainerInterface $c) { |
|
136 | - return new ScopedPsrLogger( |
|
137 | - $c->get(PsrLoggerAdapter::class), |
|
138 | - $c->get('AppName') |
|
139 | - ); |
|
140 | - }); |
|
141 | - $this->registerService(ILogger::class, function (ContainerInterface $c) { |
|
142 | - return new OC\AppFramework\Logger($this->server->query(ILogger::class), $c->get('AppName')); |
|
143 | - }); |
|
144 | - |
|
145 | - $this->registerService(IServerContainer::class, function () { |
|
146 | - return $this->getServer(); |
|
147 | - }); |
|
148 | - $this->registerAlias('ServerContainer', IServerContainer::class); |
|
149 | - |
|
150 | - $this->registerService(\OCP\WorkflowEngine\IManager::class, function (ContainerInterface $c) { |
|
151 | - return $c->get(Manager::class); |
|
152 | - }); |
|
153 | - |
|
154 | - $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
155 | - return $c; |
|
156 | - }); |
|
157 | - $this->registerAlias(IAppContainer::class, ContainerInterface::class); |
|
158 | - |
|
159 | - // commonly used attributes |
|
160 | - $this->registerService('UserId', function (ContainerInterface $c) { |
|
161 | - return $c->get(IUserSession::class)->getSession()->get('user_id'); |
|
162 | - }); |
|
163 | - |
|
164 | - $this->registerService('WebRoot', function (ContainerInterface $c) { |
|
165 | - return $c->get(IServerContainer::class)->getWebRoot(); |
|
166 | - }); |
|
167 | - |
|
168 | - $this->registerService('OC_Defaults', function (ContainerInterface $c) { |
|
169 | - return $c->get(IServerContainer::class)->getThemingDefaults(); |
|
170 | - }); |
|
171 | - |
|
172 | - $this->registerService('Protocol', function (ContainerInterface $c) { |
|
173 | - /** @var \OC\Server $server */ |
|
174 | - $server = $c->get(IServerContainer::class); |
|
175 | - $protocol = $server->getRequest()->getHttpProtocol(); |
|
176 | - return new Http($_SERVER, $protocol); |
|
177 | - }); |
|
178 | - |
|
179 | - $this->registerService('Dispatcher', function (ContainerInterface $c) { |
|
180 | - return new Dispatcher( |
|
181 | - $c->get('Protocol'), |
|
182 | - $c->get(MiddlewareDispatcher::class), |
|
183 | - $c->get(IControllerMethodReflector::class), |
|
184 | - $c->get(IRequest::class) |
|
185 | - ); |
|
186 | - }); |
|
187 | - |
|
188 | - /** |
|
189 | - * App Framework default arguments |
|
190 | - */ |
|
191 | - $this->registerParameter('corsMethods', 'PUT, POST, GET, DELETE, PATCH'); |
|
192 | - $this->registerParameter('corsAllowedHeaders', 'Authorization, Content-Type, Accept'); |
|
193 | - $this->registerParameter('corsMaxAge', 1728000); |
|
194 | - |
|
195 | - /** |
|
196 | - * Middleware |
|
197 | - */ |
|
198 | - $this->registerAlias('MiddlewareDispatcher', MiddlewareDispatcher::class); |
|
199 | - $this->registerService(MiddlewareDispatcher::class, function (ContainerInterface $c) { |
|
200 | - $server = $this->getServer(); |
|
201 | - |
|
202 | - $dispatcher = new MiddlewareDispatcher(); |
|
203 | - |
|
204 | - $dispatcher->registerMiddleware( |
|
205 | - $c->get(OC\AppFramework\Middleware\CompressionMiddleware::class) |
|
206 | - ); |
|
207 | - |
|
208 | - $dispatcher->registerMiddleware($c->get(OC\AppFramework\Middleware\NotModifiedMiddleware::class)); |
|
209 | - |
|
210 | - $dispatcher->registerMiddleware( |
|
211 | - $c->get(OC\AppFramework\Middleware\Security\ReloadExecutionMiddleware::class) |
|
212 | - ); |
|
213 | - |
|
214 | - $dispatcher->registerMiddleware( |
|
215 | - new OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware( |
|
216 | - $c->get(IRequest::class), |
|
217 | - $c->get(IControllerMethodReflector::class) |
|
218 | - ) |
|
219 | - ); |
|
220 | - $dispatcher->registerMiddleware( |
|
221 | - new CORSMiddleware( |
|
222 | - $c->get(IRequest::class), |
|
223 | - $c->get(IControllerMethodReflector::class), |
|
224 | - $c->get(IUserSession::class), |
|
225 | - $c->get(OC\Security\Bruteforce\Throttler::class) |
|
226 | - ) |
|
227 | - ); |
|
228 | - $dispatcher->registerMiddleware( |
|
229 | - new OCSMiddleware( |
|
230 | - $c->get(IRequest::class) |
|
231 | - ) |
|
232 | - ); |
|
233 | - |
|
234 | - $securityMiddleware = new SecurityMiddleware( |
|
235 | - $c->get(IRequest::class), |
|
236 | - $c->get(IControllerMethodReflector::class), |
|
237 | - $c->get(INavigationManager::class), |
|
238 | - $c->get(IURLGenerator::class), |
|
239 | - $server->query(ILogger::class), |
|
240 | - $c->get('AppName'), |
|
241 | - $server->getUserSession()->isLoggedIn(), |
|
242 | - $server->getGroupManager()->isAdmin($this->getUserId()), |
|
243 | - $server->getUserSession()->getUser() !== null && $server->query(ISubAdmin::class)->isSubAdmin($server->getUserSession()->getUser()), |
|
244 | - $server->getAppManager(), |
|
245 | - $server->getL10N('lib') |
|
246 | - ); |
|
247 | - $dispatcher->registerMiddleware($securityMiddleware); |
|
248 | - $dispatcher->registerMiddleware( |
|
249 | - new OC\AppFramework\Middleware\Security\CSPMiddleware( |
|
250 | - $server->query(OC\Security\CSP\ContentSecurityPolicyManager::class), |
|
251 | - $server->query(OC\Security\CSP\ContentSecurityPolicyNonceManager::class), |
|
252 | - $server->query(OC\Security\CSRF\CsrfTokenManager::class) |
|
253 | - ) |
|
254 | - ); |
|
255 | - $dispatcher->registerMiddleware( |
|
256 | - $server->query(OC\AppFramework\Middleware\Security\FeaturePolicyMiddleware::class) |
|
257 | - ); |
|
258 | - $dispatcher->registerMiddleware( |
|
259 | - new OC\AppFramework\Middleware\Security\PasswordConfirmationMiddleware( |
|
260 | - $c->get(IControllerMethodReflector::class), |
|
261 | - $c->get(ISession::class), |
|
262 | - $c->get(IUserSession::class), |
|
263 | - $c->get(ITimeFactory::class) |
|
264 | - ) |
|
265 | - ); |
|
266 | - $dispatcher->registerMiddleware( |
|
267 | - new TwoFactorMiddleware( |
|
268 | - $c->get(OC\Authentication\TwoFactorAuth\Manager::class), |
|
269 | - $c->get(IUserSession::class), |
|
270 | - $c->get(ISession::class), |
|
271 | - $c->get(IURLGenerator::class), |
|
272 | - $c->get(IControllerMethodReflector::class), |
|
273 | - $c->get(IRequest::class) |
|
274 | - ) |
|
275 | - ); |
|
276 | - $dispatcher->registerMiddleware( |
|
277 | - new OC\AppFramework\Middleware\Security\BruteForceMiddleware( |
|
278 | - $c->get(IControllerMethodReflector::class), |
|
279 | - $c->get(OC\Security\Bruteforce\Throttler::class), |
|
280 | - $c->get(IRequest::class) |
|
281 | - ) |
|
282 | - ); |
|
283 | - $dispatcher->registerMiddleware( |
|
284 | - new RateLimitingMiddleware( |
|
285 | - $c->get(IRequest::class), |
|
286 | - $c->get(IUserSession::class), |
|
287 | - $c->get(IControllerMethodReflector::class), |
|
288 | - $c->get(OC\Security\RateLimiting\Limiter::class) |
|
289 | - ) |
|
290 | - ); |
|
291 | - $dispatcher->registerMiddleware( |
|
292 | - new OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware( |
|
293 | - $c->get(IRequest::class), |
|
294 | - $c->get(ISession::class), |
|
295 | - $c->get(\OCP\IConfig::class) |
|
296 | - ) |
|
297 | - ); |
|
298 | - $dispatcher->registerMiddleware( |
|
299 | - $c->get(\OC\AppFramework\Middleware\AdditionalScriptsMiddleware::class) |
|
300 | - ); |
|
301 | - |
|
302 | - foreach ($this->middleWares as $middleWare) { |
|
303 | - $dispatcher->registerMiddleware($c->get($middleWare)); |
|
304 | - } |
|
305 | - |
|
306 | - $dispatcher->registerMiddleware( |
|
307 | - new SessionMiddleware( |
|
308 | - $c->get(IControllerMethodReflector::class), |
|
309 | - $c->get(ISession::class) |
|
310 | - ) |
|
311 | - ); |
|
312 | - return $dispatcher; |
|
313 | - }); |
|
314 | - |
|
315 | - $this->registerService(IAppConfig::class, function (ContainerInterface $c) { |
|
316 | - return new OC\AppFramework\Services\AppConfig( |
|
317 | - $c->get(IConfig::class), |
|
318 | - $c->get('AppName') |
|
319 | - ); |
|
320 | - }); |
|
321 | - $this->registerService(IInitialState::class, function (ContainerInterface $c) { |
|
322 | - return new OC\AppFramework\Services\InitialState( |
|
323 | - $c->get(IInitialStateService::class), |
|
324 | - $c->get('AppName') |
|
325 | - ); |
|
326 | - }); |
|
327 | - } |
|
328 | - |
|
329 | - /** |
|
330 | - * @return \OCP\IServerContainer |
|
331 | - */ |
|
332 | - public function getServer() { |
|
333 | - return $this->server; |
|
334 | - } |
|
335 | - |
|
336 | - /** |
|
337 | - * @param string $middleWare |
|
338 | - * @return boolean|null |
|
339 | - */ |
|
340 | - public function registerMiddleWare($middleWare) { |
|
341 | - if (in_array($middleWare, $this->middleWares, true) !== false) { |
|
342 | - return false; |
|
343 | - } |
|
344 | - $this->middleWares[] = $middleWare; |
|
345 | - } |
|
346 | - |
|
347 | - /** |
|
348 | - * used to return the appname of the set application |
|
349 | - * @return string the name of your application |
|
350 | - */ |
|
351 | - public function getAppName() { |
|
352 | - return $this->query('AppName'); |
|
353 | - } |
|
354 | - |
|
355 | - /** |
|
356 | - * @deprecated use IUserSession->isLoggedIn() |
|
357 | - * @return boolean |
|
358 | - */ |
|
359 | - public function isLoggedIn() { |
|
360 | - return \OC::$server->getUserSession()->isLoggedIn(); |
|
361 | - } |
|
362 | - |
|
363 | - /** |
|
364 | - * @deprecated use IGroupManager->isAdmin($userId) |
|
365 | - * @return boolean |
|
366 | - */ |
|
367 | - public function isAdminUser() { |
|
368 | - $uid = $this->getUserId(); |
|
369 | - return \OC_User::isAdminUser($uid); |
|
370 | - } |
|
371 | - |
|
372 | - private function getUserId() { |
|
373 | - return $this->getServer()->getSession()->get('user_id'); |
|
374 | - } |
|
375 | - |
|
376 | - /** |
|
377 | - * @deprecated use the ILogger instead |
|
378 | - * @param string $message |
|
379 | - * @param string $level |
|
380 | - * @return mixed |
|
381 | - */ |
|
382 | - public function log($message, $level) { |
|
383 | - switch ($level) { |
|
384 | - case 'debug': |
|
385 | - $level = ILogger::DEBUG; |
|
386 | - break; |
|
387 | - case 'info': |
|
388 | - $level = ILogger::INFO; |
|
389 | - break; |
|
390 | - case 'warn': |
|
391 | - $level = ILogger::WARN; |
|
392 | - break; |
|
393 | - case 'fatal': |
|
394 | - $level = ILogger::FATAL; |
|
395 | - break; |
|
396 | - default: |
|
397 | - $level = ILogger::ERROR; |
|
398 | - break; |
|
399 | - } |
|
400 | - \OCP\Util::writeLog($this->getAppName(), $message, $level); |
|
401 | - } |
|
402 | - |
|
403 | - /** |
|
404 | - * Register a capability |
|
405 | - * |
|
406 | - * @param string $serviceName e.g. 'OCA\Files\Capabilities' |
|
407 | - */ |
|
408 | - public function registerCapability($serviceName) { |
|
409 | - $this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) { |
|
410 | - return $this->query($serviceName); |
|
411 | - }); |
|
412 | - } |
|
413 | - |
|
414 | - public function has($id): bool { |
|
415 | - if (parent::has($id)) { |
|
416 | - return true; |
|
417 | - } |
|
418 | - |
|
419 | - if ($this->server->has($id, true)) { |
|
420 | - return true; |
|
421 | - } |
|
422 | - |
|
423 | - return false; |
|
424 | - } |
|
425 | - |
|
426 | - public function query(string $name, bool $autoload = true) { |
|
427 | - try { |
|
428 | - return $this->queryNoFallback($name); |
|
429 | - } catch (QueryException $firstException) { |
|
430 | - try { |
|
431 | - return $this->getServer()->query($name, $autoload); |
|
432 | - } catch (QueryException $secondException) { |
|
433 | - if ($firstException->getCode() === 1) { |
|
434 | - throw $secondException; |
|
435 | - } |
|
436 | - throw $firstException; |
|
437 | - } |
|
438 | - } |
|
439 | - } |
|
440 | - |
|
441 | - /** |
|
442 | - * @param string $name |
|
443 | - * @return mixed |
|
444 | - * @throws QueryException if the query could not be resolved |
|
445 | - */ |
|
446 | - public function queryNoFallback($name) { |
|
447 | - $name = $this->sanitizeName($name); |
|
448 | - |
|
449 | - if ($this->offsetExists($name)) { |
|
450 | - return parent::query($name); |
|
451 | - } elseif ($this['AppName'] === 'settings' && strpos($name, 'OC\\Settings\\') === 0) { |
|
452 | - return parent::query($name); |
|
453 | - } elseif ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { |
|
454 | - return parent::query($name); |
|
455 | - } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { |
|
456 | - return parent::query($name); |
|
457 | - } |
|
458 | - |
|
459 | - throw new QueryException('Could not resolve ' . $name . '!' . |
|
460 | - ' Class can not be instantiated', 1); |
|
461 | - } |
|
82 | + /** |
|
83 | + * @var array |
|
84 | + */ |
|
85 | + private $middleWares = []; |
|
86 | + |
|
87 | + /** @var ServerContainer */ |
|
88 | + private $server; |
|
89 | + |
|
90 | + /** |
|
91 | + * Put your class dependencies in here |
|
92 | + * @param string $appName the name of the app |
|
93 | + * @param array $urlParams |
|
94 | + * @param ServerContainer|null $server |
|
95 | + */ |
|
96 | + public function __construct($appName, $urlParams = [], ServerContainer $server = null) { |
|
97 | + parent::__construct(); |
|
98 | + $this['AppName'] = $appName; |
|
99 | + $this['urlParams'] = $urlParams; |
|
100 | + |
|
101 | + $this->registerAlias('Request', IRequest::class); |
|
102 | + |
|
103 | + /** @var \OC\ServerContainer $server */ |
|
104 | + if ($server === null) { |
|
105 | + $server = \OC::$server; |
|
106 | + } |
|
107 | + $this->server = $server; |
|
108 | + $this->server->registerAppContainer($appName, $this); |
|
109 | + |
|
110 | + // aliases |
|
111 | + $this->registerAlias('appName', 'AppName'); |
|
112 | + $this->registerAlias('webRoot', 'WebRoot'); |
|
113 | + $this->registerAlias('userId', 'UserId'); |
|
114 | + |
|
115 | + /** |
|
116 | + * Core services |
|
117 | + */ |
|
118 | + $this->registerService(IOutput::class, function () { |
|
119 | + return new Output($this->getServer()->getWebRoot()); |
|
120 | + }); |
|
121 | + |
|
122 | + $this->registerService(Folder::class, function () { |
|
123 | + return $this->getServer()->getUserFolder(); |
|
124 | + }); |
|
125 | + |
|
126 | + $this->registerService(IAppData::class, function (ContainerInterface $c) { |
|
127 | + return $this->getServer()->getAppDataDir($c->get('AppName')); |
|
128 | + }); |
|
129 | + |
|
130 | + $this->registerService(IL10N::class, function (ContainerInterface $c) { |
|
131 | + return $this->getServer()->getL10N($c->get('AppName')); |
|
132 | + }); |
|
133 | + |
|
134 | + // Log wrappers |
|
135 | + $this->registerService(LoggerInterface::class, function (ContainerInterface $c) { |
|
136 | + return new ScopedPsrLogger( |
|
137 | + $c->get(PsrLoggerAdapter::class), |
|
138 | + $c->get('AppName') |
|
139 | + ); |
|
140 | + }); |
|
141 | + $this->registerService(ILogger::class, function (ContainerInterface $c) { |
|
142 | + return new OC\AppFramework\Logger($this->server->query(ILogger::class), $c->get('AppName')); |
|
143 | + }); |
|
144 | + |
|
145 | + $this->registerService(IServerContainer::class, function () { |
|
146 | + return $this->getServer(); |
|
147 | + }); |
|
148 | + $this->registerAlias('ServerContainer', IServerContainer::class); |
|
149 | + |
|
150 | + $this->registerService(\OCP\WorkflowEngine\IManager::class, function (ContainerInterface $c) { |
|
151 | + return $c->get(Manager::class); |
|
152 | + }); |
|
153 | + |
|
154 | + $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
155 | + return $c; |
|
156 | + }); |
|
157 | + $this->registerAlias(IAppContainer::class, ContainerInterface::class); |
|
158 | + |
|
159 | + // commonly used attributes |
|
160 | + $this->registerService('UserId', function (ContainerInterface $c) { |
|
161 | + return $c->get(IUserSession::class)->getSession()->get('user_id'); |
|
162 | + }); |
|
163 | + |
|
164 | + $this->registerService('WebRoot', function (ContainerInterface $c) { |
|
165 | + return $c->get(IServerContainer::class)->getWebRoot(); |
|
166 | + }); |
|
167 | + |
|
168 | + $this->registerService('OC_Defaults', function (ContainerInterface $c) { |
|
169 | + return $c->get(IServerContainer::class)->getThemingDefaults(); |
|
170 | + }); |
|
171 | + |
|
172 | + $this->registerService('Protocol', function (ContainerInterface $c) { |
|
173 | + /** @var \OC\Server $server */ |
|
174 | + $server = $c->get(IServerContainer::class); |
|
175 | + $protocol = $server->getRequest()->getHttpProtocol(); |
|
176 | + return new Http($_SERVER, $protocol); |
|
177 | + }); |
|
178 | + |
|
179 | + $this->registerService('Dispatcher', function (ContainerInterface $c) { |
|
180 | + return new Dispatcher( |
|
181 | + $c->get('Protocol'), |
|
182 | + $c->get(MiddlewareDispatcher::class), |
|
183 | + $c->get(IControllerMethodReflector::class), |
|
184 | + $c->get(IRequest::class) |
|
185 | + ); |
|
186 | + }); |
|
187 | + |
|
188 | + /** |
|
189 | + * App Framework default arguments |
|
190 | + */ |
|
191 | + $this->registerParameter('corsMethods', 'PUT, POST, GET, DELETE, PATCH'); |
|
192 | + $this->registerParameter('corsAllowedHeaders', 'Authorization, Content-Type, Accept'); |
|
193 | + $this->registerParameter('corsMaxAge', 1728000); |
|
194 | + |
|
195 | + /** |
|
196 | + * Middleware |
|
197 | + */ |
|
198 | + $this->registerAlias('MiddlewareDispatcher', MiddlewareDispatcher::class); |
|
199 | + $this->registerService(MiddlewareDispatcher::class, function (ContainerInterface $c) { |
|
200 | + $server = $this->getServer(); |
|
201 | + |
|
202 | + $dispatcher = new MiddlewareDispatcher(); |
|
203 | + |
|
204 | + $dispatcher->registerMiddleware( |
|
205 | + $c->get(OC\AppFramework\Middleware\CompressionMiddleware::class) |
|
206 | + ); |
|
207 | + |
|
208 | + $dispatcher->registerMiddleware($c->get(OC\AppFramework\Middleware\NotModifiedMiddleware::class)); |
|
209 | + |
|
210 | + $dispatcher->registerMiddleware( |
|
211 | + $c->get(OC\AppFramework\Middleware\Security\ReloadExecutionMiddleware::class) |
|
212 | + ); |
|
213 | + |
|
214 | + $dispatcher->registerMiddleware( |
|
215 | + new OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware( |
|
216 | + $c->get(IRequest::class), |
|
217 | + $c->get(IControllerMethodReflector::class) |
|
218 | + ) |
|
219 | + ); |
|
220 | + $dispatcher->registerMiddleware( |
|
221 | + new CORSMiddleware( |
|
222 | + $c->get(IRequest::class), |
|
223 | + $c->get(IControllerMethodReflector::class), |
|
224 | + $c->get(IUserSession::class), |
|
225 | + $c->get(OC\Security\Bruteforce\Throttler::class) |
|
226 | + ) |
|
227 | + ); |
|
228 | + $dispatcher->registerMiddleware( |
|
229 | + new OCSMiddleware( |
|
230 | + $c->get(IRequest::class) |
|
231 | + ) |
|
232 | + ); |
|
233 | + |
|
234 | + $securityMiddleware = new SecurityMiddleware( |
|
235 | + $c->get(IRequest::class), |
|
236 | + $c->get(IControllerMethodReflector::class), |
|
237 | + $c->get(INavigationManager::class), |
|
238 | + $c->get(IURLGenerator::class), |
|
239 | + $server->query(ILogger::class), |
|
240 | + $c->get('AppName'), |
|
241 | + $server->getUserSession()->isLoggedIn(), |
|
242 | + $server->getGroupManager()->isAdmin($this->getUserId()), |
|
243 | + $server->getUserSession()->getUser() !== null && $server->query(ISubAdmin::class)->isSubAdmin($server->getUserSession()->getUser()), |
|
244 | + $server->getAppManager(), |
|
245 | + $server->getL10N('lib') |
|
246 | + ); |
|
247 | + $dispatcher->registerMiddleware($securityMiddleware); |
|
248 | + $dispatcher->registerMiddleware( |
|
249 | + new OC\AppFramework\Middleware\Security\CSPMiddleware( |
|
250 | + $server->query(OC\Security\CSP\ContentSecurityPolicyManager::class), |
|
251 | + $server->query(OC\Security\CSP\ContentSecurityPolicyNonceManager::class), |
|
252 | + $server->query(OC\Security\CSRF\CsrfTokenManager::class) |
|
253 | + ) |
|
254 | + ); |
|
255 | + $dispatcher->registerMiddleware( |
|
256 | + $server->query(OC\AppFramework\Middleware\Security\FeaturePolicyMiddleware::class) |
|
257 | + ); |
|
258 | + $dispatcher->registerMiddleware( |
|
259 | + new OC\AppFramework\Middleware\Security\PasswordConfirmationMiddleware( |
|
260 | + $c->get(IControllerMethodReflector::class), |
|
261 | + $c->get(ISession::class), |
|
262 | + $c->get(IUserSession::class), |
|
263 | + $c->get(ITimeFactory::class) |
|
264 | + ) |
|
265 | + ); |
|
266 | + $dispatcher->registerMiddleware( |
|
267 | + new TwoFactorMiddleware( |
|
268 | + $c->get(OC\Authentication\TwoFactorAuth\Manager::class), |
|
269 | + $c->get(IUserSession::class), |
|
270 | + $c->get(ISession::class), |
|
271 | + $c->get(IURLGenerator::class), |
|
272 | + $c->get(IControllerMethodReflector::class), |
|
273 | + $c->get(IRequest::class) |
|
274 | + ) |
|
275 | + ); |
|
276 | + $dispatcher->registerMiddleware( |
|
277 | + new OC\AppFramework\Middleware\Security\BruteForceMiddleware( |
|
278 | + $c->get(IControllerMethodReflector::class), |
|
279 | + $c->get(OC\Security\Bruteforce\Throttler::class), |
|
280 | + $c->get(IRequest::class) |
|
281 | + ) |
|
282 | + ); |
|
283 | + $dispatcher->registerMiddleware( |
|
284 | + new RateLimitingMiddleware( |
|
285 | + $c->get(IRequest::class), |
|
286 | + $c->get(IUserSession::class), |
|
287 | + $c->get(IControllerMethodReflector::class), |
|
288 | + $c->get(OC\Security\RateLimiting\Limiter::class) |
|
289 | + ) |
|
290 | + ); |
|
291 | + $dispatcher->registerMiddleware( |
|
292 | + new OC\AppFramework\Middleware\PublicShare\PublicShareMiddleware( |
|
293 | + $c->get(IRequest::class), |
|
294 | + $c->get(ISession::class), |
|
295 | + $c->get(\OCP\IConfig::class) |
|
296 | + ) |
|
297 | + ); |
|
298 | + $dispatcher->registerMiddleware( |
|
299 | + $c->get(\OC\AppFramework\Middleware\AdditionalScriptsMiddleware::class) |
|
300 | + ); |
|
301 | + |
|
302 | + foreach ($this->middleWares as $middleWare) { |
|
303 | + $dispatcher->registerMiddleware($c->get($middleWare)); |
|
304 | + } |
|
305 | + |
|
306 | + $dispatcher->registerMiddleware( |
|
307 | + new SessionMiddleware( |
|
308 | + $c->get(IControllerMethodReflector::class), |
|
309 | + $c->get(ISession::class) |
|
310 | + ) |
|
311 | + ); |
|
312 | + return $dispatcher; |
|
313 | + }); |
|
314 | + |
|
315 | + $this->registerService(IAppConfig::class, function (ContainerInterface $c) { |
|
316 | + return new OC\AppFramework\Services\AppConfig( |
|
317 | + $c->get(IConfig::class), |
|
318 | + $c->get('AppName') |
|
319 | + ); |
|
320 | + }); |
|
321 | + $this->registerService(IInitialState::class, function (ContainerInterface $c) { |
|
322 | + return new OC\AppFramework\Services\InitialState( |
|
323 | + $c->get(IInitialStateService::class), |
|
324 | + $c->get('AppName') |
|
325 | + ); |
|
326 | + }); |
|
327 | + } |
|
328 | + |
|
329 | + /** |
|
330 | + * @return \OCP\IServerContainer |
|
331 | + */ |
|
332 | + public function getServer() { |
|
333 | + return $this->server; |
|
334 | + } |
|
335 | + |
|
336 | + /** |
|
337 | + * @param string $middleWare |
|
338 | + * @return boolean|null |
|
339 | + */ |
|
340 | + public function registerMiddleWare($middleWare) { |
|
341 | + if (in_array($middleWare, $this->middleWares, true) !== false) { |
|
342 | + return false; |
|
343 | + } |
|
344 | + $this->middleWares[] = $middleWare; |
|
345 | + } |
|
346 | + |
|
347 | + /** |
|
348 | + * used to return the appname of the set application |
|
349 | + * @return string the name of your application |
|
350 | + */ |
|
351 | + public function getAppName() { |
|
352 | + return $this->query('AppName'); |
|
353 | + } |
|
354 | + |
|
355 | + /** |
|
356 | + * @deprecated use IUserSession->isLoggedIn() |
|
357 | + * @return boolean |
|
358 | + */ |
|
359 | + public function isLoggedIn() { |
|
360 | + return \OC::$server->getUserSession()->isLoggedIn(); |
|
361 | + } |
|
362 | + |
|
363 | + /** |
|
364 | + * @deprecated use IGroupManager->isAdmin($userId) |
|
365 | + * @return boolean |
|
366 | + */ |
|
367 | + public function isAdminUser() { |
|
368 | + $uid = $this->getUserId(); |
|
369 | + return \OC_User::isAdminUser($uid); |
|
370 | + } |
|
371 | + |
|
372 | + private function getUserId() { |
|
373 | + return $this->getServer()->getSession()->get('user_id'); |
|
374 | + } |
|
375 | + |
|
376 | + /** |
|
377 | + * @deprecated use the ILogger instead |
|
378 | + * @param string $message |
|
379 | + * @param string $level |
|
380 | + * @return mixed |
|
381 | + */ |
|
382 | + public function log($message, $level) { |
|
383 | + switch ($level) { |
|
384 | + case 'debug': |
|
385 | + $level = ILogger::DEBUG; |
|
386 | + break; |
|
387 | + case 'info': |
|
388 | + $level = ILogger::INFO; |
|
389 | + break; |
|
390 | + case 'warn': |
|
391 | + $level = ILogger::WARN; |
|
392 | + break; |
|
393 | + case 'fatal': |
|
394 | + $level = ILogger::FATAL; |
|
395 | + break; |
|
396 | + default: |
|
397 | + $level = ILogger::ERROR; |
|
398 | + break; |
|
399 | + } |
|
400 | + \OCP\Util::writeLog($this->getAppName(), $message, $level); |
|
401 | + } |
|
402 | + |
|
403 | + /** |
|
404 | + * Register a capability |
|
405 | + * |
|
406 | + * @param string $serviceName e.g. 'OCA\Files\Capabilities' |
|
407 | + */ |
|
408 | + public function registerCapability($serviceName) { |
|
409 | + $this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) { |
|
410 | + return $this->query($serviceName); |
|
411 | + }); |
|
412 | + } |
|
413 | + |
|
414 | + public function has($id): bool { |
|
415 | + if (parent::has($id)) { |
|
416 | + return true; |
|
417 | + } |
|
418 | + |
|
419 | + if ($this->server->has($id, true)) { |
|
420 | + return true; |
|
421 | + } |
|
422 | + |
|
423 | + return false; |
|
424 | + } |
|
425 | + |
|
426 | + public function query(string $name, bool $autoload = true) { |
|
427 | + try { |
|
428 | + return $this->queryNoFallback($name); |
|
429 | + } catch (QueryException $firstException) { |
|
430 | + try { |
|
431 | + return $this->getServer()->query($name, $autoload); |
|
432 | + } catch (QueryException $secondException) { |
|
433 | + if ($firstException->getCode() === 1) { |
|
434 | + throw $secondException; |
|
435 | + } |
|
436 | + throw $firstException; |
|
437 | + } |
|
438 | + } |
|
439 | + } |
|
440 | + |
|
441 | + /** |
|
442 | + * @param string $name |
|
443 | + * @return mixed |
|
444 | + * @throws QueryException if the query could not be resolved |
|
445 | + */ |
|
446 | + public function queryNoFallback($name) { |
|
447 | + $name = $this->sanitizeName($name); |
|
448 | + |
|
449 | + if ($this->offsetExists($name)) { |
|
450 | + return parent::query($name); |
|
451 | + } elseif ($this['AppName'] === 'settings' && strpos($name, 'OC\\Settings\\') === 0) { |
|
452 | + return parent::query($name); |
|
453 | + } elseif ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { |
|
454 | + return parent::query($name); |
|
455 | + } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { |
|
456 | + return parent::query($name); |
|
457 | + } |
|
458 | + |
|
459 | + throw new QueryException('Could not resolve ' . $name . '!' . |
|
460 | + ' Class can not be instantiated', 1); |
|
461 | + } |
|
462 | 462 | } |
@@ -115,68 +115,68 @@ discard block |
||
115 | 115 | /** |
116 | 116 | * Core services |
117 | 117 | */ |
118 | - $this->registerService(IOutput::class, function () { |
|
118 | + $this->registerService(IOutput::class, function() { |
|
119 | 119 | return new Output($this->getServer()->getWebRoot()); |
120 | 120 | }); |
121 | 121 | |
122 | - $this->registerService(Folder::class, function () { |
|
122 | + $this->registerService(Folder::class, function() { |
|
123 | 123 | return $this->getServer()->getUserFolder(); |
124 | 124 | }); |
125 | 125 | |
126 | - $this->registerService(IAppData::class, function (ContainerInterface $c) { |
|
126 | + $this->registerService(IAppData::class, function(ContainerInterface $c) { |
|
127 | 127 | return $this->getServer()->getAppDataDir($c->get('AppName')); |
128 | 128 | }); |
129 | 129 | |
130 | - $this->registerService(IL10N::class, function (ContainerInterface $c) { |
|
130 | + $this->registerService(IL10N::class, function(ContainerInterface $c) { |
|
131 | 131 | return $this->getServer()->getL10N($c->get('AppName')); |
132 | 132 | }); |
133 | 133 | |
134 | 134 | // Log wrappers |
135 | - $this->registerService(LoggerInterface::class, function (ContainerInterface $c) { |
|
135 | + $this->registerService(LoggerInterface::class, function(ContainerInterface $c) { |
|
136 | 136 | return new ScopedPsrLogger( |
137 | 137 | $c->get(PsrLoggerAdapter::class), |
138 | 138 | $c->get('AppName') |
139 | 139 | ); |
140 | 140 | }); |
141 | - $this->registerService(ILogger::class, function (ContainerInterface $c) { |
|
141 | + $this->registerService(ILogger::class, function(ContainerInterface $c) { |
|
142 | 142 | return new OC\AppFramework\Logger($this->server->query(ILogger::class), $c->get('AppName')); |
143 | 143 | }); |
144 | 144 | |
145 | - $this->registerService(IServerContainer::class, function () { |
|
145 | + $this->registerService(IServerContainer::class, function() { |
|
146 | 146 | return $this->getServer(); |
147 | 147 | }); |
148 | 148 | $this->registerAlias('ServerContainer', IServerContainer::class); |
149 | 149 | |
150 | - $this->registerService(\OCP\WorkflowEngine\IManager::class, function (ContainerInterface $c) { |
|
150 | + $this->registerService(\OCP\WorkflowEngine\IManager::class, function(ContainerInterface $c) { |
|
151 | 151 | return $c->get(Manager::class); |
152 | 152 | }); |
153 | 153 | |
154 | - $this->registerService(ContainerInterface::class, function (ContainerInterface $c) { |
|
154 | + $this->registerService(ContainerInterface::class, function(ContainerInterface $c) { |
|
155 | 155 | return $c; |
156 | 156 | }); |
157 | 157 | $this->registerAlias(IAppContainer::class, ContainerInterface::class); |
158 | 158 | |
159 | 159 | // commonly used attributes |
160 | - $this->registerService('UserId', function (ContainerInterface $c) { |
|
160 | + $this->registerService('UserId', function(ContainerInterface $c) { |
|
161 | 161 | return $c->get(IUserSession::class)->getSession()->get('user_id'); |
162 | 162 | }); |
163 | 163 | |
164 | - $this->registerService('WebRoot', function (ContainerInterface $c) { |
|
164 | + $this->registerService('WebRoot', function(ContainerInterface $c) { |
|
165 | 165 | return $c->get(IServerContainer::class)->getWebRoot(); |
166 | 166 | }); |
167 | 167 | |
168 | - $this->registerService('OC_Defaults', function (ContainerInterface $c) { |
|
168 | + $this->registerService('OC_Defaults', function(ContainerInterface $c) { |
|
169 | 169 | return $c->get(IServerContainer::class)->getThemingDefaults(); |
170 | 170 | }); |
171 | 171 | |
172 | - $this->registerService('Protocol', function (ContainerInterface $c) { |
|
172 | + $this->registerService('Protocol', function(ContainerInterface $c) { |
|
173 | 173 | /** @var \OC\Server $server */ |
174 | 174 | $server = $c->get(IServerContainer::class); |
175 | 175 | $protocol = $server->getRequest()->getHttpProtocol(); |
176 | 176 | return new Http($_SERVER, $protocol); |
177 | 177 | }); |
178 | 178 | |
179 | - $this->registerService('Dispatcher', function (ContainerInterface $c) { |
|
179 | + $this->registerService('Dispatcher', function(ContainerInterface $c) { |
|
180 | 180 | return new Dispatcher( |
181 | 181 | $c->get('Protocol'), |
182 | 182 | $c->get(MiddlewareDispatcher::class), |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * Middleware |
197 | 197 | */ |
198 | 198 | $this->registerAlias('MiddlewareDispatcher', MiddlewareDispatcher::class); |
199 | - $this->registerService(MiddlewareDispatcher::class, function (ContainerInterface $c) { |
|
199 | + $this->registerService(MiddlewareDispatcher::class, function(ContainerInterface $c) { |
|
200 | 200 | $server = $this->getServer(); |
201 | 201 | |
202 | 202 | $dispatcher = new MiddlewareDispatcher(); |
@@ -312,13 +312,13 @@ discard block |
||
312 | 312 | return $dispatcher; |
313 | 313 | }); |
314 | 314 | |
315 | - $this->registerService(IAppConfig::class, function (ContainerInterface $c) { |
|
315 | + $this->registerService(IAppConfig::class, function(ContainerInterface $c) { |
|
316 | 316 | return new OC\AppFramework\Services\AppConfig( |
317 | 317 | $c->get(IConfig::class), |
318 | 318 | $c->get('AppName') |
319 | 319 | ); |
320 | 320 | }); |
321 | - $this->registerService(IInitialState::class, function (ContainerInterface $c) { |
|
321 | + $this->registerService(IInitialState::class, function(ContainerInterface $c) { |
|
322 | 322 | return new OC\AppFramework\Services\InitialState( |
323 | 323 | $c->get(IInitialStateService::class), |
324 | 324 | $c->get('AppName') |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | * @param string $serviceName e.g. 'OCA\Files\Capabilities' |
407 | 407 | */ |
408 | 408 | public function registerCapability($serviceName) { |
409 | - $this->query('OC\CapabilitiesManager')->registerCapability(function () use ($serviceName) { |
|
409 | + $this->query('OC\CapabilitiesManager')->registerCapability(function() use ($serviceName) { |
|
410 | 410 | return $this->query($serviceName); |
411 | 411 | }); |
412 | 412 | } |
@@ -452,11 +452,11 @@ discard block |
||
452 | 452 | return parent::query($name); |
453 | 453 | } elseif ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { |
454 | 454 | return parent::query($name); |
455 | - } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { |
|
455 | + } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']).'\\') === 0) { |
|
456 | 456 | return parent::query($name); |
457 | 457 | } |
458 | 458 | |
459 | - throw new QueryException('Could not resolve ' . $name . '!' . |
|
459 | + throw new QueryException('Could not resolve '.$name.'!'. |
|
460 | 460 | ' Class can not be instantiated', 1); |
461 | 461 | } |
462 | 462 | } |