Completed
Pull Request — master (#7870)
by Joas
22:20
created
lib/private/AppFramework/DependencyInjection/DIContainer.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 * @param array $urlParams
80 80
 	 * @param ServerContainer|null $server
81 81
 	 */
82
-	public function __construct($appName, $urlParams = array(), ServerContainer $server = null){
82
+	public function __construct($appName, $urlParams = array(), ServerContainer $server = null) {
83 83
 		parent::__construct();
84 84
 		$this['AppName'] = $appName;
85 85
 		$this['urlParams'] = $urlParams;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 		/**
100 100
 		 * Core services
101 101
 		 */
102
-		$this->registerService(IOutput::class, function($c){
102
+		$this->registerService(IOutput::class, function($c) {
103 103
 			return new Output($this->getServer()->getWebRoot());
104 104
 		});
105 105
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 			return $this->getServer()->getUserFolder();
108 108
 		});
109 109
 
110
-		$this->registerService(IAppData::class, function (SimpleContainer $c) {
110
+		$this->registerService(IAppData::class, function(SimpleContainer $c) {
111 111
 			return $this->getServer()->getAppDataDir($c->query('AppName'));
112 112
 		});
113 113
 
@@ -128,25 +128,25 @@  discard block
 block discarded – undo
128 128
 
129 129
 		$this->registerAlias(\OC\User\Session::class, \OCP\IUserSession::class);
130 130
 
131
-		$this->registerService(IServerContainer::class, function ($c) {
131
+		$this->registerService(IServerContainer::class, function($c) {
132 132
 			return $this->getServer();
133 133
 		});
134 134
 		$this->registerAlias('ServerContainer', IServerContainer::class);
135 135
 
136
-		$this->registerService(\OCP\WorkflowEngine\IManager::class, function ($c) {
136
+		$this->registerService(\OCP\WorkflowEngine\IManager::class, function($c) {
137 137
 			return $c->query('OCA\WorkflowEngine\Manager');
138 138
 		});
139 139
 
140
-		$this->registerService(\OCP\AppFramework\IAppContainer::class, function ($c) {
140
+		$this->registerService(\OCP\AppFramework\IAppContainer::class, function($c) {
141 141
 			return $c;
142 142
 		});
143 143
 
144 144
 		// commonly used attributes
145
-		$this->registerService('UserId', function ($c) {
145
+		$this->registerService('UserId', function($c) {
146 146
 			return $c->query('OCP\\IUserSession')->getSession()->get('user_id');
147 147
 		});
148 148
 
149
-		$this->registerService('WebRoot', function ($c) {
149
+		$this->registerService('WebRoot', function($c) {
150 150
 			return $c->query('ServerContainer')->getWebRoot();
151 151
 		});
152 152
 
@@ -154,15 +154,15 @@  discard block
 block discarded – undo
154 154
 			return Util::getDefaultEmailAddress('no-reply');
155 155
 		});
156 156
 
157
-		$this->registerService('OC_Defaults', function ($c) {
157
+		$this->registerService('OC_Defaults', function($c) {
158 158
 			return $c->getServer()->getThemingDefaults();
159 159
 		});
160 160
 
161
-		$this->registerService('OCP\Encryption\IManager', function ($c) {
161
+		$this->registerService('OCP\Encryption\IManager', function($c) {
162 162
 			return $this->getServer()->getEncryptionManager();
163 163
 		});
164 164
 
165
-		$this->registerService(IConfig::class, function ($c) {
165
+		$this->registerService(IConfig::class, function($c) {
166 166
 			return $c->query(OC\GlobalScale\Config::class);
167 167
 		});
168 168
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 			return $c->query(Validator::class);
171 171
 		});
172 172
 
173
-		$this->registerService(\OC\Security\IdentityProof\Manager::class, function ($c) {
173
+		$this->registerService(\OC\Security\IdentityProof\Manager::class, function($c) {
174 174
 			return new \OC\Security\IdentityProof\Manager(
175 175
 				$this->getServer()->query(\OC\Files\AppData\Factory::class),
176 176
 				$this->getServer()->getCrypto(),
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 			);
179 179
 		});
180 180
 
181
-		$this->registerService('Protocol', function($c){
181
+		$this->registerService('Protocol', function($c) {
182 182
 			/** @var \OC\Server $server */
183 183
 			$server = $c->query('ServerContainer');
184 184
 			$protocol = $server->getRequest()->getHttpProtocol();
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 			);
226 226
 		});
227 227
 
228
-		$this->registerService(OC\AppFramework\Middleware\Security\PasswordConfirmationMiddleware::class, function ($c) use ($app) {
228
+		$this->registerService(OC\AppFramework\Middleware\Security\PasswordConfirmationMiddleware::class, function($c) use ($app) {
229 229
 			/** @var \OC\Server $server */
230 230
 			$server = $app->getServer();
231 231
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			);
278 278
 		});
279 279
 
280
-		$this->registerService('TwoFactorMiddleware', function (SimpleContainer $c) use ($app) {
280
+		$this->registerService('TwoFactorMiddleware', function(SimpleContainer $c) use ($app) {
281 281
 			$twoFactorManager = $c->getServer()->getTwoFactorAuthManager();
282 282
 			$userSession = $app->getServer()->getUserSession();
283 283
 			$session = $app->getServer()->getSession();
@@ -287,13 +287,13 @@  discard block
 block discarded – undo
287 287
 			return new TwoFactorMiddleware($twoFactorManager, $userSession, $session, $urlGenerator, $reflector, $request);
288 288
 		});
289 289
 
290
-		$this->registerService('OCSMiddleware', function (SimpleContainer $c) {
290
+		$this->registerService('OCSMiddleware', function(SimpleContainer $c) {
291 291
 			return new OCSMiddleware(
292 292
 				$c['Request']
293 293
 			);
294 294
 		});
295 295
 
296
-		$this->registerService(OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware::class, function (SimpleContainer $c) {
296
+		$this->registerService(OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware::class, function(SimpleContainer $c) {
297 297
 			return new OC\AppFramework\Middleware\Security\SameSiteCookieMiddleware(
298 298
 				$c['Request'],
299 299
 				$c['ControllerMethodReflector']
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 			$dispatcher->registerMiddleware($c['BruteForceMiddleware']);
313 313
 			$dispatcher->registerMiddleware($c['RateLimitingMiddleware']);
314 314
 
315
-			foreach($middleWares as $middleWare) {
315
+			foreach ($middleWares as $middleWare) {
316 316
 				$dispatcher->registerMiddleware($c[$middleWare]);
317 317
 			}
318 318
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	 * @return mixed
375 375
 	 */
376 376
 	public function log($message, $level) {
377
-		switch($level){
377
+		switch ($level) {
378 378
 			case 'debug':
379 379
 				$level = \OCP\Util::DEBUG;
380 380
 				break;
@@ -440,12 +440,12 @@  discard block
 block discarded – undo
440 440
 				return parent::query($name);
441 441
 			} else if ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) {
442 442
 				return parent::query($name);
443
-			} else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) {
443
+			} else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']).'\\') === 0) {
444 444
 				return parent::query($name);
445 445
 			}
446 446
 		}
447 447
 
448
-		throw new QueryException('Could not resolve ' . $name . '!' .
448
+		throw new QueryException('Could not resolve '.$name.'!'.
449 449
 			' Class can not be instantiated', 1);
450 450
 	}
451 451
 }
Please login to merge, or discard this patch.