@@ -8,8 +8,8 @@ |
||
8 | 8 | |
9 | 9 | $redirectNum = isset($_GET['num']) ? $_GET['num'] + 1 : 1; |
10 | 10 | |
11 | -if($redirectNum < 4) { |
|
12 | - if($redirectNum == 2) { |
|
11 | +if ($redirectNum < 4) { |
|
12 | + if ($redirectNum == 2) { |
|
13 | 13 | echo ${'oops' . $redirectNum}; |
14 | 14 | } |
15 | 15 | $handler->debug('Debug message in redirect №' . $redirectNum); |
@@ -3,13 +3,13 @@ discard block |
||
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 |
||
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), |
@@ -45,7 +45,7 @@ |
||
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), |
@@ -31,7 +31,7 @@ |
||
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 |
@@ -6,7 +6,7 @@ discard block |
||
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 |
||
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 |
@@ -34,7 +34,7 @@ discard block |
||
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 |
||
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> |
@@ -3,7 +3,7 @@ |
||
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 |
@@ -39,7 +39,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |