Completed
Pull Request — master (#7166)
by Christoph
17:05
created
lib/private/Log.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -119,14 +119,14 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function __construct($logger = null, SystemConfig $config = null, $normalizer = null, IRegistry $registry = null) {
121 121
 		// FIXME: Add this for backwards compatibility, should be fixed at some point probably
122
-		if($config === null) {
122
+		if ($config === null) {
123 123
 			$config = \OC::$server->getSystemConfig();
124 124
 		}
125 125
 
126 126
 		$this->config = $config;
127 127
 
128 128
 		// FIXME: Add this for backwards compatibility, should be fixed at some point probably
129
-		if($logger === null) {
129
+		if ($logger === null) {
130 130
 			$logType = $this->config->getValue('log_type', 'file');
131 131
 			$this->logger = static::getLogClass($logType);
132 132
 			call_user_func(array($this->logger, 'init'));
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
 			 * check log condition based on the context of each log message
263 263
 			 * once this is met -> change the required log level to debug
264 264
 			 */
265
-			if(!empty($logCondition)
265
+			if (!empty($logCondition)
266 266
 				&& isset($logCondition['apps'])
267 267
 				&& in_array($app, $logCondition['apps'], true)) {
268 268
 				$minLevel = Util::DEBUG;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 		// interpolate $message as defined in PSR-3
275 275
 		$replace = array();
276 276
 		foreach ($context as $key => $val) {
277
-			$replace['{' . $key . '}'] = $val;
277
+			$replace['{'.$key.'}'] = $val;
278 278
 		}
279 279
 
280 280
 		// interpolate replacement values into the message and return
@@ -284,27 +284,27 @@  discard block
 block discarded – undo
284 284
 		 * check for a special log condition - this enables an increased log on
285 285
 		 * a per request/user base
286 286
 		 */
287
-		if($this->logConditionSatisfied === null) {
287
+		if ($this->logConditionSatisfied === null) {
288 288
 			// default to false to just process this once per request
289 289
 			$this->logConditionSatisfied = false;
290
-			if(!empty($logCondition)) {
290
+			if (!empty($logCondition)) {
291 291
 
292 292
 				// check for secret token in the request
293
-				if(isset($logCondition['shared_secret'])) {
293
+				if (isset($logCondition['shared_secret'])) {
294 294
 					$request = \OC::$server->getRequest();
295 295
 
296 296
 					// if token is found in the request change set the log condition to satisfied
297
-					if($request && hash_equals($logCondition['shared_secret'], $request->getParam('log_secret', ''))) {
297
+					if ($request && hash_equals($logCondition['shared_secret'], $request->getParam('log_secret', ''))) {
298 298
 						$this->logConditionSatisfied = true;
299 299
 					}
300 300
 				}
301 301
 
302 302
 				// check for user
303
-				if(isset($logCondition['users'])) {
303
+				if (isset($logCondition['users'])) {
304 304
 					$user = \OC::$server->getUserSession()->getUser();
305 305
 
306 306
 					// if the user matches set the log condition to satisfied
307
-					if($user !== null && in_array($user->getUID(), $logCondition['users'], true)) {
307
+					if ($user !== null && in_array($user->getUID(), $logCondition['users'], true)) {
308 308
 						$this->logConditionSatisfied = true;
309 309
 					}
310 310
 				}
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		}
313 313
 
314 314
 		// if log condition is satisfied change the required log level to DEBUG
315
-		if($this->logConditionSatisfied) {
315
+		if ($this->logConditionSatisfied) {
316 316
 			$minLevel = Util::DEBUG;
317 317
 		}
318 318
 
@@ -344,12 +344,12 @@  discard block
 block discarded – undo
344 344
 			'File' => $exception->getFile(),
345 345
 			'Line' => $exception->getLine(),
346 346
 		);
347
-		$data['Trace'] = preg_replace('!(' . implode('|', $this->methodsWithSensitiveParameters) . ')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $data['Trace']);
347
+		$data['Trace'] = preg_replace('!('.implode('|', $this->methodsWithSensitiveParameters).')\(.*\)!', '$1(*** sensitive parameters replaced ***)', $data['Trace']);
348 348
 		if ($exception instanceof HintException) {
349 349
 			$data['Hint'] = $exception->getHint();
350 350
 		}
351 351
 		$msg = isset($context['message']) ? $context['message'] : 'Exception';
352
-		$msg .= ': ' . json_encode($data);
352
+		$msg .= ': '.json_encode($data);
353 353
 		$this->log($level, $msg, $context);
354 354
 		if (!is_null($this->crashReporters)) {
355 355
 			$this->crashReporters->delegateReport($exception, $context);
Please login to merge, or discard this patch.