Passed
Push — master ( aa1d71...aaf84d )
by Sergey
02:39
created
examples/features/complex_usage_example.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
 require_once(__DIR__ . '/../../src/PhpConsole/__autoload.php');
4 4
 
5 5
 $password = null;
6
-if(!$password) {
6
+if (!$password) {
7 7
 	die('Please set $password variable value in ' . __FILE__);
8 8
 }
9 9
 
10 10
 $connector = PhpConsole\Helper::register();
11 11
 
12
-if($connector->isActiveClient()) {
12
+if ($connector->isActiveClient()) {
13 13
 	// Init errors & exceptions handler
14 14
 	$handler = PC::getHandler();
15 15
 	$handler->start(); // start handling PHP errors & exceptions
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	'longString' => '11111111112222222222333333333344444444445',
80 80
 	'someObject' => new DebugExample(),
81 81
 	'someCallback' => array(new DebugExample(), 'someMethod'),
82
-	'someClosure' => function () {
82
+	'someClosure' => function() {
83 83
 	},
84 84
 	'someResource' => fopen(__FILE__, 'r'),
85 85
 	'manyItemsArray' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11),
Please login to merge, or discard this patch.
examples/features/debug_vars.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
 	'longString' => '11111111112222222222333333333344444444445',
46 46
 	'someObject' => new DebugExample(),
47 47
 	'someCallback' => array(new DebugExample(), 'someMethod'),
48
-	'someClosure' => function () {
48
+	'someClosure' => function() {
49 49
 	},
50 50
 	'someResource' => fopen(__FILE__, 'r'),
51 51
 	'manyItemsArray' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11),
Please login to merge, or discard this patch.
examples/features/handle_errors.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
 try {
32 32
 	throw new Exception('Some caught exception');
33 33
 }
34
-catch(Exception $exception) {
34
+catch (Exception $exception) {
35 35
 	$handler->handleException($exception);
36 36
 }
37 37
 
Please login to merge, or discard this patch.
examples/utils/detect_headers_limit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @author Barbushin Sergey http://linkedin.com/in/barbushin
7 7
  */
8 8
 
9
-if(isset($_GET['size'])) {
9
+if (isset($_GET['size'])) {
10 10
 	header('X: ' . str_repeat('x', $_GET['size']));
11 11
 	die('ok');
12 12
 }
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	$testDiff = floor($isOk ? $testDiff * 2 : $testDiff / 2);
26 26
 	$size += $testDiff * ($isOk ? 1 : -1);
27 27
 }
28
-while($testDiff && !($size > $testLimit && $isOk));
28
+while ($testDiff && !($size > $testLimit && $isOk));
29 29
 
30 30
 ?>
31 31
 
Please login to merge, or discard this patch.
examples/index.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 );
35 35
 
36 36
 // Highlight & print feature script source code
37
-if(isset($_GET['highlight']) && isset($features[$_GET['highlight']])) {
37
+if (isset($_GET['highlight']) && isset($features[$_GET['highlight']])) {
38 38
 	highlight_string(preg_replace('/(\$password\s*=\s*).*?;/', '\1*****;', file_get_contents(__DIR__ . '/features/' . $_GET['highlight'] . '.php')));
39 39
 	exit;
40 40
 }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 <h1 align="center">PHP Console Features examples & Utils</h1>
111 111
 
112
-<?php if(!$isActiveClient) { ?>
112
+<?php if (!$isActiveClient) { ?>
113 113
 	<span class="warning" align="center">
114 114
 	Google Chrome extension
115 115
 	<a href="https://chrome.google.com/webstore/detail/php-console/nfhmhhlpfleoednkpnnnkolmclajemef" target="_blank">PHP Console</a>
Please login to merge, or discard this patch.
examples/features/protect_by_password.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 require_once(__DIR__ . '/../../src/PhpConsole/__autoload.php');
4 4
 
5 5
 $password = null;
6
-if(!$password) {
6
+if (!$password) {
7 7
 	die('Please set $password variable value in ' . __FILE__);
8 8
 }
9 9
 
Please login to merge, or discard this patch.
src/PhpConsole/Handler.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	 * @return static
40 40
 	 */
41 41
 	public static function getInstance() {
42
-		if(!self::$instance) {
42
+		if (!self::$instance) {
43 43
 			self::$instance = new static();
44 44
 		}
45 45
 		return self::$instance;
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
 	 * @throws \Exception
61 61
 	 */
62 62
 	public function start() {
63
-		if($this->isStarted) {
63
+		if ($this->isStarted) {
64 64
 			throw new \Exception(get_called_class() . ' is already started, use ' . get_called_class() . '::getInstance()->isStarted() to check it.');
65 65
 		}
66 66
 		$this->isStarted = true;
67 67
 
68
-		if($this->handleErrors) {
68
+		if ($this->handleErrors) {
69 69
 			$this->initErrorsHandler();
70 70
 		}
71
-		if($this->handleExceptions) {
71
+		if ($this->handleExceptions) {
72 72
 			$this->initExceptionsHandler();
73 73
 		}
74 74
 	}
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @throws \Exception
79 79
 	 */
80 80
 	protected function checkIsCalledBeforeStart() {
81
-		if($this->isStarted) {
81
+		if ($this->isStarted) {
82 82
 			throw new \Exception('This method can be called only before ' . get_class($this) . '::start()');
83 83
 		}
84 84
 	}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 	 */
148 148
 	protected function initErrorsHandler() {
149 149
 		ini_set('display_errors', false);
150
-		error_reporting($this->errorsHandlerLevel ? : E_ALL | E_STRICT);
150
+		error_reporting($this->errorsHandlerLevel ?: E_ALL | E_STRICT);
151 151
 		$this->oldErrorsHandler = set_error_handler(array($this, 'handleError'));
152 152
 		register_shutdown_function(array($this, 'checkFatalErrorOnShutDown'));
153 153
 		$this->connector->registerFlushOnShutDown();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function checkFatalErrorOnShutDown() {
161 161
 		$error = error_get_last();
162
-		if($error) {
162
+		if ($error) {
163 163
 			ini_set('memory_limit', memory_get_usage(true) + 1000000); // if memory limit exceeded
164 164
 			$this->callOldHandlers = false;
165 165
 			$this->handleError($error['type'], $error['message'], $error['file'], $error['line'], null, 1);
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
 	 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
177 177
 	 */
178 178
 	public function handleError($code = null, $text = null, $file = null, $line = null, $context = null, $ignoreTraceCalls = 0) {
179
-		if(!$this->isStarted || error_reporting() === 0 || $this->isHandlingDisabled() || ($this->errorsHandlerLevel && !($code & $this->errorsHandlerLevel))) {
179
+		if (!$this->isStarted || error_reporting() === 0 || $this->isHandlingDisabled() || ($this->errorsHandlerLevel && !($code & $this->errorsHandlerLevel))) {
180 180
 			return;
181 181
 		}
182 182
 		$this->onHandlingStart();
183 183
 		$this->connector->getErrorsDispatcher()->dispatchError($code, $text, $file, $line, is_numeric($ignoreTraceCalls) ? $ignoreTraceCalls + 1 : $ignoreTraceCalls);
184
-		if($this->oldErrorsHandler && $this->callOldHandlers) {
184
+		if ($this->oldErrorsHandler && $this->callOldHandlers) {
185 185
 			call_user_func_array($this->oldErrorsHandler, array($code, $text, $file, $line, $context));
186 186
 		}
187 187
 		$this->onHandlingComplete();
@@ -214,20 +214,20 @@  discard block
 block discarded – undo
214 214
 	 * @param \Exception|\Throwable $exception
215 215
 	 */
216 216
 	public function handleException($exception) {
217
-		if(!$this->isStarted || $this->isHandlingDisabled()) {
217
+		if (!$this->isStarted || $this->isHandlingDisabled()) {
218 218
 			return;
219 219
 		}
220 220
 		try {
221 221
 			$this->onHandlingStart();
222 222
 			$this->connector->getErrorsDispatcher()->dispatchException($exception);
223
-			if($this->oldExceptionsHandler && $this->callOldHandlers) {
223
+			if ($this->oldExceptionsHandler && $this->callOldHandlers) {
224 224
 				call_user_func($this->oldExceptionsHandler, $exception);
225 225
 			}
226 226
 		}
227
-		catch(\Throwable $internalException) {
227
+		catch (\Throwable $internalException) {
228 228
 			$this->handleException($internalException);
229 229
 		}
230
-		catch(\Exception $internalException) {
230
+		catch (\Exception $internalException) {
231 231
 			$this->handleException($internalException);
232 232
 		}
233 233
 		$this->onHandlingComplete();
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
241 241
 	 */
242 242
 	public function debug($data, $tags = null, $ignoreTraceCalls = 0) {
243
-		if($this->connector->isActiveClient()) {
243
+		if ($this->connector->isActiveClient()) {
244 244
 			$this->connector->getDebugDispatcher()->dispatchDebug($data, $tags, is_numeric($ignoreTraceCalls) ? $ignoreTraceCalls + 1 : $ignoreTraceCalls);
245 245
 		}
246 246
 	}
Please login to merge, or discard this patch.
src/PhpConsole/Connector.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 * @return static
65 65
 	 */
66 66
 	public static function getInstance() {
67
-		if(!self::$instance) {
67
+		if (!self::$instance) {
68 68
 			self::$instance = new static();
69 69
 		}
70 70
 		return self::$instance;
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 * @throws \Exception
78 78
 	 */
79 79
 	public static function setPostponeStorage(Storage $storage) {
80
-		if(self::$instance) {
80
+		if (self::$instance) {
81 81
 			throw new \Exception(__METHOD__ . ' can be called only before ' . __CLASS__ . '::getInstance()');
82 82
 		}
83 83
 		self::$postponeStorage = $storage;
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * @return Storage
88 88
 	 */
89 89
 	private function getPostponeStorage() {
90
-		if(!self::$postponeStorage) {
90
+		if (!self::$postponeStorage) {
91 91
 			self::$postponeStorage = new Storage\Session();
92 92
 		}
93 93
 		return self::$postponeStorage;
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 	protected function __construct() {
97 97
 		$this->initConnection();
98
-		$this->setServerEncoding(ini_get('mbstring.internal_encoding') ? : self::CLIENT_ENCODING);
98
+		$this->setServerEncoding(ini_get('mbstring.internal_encoding') ?: self::CLIENT_ENCODING);
99 99
 	}
100 100
 
101 101
 	private final function __clone() {
@@ -114,14 +114,14 @@  discard block
 block discarded – undo
114 114
 	 * @throws \Exception
115 115
 	 */
116 116
 	private function initConnection() {
117
-		if($this->isCliMode()) {
117
+		if ($this->isCliMode()) {
118 118
 			return;
119 119
 		}
120 120
 
121 121
 		$this->initServerCookie();
122 122
 		$this->client = $this->initClient();
123 123
 
124
-		if($this->client) {
124
+		if ($this->client) {
125 125
 			ob_start();
126 126
 			$this->isActiveClient = true;
127 127
 			$this->registerFlushOnShutDown();
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 	 * @throws \Exception
141 141
 	 */
142 142
 	private function initClient() {
143
-		if(isset($_COOKIE[self::CLIENT_INFO_COOKIE])) {
143
+		if (isset($_COOKIE[self::CLIENT_INFO_COOKIE])) {
144 144
 			$clientData = @json_decode(base64_decode($_COOKIE[self::CLIENT_INFO_COOKIE], true), true);
145
-			if(!$clientData) {
145
+			if (!$clientData) {
146 146
 				throw new \Exception('Wrong format of response cookie data: ' . $_COOKIE[self::CLIENT_INFO_COOKIE]);
147 147
 			}
148 148
 
149 149
 			$client = new Client($clientData);
150
-			if(isset($clientData['auth'])) {
150
+			if (isset($clientData['auth'])) {
151 151
 				$client->auth = new ClientAuth($clientData['auth']);
152 152
 			}
153 153
 			return $client;
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
 	 * @throws \Exception
160 160
 	 */
161 161
 	private function initServerCookie() {
162
-		if(!isset($_COOKIE[self::SERVER_COOKIE]) || $_COOKIE[self::SERVER_COOKIE] != self::SERVER_PROTOCOL) {
162
+		if (!isset($_COOKIE[self::SERVER_COOKIE]) || $_COOKIE[self::SERVER_COOKIE] != self::SERVER_PROTOCOL) {
163 163
 			$isSuccess = setcookie(self::SERVER_COOKIE, self::SERVER_PROTOCOL, null, '/');
164
-			if(!$isSuccess) {
164
+			if (!$isSuccess) {
165 165
 				throw new \Exception('Unable to set PHP Console server cookie');
166 166
 			}
167 167
 		}
@@ -195,11 +195,11 @@  discard block
 block discarded – undo
195 195
 	 * @param array $ipMasks Use *(star character) for "any numbers" placeholder array('192.168.*.*', '10.2.12*.*', '127.0.0.1', '2001:0:5ef5:79fb:*:*:*:*')
196 196
 	 */
197 197
 	public function setAllowedIpMasks(array $ipMasks) {
198
-		if($this->isActiveClient()) {
199
-			if(isset($_SERVER['REMOTE_ADDR'])) {
198
+		if ($this->isActiveClient()) {
199
+			if (isset($_SERVER['REMOTE_ADDR'])) {
200 200
 				$ip = $_SERVER['REMOTE_ADDR'];
201
-				foreach($ipMasks as $ipMask) {
202
-					if(preg_match('~^' . str_replace(array('.', '*'), array('\.', '\w+'), $ipMask) . '$~i', $ip)) {
201
+				foreach ($ipMasks as $ipMask) {
202
+					if (preg_match('~^' . str_replace(array('.', '*'), array('\.', '\w+'), $ipMask) . '$~i', $ip)) {
203 203
 						return;
204 204
 					}
205 205
 				}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 * @return Dumper
213 213
 	 */
214 214
 	public function getDumper() {
215
-		if(!$this->dumper) {
215
+		if (!$this->dumper) {
216 216
 			$this->dumper = new Dumper();
217 217
 		}
218 218
 		return $this->dumper;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 * @return Dispatcher\Errors
232 232
 	 */
233 233
 	public function getErrorsDispatcher() {
234
-		if(!$this->errorsDispatcher) {
234
+		if (!$this->errorsDispatcher) {
235 235
 			$this->errorsDispatcher = new Dispatcher\Errors($this, $this->getDumper());
236 236
 		}
237 237
 		return $this->errorsDispatcher;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @return Dispatcher\Debug
251 251
 	 */
252 252
 	public function getDebugDispatcher() {
253
-		if(!$this->debugDispatcher) {
253
+		if (!$this->debugDispatcher) {
254 254
 			$this->debugDispatcher = new Dispatcher\Debug($this, $this->getDumper());
255 255
 		}
256 256
 		return $this->debugDispatcher;
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 * @return Dispatcher\Evaluate
270 270
 	 */
271 271
 	public function getEvalDispatcher() {
272
-		if(!$this->evalDispatcher) {
272
+		if (!$this->evalDispatcher) {
273 273
 			$this->evalDispatcher = new Dispatcher\Evaluate($this, new EvalProvider(), $this->getDumper());
274 274
 		}
275 275
 		return $this->evalDispatcher;
@@ -285,32 +285,32 @@  discard block
 block discarded – undo
285 285
 	 * @throws \Exception
286 286
 	 */
287 287
 	public function startEvalRequestsListener($exitOnEval = true, $flushDebugMessages = true) {
288
-		if(!$this->auth) {
288
+		if (!$this->auth) {
289 289
 			throw new \Exception('Eval dispatcher is allowed only in password protected mode. See PhpConsole\Connector::getInstance()->setPassword(...)');
290 290
 		}
291
-		if($this->isEvalListenerStarted) {
291
+		if ($this->isEvalListenerStarted) {
292 292
 			throw new \Exception('Eval requests listener already started');
293 293
 		}
294 294
 		$this->isEvalListenerStarted = true;
295 295
 
296
-		if($this->isActiveClient() && $this->isAuthorized() && isset($_POST[Connector::POST_VAR_NAME]['eval'])) {
296
+		if ($this->isActiveClient() && $this->isAuthorized() && isset($_POST[Connector::POST_VAR_NAME]['eval'])) {
297 297
 			$request = $_POST[Connector::POST_VAR_NAME]['eval'];
298
-			if(!isset($request['data']) || !isset($request['signature'])) {
298
+			if (!isset($request['data']) || !isset($request['signature'])) {
299 299
 				throw new \Exception('Wrong PHP Console eval request');
300 300
 			}
301
-			if($this->auth->getSignature($request['data']) !== $request['signature']) {
301
+			if ($this->auth->getSignature($request['data']) !== $request['signature']) {
302 302
 				throw new \Exception('Wrong PHP Console eval request signature');
303 303
 			}
304
-			if($flushDebugMessages) {
305
-				foreach($this->messages as $i => $message) {
306
-					if($message instanceof DebugMessage) {
304
+			if ($flushDebugMessages) {
305
+				foreach ($this->messages as $i => $message) {
306
+					if ($message instanceof DebugMessage) {
307 307
 						unset($this->messages[$i]);
308 308
 					}
309 309
 				}
310 310
 			}
311 311
 			$this->convertEncoding($request['data'], $this->serverEncoding, self::CLIENT_ENCODING);
312 312
 			$this->getEvalDispatcher()->dispatchCode($request['data']);
313
-			if($exitOnEval) {
313
+			if ($exitOnEval) {
314 314
 				exit;
315 315
 			}
316 316
 		}
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 	 */
324 324
 	public function setSourcesBasePath($sourcesBasePath) {
325 325
 		$sourcesBasePath = realpath($sourcesBasePath);
326
-		if(!$sourcesBasePath) {
326
+		if (!$sourcesBasePath) {
327 327
 			throw new \Exception('Path "' . $sourcesBasePath . '" not found');
328 328
 		}
329 329
 		$this->sourcesBasePath = $sourcesBasePath;
@@ -338,12 +338,12 @@  discard block
 block discarded – undo
338 338
 	 * @throws \Exception
339 339
 	 */
340 340
 	public function setPassword($password, $publicKeyByIp = true) {
341
-		if($this->auth) {
341
+		if ($this->auth) {
342 342
 			throw new \Exception('Password already defined');
343 343
 		}
344 344
 		$this->convertEncoding($password, self::CLIENT_ENCODING, $this->serverEncoding);
345 345
 		$this->auth = new Auth($password, $publicKeyByIp);
346
-		if($this->client) {
346
+		if ($this->client) {
347 347
 			$this->isAuthorized = $this->client->auth && $this->auth->isValidAuth($this->client->auth);
348 348
 		}
349 349
 	}
@@ -386,18 +386,18 @@  discard block
 block discarded – undo
386 386
 	 * @throws \Exception
387 387
 	 */
388 388
 	protected function convertEncoding(&$string, $toEncoding, $fromEncoding) {
389
-		if($string && is_string($string) && $toEncoding != $fromEncoding) {
389
+		if ($string && is_string($string) && $toEncoding != $fromEncoding) {
390 390
 			static $isMbString;
391
-			if($isMbString === null) {
391
+			if ($isMbString === null) {
392 392
 				$isMbString = extension_loaded('mbstring');
393 393
 			}
394
-			if($isMbString) {
395
-				$string = @mb_convert_encoding($string, $toEncoding, $fromEncoding) ? : $string;
394
+			if ($isMbString) {
395
+				$string = @mb_convert_encoding($string, $toEncoding, $fromEncoding) ?: $string;
396 396
 			}
397 397
 			else {
398
-				$string = @iconv($fromEncoding, $toEncoding . '//IGNORE', $string) ? : $string;
398
+				$string = @iconv($fromEncoding, $toEncoding . '//IGNORE', $string) ?: $string;
399 399
 			}
400
-			if(!$string && $toEncoding == 'UTF-8') {
400
+			if (!$string && $toEncoding == 'UTF-8') {
401 401
 				$string = utf8_encode($string);
402 402
 			}
403 403
 		}
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
 	 * @throws \Exception
410 410
 	 */
411 411
 	public function setHeadersLimit($bytes) {
412
-		if($bytes < static::PHP_HEADERS_SIZE) {
412
+		if ($bytes < static::PHP_HEADERS_SIZE) {
413 413
 			throw new \Exception('Headers limit cannot be less then ' . __CLASS__ . '::PHP_HEADERS_SIZE');
414 414
 		}
415 415
 		$bytes -= static::PHP_HEADERS_SIZE;
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
 	 * @param $encoding
422 422
 	 */
423 423
 	public function setServerEncoding($encoding) {
424
-		if($encoding == 'utf8' || $encoding == 'utf-8') {
424
+		if ($encoding == 'utf8' || $encoding == 'utf-8') {
425 425
 			$encoding = 'UTF-8'; // otherwise mb_convert_encoding() sometime fails with error(thanks to @alexborisov)
426 426
 		}
427 427
 		$this->serverEncoding = $encoding;
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 	 * @param Message $message
433 433
 	 */
434 434
 	public function sendMessage(Message $message) {
435
-		if($this->isActiveClient()) {
435
+		if ($this->isActiveClient()) {
436 436
 			$this->messages[] = $message;
437 437
 		}
438 438
 	}
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 	 */
451 451
 	public function onShutDown() {
452 452
 		$this->registeredShutDowns--;
453
-		if(!$this->registeredShutDowns) {
453
+		if (!$this->registeredShutDowns) {
454 454
 			$this->proceedResponsePackage();
455 455
 		}
456 456
 	}
@@ -475,19 +475,19 @@  discard block
 block discarded – undo
475 475
 	 * @throws \Exception
476 476
 	 */
477 477
 	private function proceedResponsePackage() {
478
-		if($this->isActiveClient()) {
478
+		if ($this->isActiveClient()) {
479 479
 			$response = new Response();
480 480
 			$response->isSslOnlyMode = $this->isSslOnlyMode;
481 481
 
482
-			if(isset($_POST[self::POST_VAR_NAME]['getBackData'])) {
482
+			if (isset($_POST[self::POST_VAR_NAME]['getBackData'])) {
483 483
 				$response->getBackData = $_POST[self::POST_VAR_NAME]['getBackData'];
484 484
 			}
485 485
 
486
-			if(!$this->isSslOnlyMode || $this->isSsl()) {
487
-				if($this->auth) {
486
+			if (!$this->isSslOnlyMode || $this->isSsl()) {
487
+				if ($this->auth) {
488 488
 					$response->auth = $this->auth->getServerAuthStatus($this->client->auth);
489 489
 				}
490
-				if(!$this->auth || $this->isAuthorized()) {
490
+				if (!$this->auth || $this->isAuthorized()) {
491 491
 					$response->isLocal = isset($_SERVER['REMOTE_ADDR']) && ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' || $_SERVER['REMOTE_ADDR'] == '::1');
492 492
 					$response->docRoot = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : null;
493 493
 					$response->sourcesBasePath = $this->sourcesBasePath;
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 
499 499
 			$responseData = $this->serializeResponse($response);
500 500
 
501
-			if(strlen($responseData) > $this->headersLimit || !$this->setHeaderData($responseData, self::HEADER_NAME, false)) {
501
+			if (strlen($responseData) > $this->headersLimit || !$this->setHeaderData($responseData, self::HEADER_NAME, false)) {
502 502
 				$this->getPostponeStorage()->push($this->postponeResponseId, $responseData);
503 503
 			}
504 504
 		}
@@ -515,8 +515,8 @@  discard block
 block discarded – undo
515 515
 	}
516 516
 
517 517
 	private function setHeaderData($responseData, $headerName, $throwException = true) {
518
-		if(headers_sent($file, $line)) {
519
-			if($throwException) {
518
+		if (headers_sent($file, $line)) {
519
+			if ($throwException) {
520 520
 				throw new \Exception('Unable to process response data, headers already sent in ' . $file . ':' . $line . '. Try to use ob_start() and don\'t use flush().');
521 521
 			}
522 522
 			return false;
@@ -526,14 +526,14 @@  discard block
 block discarded – undo
526 526
 	}
527 527
 
528 528
 	protected function objectToArray(&$var) {
529
-		if(is_object($var)) {
529
+		if (is_object($var)) {
530 530
 			$var = get_object_vars($var);
531 531
 			array_walk_recursive($var, array($this, 'objectToArray'));
532 532
 		}
533 533
 	}
534 534
 
535 535
 	protected function serializeResponse(DataObject $response) {
536
-		if($this->serverEncoding != self::CLIENT_ENCODING) {
536
+		if ($this->serverEncoding != self::CLIENT_ENCODING) {
537 537
 			$this->objectToArray($response);
538 538
 			$this->convertArrayEncoding($response, self::CLIENT_ENCODING, $this->serverEncoding);
539 539
 		}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	 * Check if there is postponed response request and dispatch it
545 545
 	 */
546 546
 	private function listenGetPostponedResponse() {
547
-		if(isset($_POST[self::POST_VAR_NAME]['getPostponedResponse'])) {
547
+		if (isset($_POST[self::POST_VAR_NAME]['getPostponedResponse'])) {
548 548
 			header('Content-Type: application/json; charset=' . self::CLIENT_ENCODING);
549 549
 			echo $this->getPostponeStorage()->pop($_POST[self::POST_VAR_NAME]['getPostponedResponse']);
550 550
 			$this->disable();
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 abstract class DataObject {
557 557
 
558 558
 	public function __construct(array $properties = array()) {
559
-		foreach($properties as $property => $value) {
559
+		foreach ($properties as $property => $value) {
560 560
 			$this->$property = $value;
561 561
 		}
562 562
 	}
Please login to merge, or discard this patch.