Completed
Pull Request — master (#8630)
by Blizzz
25:22 queued 01:35
created
apps/user_ldap/lib/Connection.php 1 patch
Spacing   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -101,19 +101,19 @@  discard block
 block discarded – undo
101 101
 		$this->configuration = new Configuration($configPrefix,
102 102
 												 !is_null($configID));
103 103
 		$memcache = \OC::$server->getMemCacheFactory();
104
-		if($memcache->isAvailable()) {
104
+		if ($memcache->isAvailable()) {
105 105
 			$this->cache = $memcache->createDistributed();
106 106
 		}
107 107
 		$helper = new Helper(\OC::$server->getConfig());
108 108
 		$this->doNotValidate = !in_array($this->configPrefix,
109 109
 			$helper->getServerConfigurationPrefixes());
110 110
 		$this->hasPagedResultSupport =
111
-			(int)$this->configuration->ldapPagingSize !== 0
111
+			(int) $this->configuration->ldapPagingSize !== 0
112 112
 			|| $this->ldap->hasPagedResultSupport();
113 113
 	}
114 114
 
115 115
 	public function __destruct() {
116
-		if(!$this->dontDestruct && $this->ldap->isResource($this->ldapConnectionRes)) {
116
+		if (!$this->dontDestruct && $this->ldap->isResource($this->ldapConnectionRes)) {
117 117
 			@$this->ldap->unbind($this->ldapConnectionRes);
118 118
 			$this->bindResult = [];
119 119
 		}
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	 * @return bool|mixed
135 135
 	 */
136 136
 	public function __get($name) {
137
-		if(!$this->configured) {
137
+		if (!$this->configured) {
138 138
 			$this->readConfiguration();
139 139
 		}
140 140
 
141
-		if($name === 'hasPagedResultSupport') {
141
+		if ($name === 'hasPagedResultSupport') {
142 142
 			return $this->hasPagedResultSupport;
143 143
 		}
144 144
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 		$before = $this->configuration->$name;
155 155
 		$this->configuration->$name = $value;
156 156
 		$after = $this->configuration->$name;
157
-		if($before !== $after) {
157
+		if ($before !== $after) {
158 158
 			if ($this->configID !== '' && $this->configID !== null) {
159 159
 				$this->configuration->saveConfiguration();
160 160
 			}
@@ -169,7 +169,7 @@  discard block
 block discarded – undo
169 169
 	 * @param bool $state
170 170
 	 */
171 171
 	public function setIgnoreValidation($state) {
172
-		$this->ignoreValidation = (bool)$state;
172
+		$this->ignoreValidation = (bool) $state;
173 173
 	}
174 174
 
175 175
 	/**
@@ -185,14 +185,14 @@  discard block
 block discarded – undo
185 185
 	 * Returns the LDAP handler
186 186
 	 */
187 187
 	public function getConnectionResource() {
188
-		if(!$this->ldapConnectionRes) {
188
+		if (!$this->ldapConnectionRes) {
189 189
 			$this->init();
190
-		} else if(!$this->ldap->isResource($this->ldapConnectionRes)) {
190
+		} else if (!$this->ldap->isResource($this->ldapConnectionRes)) {
191 191
 			$this->ldapConnectionRes = null;
192 192
 			$this->establishConnection();
193 193
 		}
194
-		if(is_null($this->ldapConnectionRes)) {
195
-			\OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server ' . $this->configuration->ldapHost, \OCP\Util::ERROR);
194
+		if (is_null($this->ldapConnectionRes)) {
195
+			\OCP\Util::writeLog('user_ldap', 'No LDAP Connection to server '.$this->configuration->ldapHost, \OCP\Util::ERROR);
196 196
 			throw new ServerNotAvailableException('Connection to LDAP server could not be established');
197 197
 		}
198 198
 		return $this->ldapConnectionRes;
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 	 * resets the connection resource
203 203
 	 */
204 204
 	public function resetConnectionResource() {
205
-		if(!is_null($this->ldapConnectionRes)) {
205
+		if (!is_null($this->ldapConnectionRes)) {
206 206
 			@$this->ldap->unbind($this->ldapConnectionRes);
207 207
 			$this->ldapConnectionRes = null;
208 208
 			$this->bindResult = [];
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 	 */
216 216
 	private function getCacheKey($key) {
217 217
 		$prefix = 'LDAP-'.$this->configID.'-'.$this->configPrefix.'-';
218
-		if(is_null($key)) {
218
+		if (is_null($key)) {
219 219
 			return $prefix;
220 220
 		}
221 221
 		return $prefix.hash('sha256', $key);
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
 	 * @return mixed|null
227 227
 	 */
228 228
 	public function getFromCache($key) {
229
-		if(!$this->configured) {
229
+		if (!$this->configured) {
230 230
 			$this->readConfiguration();
231 231
 		}
232
-		if(is_null($this->cache) || !$this->configuration->ldapCacheTTL) {
232
+		if (is_null($this->cache) || !$this->configuration->ldapCacheTTL) {
233 233
 			return null;
234 234
 		}
235 235
 		$key = $this->getCacheKey($key);
@@ -244,10 +244,10 @@  discard block
 block discarded – undo
244 244
 	 * @return string
245 245
 	 */
246 246
 	public function writeToCache($key, $value) {
247
-		if(!$this->configured) {
247
+		if (!$this->configured) {
248 248
 			$this->readConfiguration();
249 249
 		}
250
-		if(is_null($this->cache)
250
+		if (is_null($this->cache)
251 251
 			|| !$this->configuration->ldapCacheTTL
252 252
 			|| !$this->configuration->ldapConfigurationActive) {
253 253
 			return null;
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 	}
259 259
 
260 260
 	public function clearCache() {
261
-		if(!is_null($this->cache)) {
261
+		if (!is_null($this->cache)) {
262 262
 			$this->cache->clear($this->getCacheKey(null));
263 263
 		}
264 264
 	}
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 	 * @return null
271 271
 	 */
272 272
 	private function readConfiguration($force = false) {
273
-		if((!$this->configured || $force) && !is_null($this->configID)) {
273
+		if ((!$this->configured || $force) && !is_null($this->configID)) {
274 274
 			$this->configuration->readConfiguration();
275 275
 			$this->configured = $this->validateConfiguration();
276 276
 		}
@@ -283,12 +283,12 @@  discard block
 block discarded – undo
283 283
 	 * @return boolean true if config validates, false otherwise. Check with $setParameters for detailed success on single parameters
284 284
 	 */
285 285
 	public function setConfiguration($config, &$setParameters = null) {
286
-		if(is_null($setParameters)) {
286
+		if (is_null($setParameters)) {
287 287
 			$setParameters = array();
288 288
 		}
289 289
 		$this->doNotValidate = false;
290 290
 		$this->configuration->setConfiguration($config, $setParameters);
291
-		if(count($setParameters) > 0) {
291
+		if (count($setParameters) > 0) {
292 292
 			$this->configured = $this->validateConfiguration();
293 293
 		}
294 294
 
@@ -315,10 +315,10 @@  discard block
 block discarded – undo
315 315
 		$config = $this->configuration->getConfiguration();
316 316
 		$cta = $this->configuration->getConfigTranslationArray();
317 317
 		$result = array();
318
-		foreach($cta as $dbkey => $configkey) {
319
-			switch($configkey) {
318
+		foreach ($cta as $dbkey => $configkey) {
319
+			switch ($configkey) {
320 320
 				case 'homeFolderNamingRule':
321
-					if(strpos($config[$configkey], 'attr:') === 0) {
321
+					if (strpos($config[$configkey], 'attr:') === 0) {
322 322
 						$result[$dbkey] = substr($config[$configkey], 5);
323 323
 					} else {
324 324
 						$result[$dbkey] = '';
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
 				case 'ldapBaseGroups':
330 330
 				case 'ldapAttributesForUserSearch':
331 331
 				case 'ldapAttributesForGroupSearch':
332
-					if(is_array($config[$configkey])) {
332
+					if (is_array($config[$configkey])) {
333 333
 						$result[$dbkey] = implode("\n", $config[$configkey]);
334 334
 						break;
335 335
 					} //else follows default
@@ -342,23 +342,23 @@  discard block
 block discarded – undo
342 342
 
343 343
 	private function doSoftValidation() {
344 344
 		//if User or Group Base are not set, take over Base DN setting
345
-		foreach(array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) {
345
+		foreach (array('ldapBaseUsers', 'ldapBaseGroups') as $keyBase) {
346 346
 			$val = $this->configuration->$keyBase;
347
-			if(empty($val)) {
347
+			if (empty($val)) {
348 348
 				$this->configuration->$keyBase = $this->configuration->ldapBase;
349 349
 			}
350 350
 		}
351 351
 
352
-		foreach(array('ldapExpertUUIDUserAttr'  => 'ldapUuidUserAttribute',
352
+		foreach (array('ldapExpertUUIDUserAttr'  => 'ldapUuidUserAttribute',
353 353
 					  'ldapExpertUUIDGroupAttr' => 'ldapUuidGroupAttribute')
354 354
 				as $expertSetting => $effectiveSetting) {
355 355
 			$uuidOverride = $this->configuration->$expertSetting;
356
-			if(!empty($uuidOverride)) {
356
+			if (!empty($uuidOverride)) {
357 357
 				$this->configuration->$effectiveSetting = $uuidOverride;
358 358
 			} else {
359 359
 				$uuidAttributes = Access::UUID_ATTRIBUTES;
360 360
 				array_unshift($uuidAttributes, 'auto');
361
-				if(!in_array($this->configuration->$effectiveSetting,
361
+				if (!in_array($this->configuration->$effectiveSetting,
362 362
 							$uuidAttributes)
363 363
 					&& (!is_null($this->configID))) {
364 364
 					$this->configuration->$effectiveSetting = 'auto';
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 			}
373 373
 		}
374 374
 
375
-		$backupPort = (int)$this->configuration->ldapBackupPort;
375
+		$backupPort = (int) $this->configuration->ldapBackupPort;
376 376
 		if ($backupPort <= 0) {
377 377
 			$this->configuration->backupPort = $this->configuration->ldapPort;
378 378
 		}
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
 		//make sure empty search attributes are saved as simple, empty array
381 381
 		$saKeys = array('ldapAttributesForUserSearch',
382 382
 						'ldapAttributesForGroupSearch');
383
-		foreach($saKeys as $key) {
383
+		foreach ($saKeys as $key) {
384 384
 			$val = $this->configuration->$key;
385
-			if(is_array($val) && count($val) === 1 && empty($val[0])) {
385
+			if (is_array($val) && count($val) === 1 && empty($val[0])) {
386 386
 				$this->configuration->$key = array();
387 387
 			}
388 388
 		}
389 389
 
390
-		if((stripos($this->configuration->ldapHost, 'ldaps://') === 0)
390
+		if ((stripos($this->configuration->ldapHost, 'ldaps://') === 0)
391 391
 			&& $this->configuration->ldapTLS) {
392 392
 			$this->configuration->ldapTLS = false;
393 393
 			\OCP\Util::writeLog('user_ldap',
@@ -403,15 +403,15 @@  discard block
 block discarded – undo
403 403
 	private function doCriticalValidation() {
404 404
 		$configurationOK = true;
405 405
 		$errorStr = 'Configuration Error (prefix '.
406
-			(string)$this->configPrefix .'): ';
406
+			(string) $this->configPrefix.'): ';
407 407
 
408 408
 		//options that shall not be empty
409 409
 		$options = array('ldapHost', 'ldapPort', 'ldapUserDisplayName',
410 410
 						 'ldapGroupDisplayName', 'ldapLoginFilter');
411
-		foreach($options as $key) {
411
+		foreach ($options as $key) {
412 412
 			$val = $this->configuration->$key;
413
-			if(empty($val)) {
414
-				switch($key) {
413
+			if (empty($val)) {
414
+				switch ($key) {
415 415
 					case 'ldapHost':
416 416
 						$subj = 'LDAP Host';
417 417
 						break;
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 		$agent = $this->configuration->ldapAgentName;
443 443
 		$pwd = $this->configuration->ldapAgentPassword;
444 444
 		if (
445
-			($agent === ''  && $pwd !== '')
445
+			($agent === '' && $pwd !== '')
446 446
 			|| ($agent !== '' && $pwd === '')
447 447
 		) {
448 448
 			\OCP\Util::writeLog('user_ldap',
@@ -457,14 +457,14 @@  discard block
 block discarded – undo
457 457
 		$baseUsers = $this->configuration->ldapBaseUsers;
458 458
 		$baseGroups = $this->configuration->ldapBaseGroups;
459 459
 
460
-		if(empty($base) && empty($baseUsers) && empty($baseGroups)) {
460
+		if (empty($base) && empty($baseUsers) && empty($baseGroups)) {
461 461
 			\OCP\Util::writeLog('user_ldap',
462 462
 								$errorStr.'Not a single Base DN given.',
463 463
 								\OCP\Util::WARN);
464 464
 			$configurationOK = false;
465 465
 		}
466 466
 
467
-		if(mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8')
467
+		if (mb_strpos($this->configuration->ldapLoginFilter, '%uid', 0, 'UTF-8')
468 468
 		   === false) {
469 469
 			\OCP\Util::writeLog('user_ldap',
470 470
 								$errorStr.'login filter does not contain %uid '.
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	private function validateConfiguration() {
484 484
 
485
-		if($this->doNotValidate) {
485
+		if ($this->doNotValidate) {
486 486
 			//don't do a validation if it is a new configuration with pure
487 487
 			//default values. Will be allowed on changes via __set or
488 488
 			//setConfiguration
@@ -503,21 +503,21 @@  discard block
 block discarded – undo
503 503
 	 * Connects and Binds to LDAP
504 504
 	 */
505 505
 	private function establishConnection() {
506
-		if(!$this->configuration->ldapConfigurationActive) {
506
+		if (!$this->configuration->ldapConfigurationActive) {
507 507
 			return null;
508 508
 		}
509 509
 		static $phpLDAPinstalled = true;
510
-		if(!$phpLDAPinstalled) {
510
+		if (!$phpLDAPinstalled) {
511 511
 			return false;
512 512
 		}
513
-		if(!$this->ignoreValidation && !$this->configured) {
513
+		if (!$this->ignoreValidation && !$this->configured) {
514 514
 			\OCP\Util::writeLog('user_ldap',
515 515
 								'Configuration is invalid, cannot connect',
516 516
 								\OCP\Util::WARN);
517 517
 			return false;
518 518
 		}
519
-		if(!$this->ldapConnectionRes) {
520
-			if(!$this->ldap->areLDAPFunctionsAvailable()) {
519
+		if (!$this->ldapConnectionRes) {
520
+			if (!$this->ldap->areLDAPFunctionsAvailable()) {
521 521
 				$phpLDAPinstalled = false;
522 522
 				\OCP\Util::writeLog('user_ldap',
523 523
 									'function ldap_connect is not available. Make '.
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
 
527 527
 				return false;
528 528
 			}
529
-			if($this->configuration->turnOffCertCheck) {
530
-				if(putenv('LDAPTLS_REQCERT=never')) {
529
+			if ($this->configuration->turnOffCertCheck) {
530
+				if (putenv('LDAPTLS_REQCERT=never')) {
531 531
 					\OCP\Util::writeLog('user_ldap',
532 532
 						'Turned off SSL certificate validation successfully.',
533 533
 						\OCP\Util::DEBUG);
@@ -551,24 +551,24 @@  discard block
 block discarded – undo
551 551
 					$error = $this->ldap->isResource($this->ldapConnectionRes) ?
552 552
 						$this->ldap->errno($this->ldapConnectionRes) : -1;
553 553
 				}
554
-				if($bindStatus === true) {
554
+				if ($bindStatus === true) {
555 555
 					return $bindStatus;
556 556
 				}
557 557
 			} catch (ServerNotAvailableException $e) {
558
-				if(!$isBackupHost) {
558
+				if (!$isBackupHost) {
559 559
 					throw $e;
560 560
 				}
561 561
 			}
562 562
 
563 563
 			//if LDAP server is not reachable, try the Backup (Replica!) Server
564
-			if($isBackupHost && ($error !== 0 || $isOverrideMainServer)) {
564
+			if ($isBackupHost && ($error !== 0 || $isOverrideMainServer)) {
565 565
 				$this->doConnect($this->configuration->ldapBackupHost,
566 566
 								 $this->configuration->ldapBackupPort);
567 567
 				$this->bindResult = [];
568 568
 				$bindStatus = $this->bind();
569 569
 				$error = $this->ldap->isResource($this->ldapConnectionRes) ?
570 570
 					$this->ldap->errno($this->ldapConnectionRes) : -1;
571
-				if($bindStatus && $error === 0 && !$this->getFromCache('overrideMainServer')) {
571
+				if ($bindStatus && $error === 0 && !$this->getFromCache('overrideMainServer')) {
572 572
 					//when bind to backup server succeeded and failed to main server,
573 573
 					//skip contacting him until next cache refresh
574 574
 					$this->writeToCache('overrideMainServer', true);
@@ -593,17 +593,17 @@  discard block
 block discarded – undo
593 593
 
594 594
 		$this->ldapConnectionRes = $this->ldap->connect($host, $port);
595 595
 
596
-		if(!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {
596
+		if (!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_PROTOCOL_VERSION, 3)) {
597 597
 			throw new ServerNotAvailableException('Could not set required LDAP Protocol version.');
598 598
 		}
599 599
 
600
-		if(!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) {
600
+		if (!$this->ldap->setOption($this->ldapConnectionRes, LDAP_OPT_REFERRALS, 0)) {
601 601
 			throw new ServerNotAvailableException('Could not disable LDAP referrals.');
602 602
 		}
603 603
 
604
-		if($this->configuration->ldapTLS) {
605
-			if(!$this->ldap->startTls($this->ldapConnectionRes)) {
606
-				throw new ServerNotAvailableException('Start TLS failed, when connecting to LDAP host ' . $host . '.');
604
+		if ($this->configuration->ldapTLS) {
605
+			if (!$this->ldap->startTls($this->ldapConnectionRes)) {
606
+				throw new ServerNotAvailableException('Start TLS failed, when connecting to LDAP host '.$host.'.');
607 607
 			}
608 608
 		}
609 609
 
@@ -614,19 +614,19 @@  discard block
 block discarded – undo
614 614
 	 * Binds to LDAP
615 615
 	 */
616 616
 	public function bind() {
617
-		if(!$this->configuration->ldapConfigurationActive) {
617
+		if (!$this->configuration->ldapConfigurationActive) {
618 618
 			return false;
619 619
 		}
620 620
 		$cr = $this->ldapConnectionRes;
621
-		if(!$this->ldap->isResource($cr)) {
621
+		if (!$this->ldap->isResource($cr)) {
622 622
 			$cr = $this->getConnectionResource();
623 623
 		}
624 624
 
625
-		if(
625
+		if (
626 626
 			count($this->bindResult) !== 0
627 627
 			&& $this->bindResult['dn'] === $this->configuration->ldapAgentName
628 628
 			&& \OC::$server->getHasher()->verify(
629
-				$this->configPrefix . $this->configuration->ldapAgentPassword,
629
+				$this->configPrefix.$this->configuration->ldapAgentPassword,
630 630
 				$this->bindResult['hash']
631 631
 			)
632 632
 		) {
@@ -642,19 +642,19 @@  discard block
 block discarded – undo
642 642
 
643 643
 		$this->bindResult = [
644 644
 			'dn' => $this->configuration->ldapAgentName,
645
-			'hash' => \OC::$server->getHasher()->hash($this->configPrefix . $this->configuration->ldapAgentPassword),
645
+			'hash' => \OC::$server->getHasher()->hash($this->configPrefix.$this->configuration->ldapAgentPassword),
646 646
 			'result' => $ldapLogin,
647 647
 		];
648 648
 
649
-		if(!$ldapLogin) {
649
+		if (!$ldapLogin) {
650 650
 			$errno = $this->ldap->errno($cr);
651 651
 
652 652
 			\OCP\Util::writeLog('user_ldap',
653
-				'Bind failed: ' . $errno . ': ' . $this->ldap->error($cr),
653
+				'Bind failed: '.$errno.': '.$this->ldap->error($cr),
654 654
 				\OCP\Util::WARN);
655 655
 
656 656
 			// Set to failure mode, if LDAP error code is not LDAP_SUCCESS or LDAP_INVALID_CREDENTIALS
657
-			if($errno !== 0x00 && $errno !== 0x31) {
657
+			if ($errno !== 0x00 && $errno !== 0x31) {
658 658
 				$this->ldapConnectionRes = null;
659 659
 			}
660 660
 
Please login to merge, or discard this patch.
apps/user_ldap/lib/Proxy.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	public function __construct(ILDAPWrapper $ldap) {
50 50
 		$this->ldap = $ldap;
51 51
 		$memcache = \OC::$server->getMemCacheFactory();
52
-		if($memcache->isAvailable()) {
52
+		if ($memcache->isAvailable()) {
53 53
 			$this->cache = $memcache->createDistributed();
54 54
 		}
55 55
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		static $db;
68 68
 		static $coreUserManager;
69 69
 		static $coreNotificationManager;
70
-		if($fs === null) {
70
+		if ($fs === null) {
71 71
 			$ocConfig = \OC::$server->getConfig();
72 72
 			$fs       = new FilesystemHelper();
73 73
 			$log      = new LogWrapper();
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @return mixed
94 94
 	 */
95 95
 	protected function getAccess($configPrefix) {
96
-		if(!isset(self::$accesses[$configPrefix])) {
96
+		if (!isset(self::$accesses[$configPrefix])) {
97 97
 			$this->addAccess($configPrefix);
98 98
 		}
99 99
 		return self::$accesses[$configPrefix];
@@ -147,8 +147,8 @@  discard block
 block discarded – undo
147 147
 	 * @return mixed, the result of the specified method
148 148
 	 */
149 149
 	protected function handleRequest($id, $method, $parameters, $passOnWhen = false) {
150
-		$result = $this->callOnLastSeenOn($id,  $method, $parameters, $passOnWhen);
151
-		if($result === $passOnWhen) {
150
+		$result = $this->callOnLastSeenOn($id, $method, $parameters, $passOnWhen);
151
+		if ($result === $passOnWhen) {
152 152
 			$result = $this->walkBackends($id, $method, $parameters);
153 153
 		}
154 154
 		return $result;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	 */
161 161
 	private function getCacheKey($key) {
162 162
 		$prefix = 'LDAP-Proxy-';
163
-		if($key === null) {
163
+		if ($key === null) {
164 164
 			return $prefix;
165 165
 		}
166 166
 		return $prefix.hash('sha256', $key);
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 	 * @return mixed|null
172 172
 	 */
173 173
 	public function getFromCache($key) {
174
-		if($this->cache === null) {
174
+		if ($this->cache === null) {
175 175
 			return null;
176 176
 		}
177 177
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @param mixed $value
190 190
 	 */
191 191
 	public function writeToCache($key, $value) {
192
-		if($this->cache === null) {
192
+		if ($this->cache === null) {
193 193
 			return;
194 194
 		}
195 195
 		$key   = $this->getCacheKey($key);
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	}
199 199
 
200 200
 	public function clearCache() {
201
-		if($this->cache === null) {
201
+		if ($this->cache === null) {
202 202
 			return;
203 203
 		}
204 204
 		$this->cache->clear($this->getCacheKey(null));
Please login to merge, or discard this patch.