Test Failed
Pull Request — master (#171)
by
unknown
04:28
created
examples/features/complex_usage_example.php 2 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -41,10 +41,17 @@
 block discarded – undo
41 41
 		$this->method1(array(1, 2), new stdClass()); // this arguments will be displayed in error backtrace
42 42
 	}
43 43
 
44
+	/**
45
+	 * @param integer[] $a
46
+	 * @param stdClass $b
47
+	 */
44 48
 	protected function method1($a, $b) {
45 49
 		$this->method2('some long string argument');
46 50
 	}
47 51
 
52
+	/**
53
+	 * @param string $c
54
+	 */
48 55
 	public function method2($c) {
49 56
 		file_get_contents('not_existed.file'); // E_WARNING error
50 57
 	}
Please login to merge, or discard this 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/handle_errors.php 3 patches
Doc Comments   +7 added lines patch added patch discarded remove patch
@@ -14,10 +14,17 @@
 block discarded – undo
14 14
 		$this->method1(array(1, 2), new stdClass()); // this arguments will be displayed in error backtrace
15 15
 	}
16 16
 
17
+	/**
18
+	 * @param integer[] $a
19
+	 * @param stdClass $b
20
+	 */
17 21
 	protected function method1($a, $b) {
18 22
 		$this->method2('some long string argument');
19 23
 	}
20 24
 
25
+	/**
26
+	 * @param string $c
27
+	 */
21 28
 	public function method2($c) {
22 29
 		echo $undefinedVar; // E_NOTICE error
23 30
 		file_get_contents('not_existed.file'); // E_WARNING error
Please login to merge, or discard this 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.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@
 block discarded – undo
30 30
 
31 31
 try {
32 32
 	throw new Exception('Some caught exception');
33
-}
34
-catch(Exception $exception) {
33
+} catch(Exception $exception) {
35 34
 	$handler->handleException($exception);
36 35
 }
37 36
 
Please login to merge, or discard this patch.
src/PhpConsole/Dispatcher/Debug.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
 	 * Send debug data message to client
24 24
 	 * @param mixed $data
25 25
 	 * @param null|string $tags Tags separated by dot, e.g. "low.db.billing"
26
-	 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
26
+	 * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
27 27
 	 */
28 28
 	public function dispatchDebug($data, $tags = null, $ignoreTraceCalls = 0) {
29 29
 		if($this->isActive()) {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@
 block discarded – undo
26 26
 	 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
27 27
 	 */
28 28
 	public function dispatchDebug($data, $tags = null, $ignoreTraceCalls = 0) {
29
-		if($this->isActive()) {
29
+		if ($this->isActive()) {
30 30
 			$message = new DebugMessage();
31 31
 			$message->data = $this->dumper->dump($data);
32
-			if($tags) {
32
+			if ($tags) {
33 33
 				$message->tags = explode('.', $tags);
34 34
 			}
35
-			if($this->detectTraceAndSource && $ignoreTraceCalls !== null) {
35
+			if ($this->detectTraceAndSource && $ignoreTraceCalls !== null) {
36 36
 				$message->trace = $this->fetchTrace(debug_backtrace(), $message->file, $message->line, $ignoreTraceCalls);
37 37
 			}
38 38
 			$this->sendMessage($message);
Please login to merge, or discard this patch.
src/PhpConsole/Dispatcher/Errors.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
 	 * @param null|string $text
53 53
 	 * @param null|string $file
54 54
 	 * @param null|integer $line
55
-	 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
55
+	 * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
56 56
 	 */
57 57
 	public function dispatchError($code = null, $text = null, $file = null, $line = null, $ignoreTraceCalls = 0) {
58 58
 		if($this->isActive()) {
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
 	 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
56 56
 	 */
57 57
 	public function dispatchError($code = null, $text = null, $file = null, $line = null, $ignoreTraceCalls = 0) {
58
-		if($this->isActive()) {
58
+		if ($this->isActive()) {
59 59
 			$message = new ErrorMessage();
60 60
 			$message->code = $code;
61 61
 			$message->class = $this->getErrorTypeByCode($code);
62 62
 			$message->data = $this->dumper->dump($text);
63 63
 			$message->file = $file;
64 64
 			$message->line = $line;
65
-			if($ignoreTraceCalls !== null) {
65
+			if ($ignoreTraceCalls !== null) {
66 66
 				$message->trace = $this->fetchTrace(debug_backtrace(), $file, $line, is_array($ignoreTraceCalls) ? $ignoreTraceCalls : $ignoreTraceCalls + 1);
67 67
 			}
68 68
 			$this->sendMessage($message);
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
 	 * @param \Exception|\Throwable $exception
75 75
 	 */
76 76
 	public function dispatchException($exception) {
77
-		if($this->isActive()) {
78
-			if($this->dispatchPreviousExceptions && $exception->getPrevious()) {
77
+		if ($this->isActive()) {
78
+			if ($this->dispatchPreviousExceptions && $exception->getPrevious()) {
79 79
 				$this->dispatchException($exception->getPrevious());
80 80
 			}
81 81
 			$message = new ErrorMessage();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	 * @param Message $message
95 95
 	 */
96 96
 	protected function sendMessage(Message $message) {
97
-		if(!$this->isIgnored($message)) {
97
+		if (!$this->isIgnored($message)) {
98 98
 			parent::sendMessage($message);
99 99
 			$this->sentMessages[] = $message;
100 100
 		}
@@ -106,14 +106,14 @@  discard block
 block discarded – undo
106 106
 	 * @return string
107 107
 	 */
108 108
 	protected function getErrorTypeByCode($code) {
109
-		if(!static::$errorsConstantsValues) {
110
-			foreach(static::$errorsConstantsNames as $constantName) {
111
-				if(defined($constantName)) {
109
+		if (!static::$errorsConstantsValues) {
110
+			foreach (static::$errorsConstantsNames as $constantName) {
111
+				if (defined($constantName)) {
112 112
 					static::$errorsConstantsValues[constant($constantName)] = $constantName;
113 113
 				}
114 114
 			}
115 115
 		}
116
-		if(isset(static::$errorsConstantsValues[$code])) {
116
+		if (isset(static::$errorsConstantsValues[$code])) {
117 117
 			return static::$errorsConstantsValues[$code];
118 118
 		}
119 119
 		return (string)$code;
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	 * @return bool
126 126
 	 */
127 127
 	protected function isIgnored(ErrorMessage $message) {
128
-		if($this->ignoreRepeatedSource && $message->file) {
129
-			foreach($this->sentMessages as $sentMessage) {
130
-				if($message->file == $sentMessage->file && $message->line == $sentMessage->line && $message->class == $sentMessage->class) {
128
+		if ($this->ignoreRepeatedSource && $message->file) {
129
+			foreach ($this->sentMessages as $sentMessage) {
130
+				if ($message->file == $sentMessage->file && $message->line == $sentMessage->line && $message->class == $sentMessage->class) {
131 131
 					return true;
132 132
 				}
133 133
 			}
Please login to merge, or discard this patch.
src/PhpConsole/EvalProvider.php 3 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 
70 70
 	/**
71 71
 	 * Call added code handlers
72
-	 * @param $code
73
-	 * @return mixed
72
+	 * @param string $code
73
+	 * @return string
74 74
 	 */
75 75
 	protected function applyHandlersToCode($code) {
76 76
 		foreach($this->codeCallbackHandlers as $callback) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 	/**
109 109
 	 * Execute code with shared vars
110
-	 * @param $_code
110
+	 * @param string $_code
111 111
 	 * @param array $_sharedVars
112 112
 	 * @return mixed
113 113
 	 */
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	/**
164 164
 	 * Protect response code access only to specified directories using http://www.php.net/manual/en/ini.core.php#ini.open-basedir
165 165
 	 * IMPORTANT: classes autoload methods will work only for specified directories
166
-	 * @param array $openBaseDirs
166
+	 * @param string[] $openBaseDirs
167 167
 	 * @codeCoverageIgnore
168 168
 	 */
169 169
 	public function setOpenBaseDirs(array $openBaseDirs) {
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 		try {
42 42
 			$result->return = static::executeCode($code, $this->sharedVars);
43 43
 		}
44
-		catch(\Throwable $exception) {
44
+		catch (\Throwable $exception) {
45 45
 			$result->exception = $exception;
46 46
 		}
47
-		catch(\Exception $exception) {
47
+		catch (\Exception $exception) {
48 48
 			$result->exception = $exception;
49 49
 		}
50 50
 		$result->time = abs(microtime(true) - $startTime - $selfTime);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 * @throws \Exception
62 62
 	 */
63 63
 	public function addCodeHandler($callback) {
64
-		if(!is_callable($callback)) {
64
+		if (!is_callable($callback)) {
65 65
 			throw new \Exception('Argument is not callable');
66 66
 		}
67 67
 		$this->codeCallbackHandlers[] = $callback;
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	 * @return mixed
74 74
 	 */
75 75
 	protected function applyHandlersToCode($code) {
76
-		foreach($this->codeCallbackHandlers as $callback) {
76
+		foreach ($this->codeCallbackHandlers as $callback) {
77 77
 			call_user_func_array($callback, array(&$code));
78 78
 		}
79 79
 		return $code;
@@ -84,8 +84,8 @@  discard block
 block discarded – undo
84 84
 	 */
85 85
 	protected function backupGlobals() {
86 86
 		$this->globalsBackup = array();
87
-		foreach($GLOBALS as $key => $value) {
88
-			if($key != 'GLOBALS') {
87
+		foreach ($GLOBALS as $key => $value) {
88
+			if ($key != 'GLOBALS') {
89 89
 				$this->globalsBackup[$key] = $value;
90 90
 			}
91 91
 		}
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * Restore global vars data from backup var
96 96
 	 */
97 97
 	protected function restoreGlobals() {
98
-		foreach($this->globalsBackup as $key => $value) {
98
+		foreach ($this->globalsBackup as $key => $value) {
99 99
 			$GLOBALS[$key] = $value;
100 100
 		}
101
-		foreach(array_diff(array_keys($GLOBALS), array_keys($this->globalsBackup)) as $newKey) {
102
-			if($newKey != 'GLOBALS') {
101
+		foreach (array_diff(array_keys($GLOBALS), array_keys($this->globalsBackup)) as $newKey) {
102
+			if ($newKey != 'GLOBALS') {
103 103
 				unset($GLOBALS[$newKey]);
104 104
 			}
105 105
 		}
@@ -112,11 +112,11 @@  discard block
 block discarded – undo
112 112
 	 * @return mixed
113 113
 	 */
114 114
 	protected static function executeCode($_code, array $_sharedVars) {
115
-		foreach($_sharedVars as $var => $value) {
116
-			if(isset($GLOBALS[$var]) && $var[0] == '_') { // extract($this->sharedVars, EXTR_OVERWRITE) and $$var = $value do not overwrites global vars
115
+		foreach ($_sharedVars as $var => $value) {
116
+			if (isset($GLOBALS[$var]) && $var[0] == '_') { // extract($this->sharedVars, EXTR_OVERWRITE) and $$var = $value do not overwrites global vars
117 117
 				$GLOBALS[$var] = $value;
118 118
 			}
119
-			elseif(!isset($$var)) {
119
+			elseif (!isset($$var)) {
120 120
 				$$var = $value;
121 121
 			}
122 122
 		}
@@ -175,9 +175,9 @@  discard block
 block discarded – undo
175 175
 	 * @codeCoverageIgnore
176 176
 	 */
177 177
 	protected function forcePhpConsoleClassesAutoLoad() {
178
-		foreach(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__), \RecursiveIteratorIterator::LEAVES_ONLY) as $path) {
178
+		foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__), \RecursiveIteratorIterator::LEAVES_ONLY) as $path) {
179 179
 			/** @var $path \SplFileInfo */
180
-			if($path->isFile() && $path->getExtension() == 'php' && $path->getFilename() !== 'PsrLogger.php') {
180
+			if ($path->isFile() && $path->getExtension() == 'php' && $path->getFilename() !== 'PsrLogger.php') {
181 181
 				require_once($path->getPathname());
182 182
 			}
183 183
 		}
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	 * @codeCoverageIgnore
190 190
 	 */
191 191
 	protected function applyOpenBaseDirSetting() {
192
-		if($this->openBaseDirs) {
192
+		if ($this->openBaseDirs) {
193 193
 			$value = implode(PATH_SEPARATOR, $this->openBaseDirs);
194
-			if(ini_get('open_basedir') != $value) {
194
+			if (ini_get('open_basedir') != $value) {
195 195
 				$this->forcePhpConsoleClassesAutoLoad();
196
-				if(ini_set('open_basedir', $value) === false) {
196
+				if (ini_set('open_basedir', $value) === false) {
197 197
 					throw new \Exception('Unable to set "open_basedir" php.ini setting');
198 198
 				}
199 199
 			}
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 	 * @throws \Exception
228 228
 	 */
229 229
 	public function addSharedVarReference($name, &$var) {
230
-		if(isset($this->sharedVars[$name])) {
230
+		if (isset($this->sharedVars[$name])) {
231 231
 			throw new \Exception('Var with name "' . $name . '" already added');
232 232
 		}
233
-		$this->sharedVars[$name] =& $var;
233
+		$this->sharedVars[$name] = & $var;
234 234
 	}
235 235
 }
236 236
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,11 +40,9 @@  discard block
 block discarded – undo
40 40
 		$startTime = microtime(true);
41 41
 		try {
42 42
 			$result->return = static::executeCode($code, $this->sharedVars);
43
-		}
44
-		catch(\Throwable $exception) {
43
+		} catch(\Throwable $exception) {
45 44
 			$result->exception = $exception;
46
-		}
47
-		catch(\Exception $exception) {
45
+		} catch(\Exception $exception) {
48 46
 			$result->exception = $exception;
49 47
 		}
50 48
 		$result->time = abs(microtime(true) - $startTime - $selfTime);
@@ -115,8 +113,7 @@  discard block
 block discarded – undo
115 113
 		foreach($_sharedVars as $var => $value) {
116 114
 			if(isset($GLOBALS[$var]) && $var[0] == '_') { // extract($this->sharedVars, EXTR_OVERWRITE) and $$var = $value do not overwrites global vars
117 115
 				$GLOBALS[$var] = $value;
118
-			}
119
-			elseif(!isset($$var)) {
116
+			} elseif(!isset($$var)) {
120 117
 				$$var = $value;
121 118
 			}
122 119
 		}
Please login to merge, or discard this patch.
src/PhpConsole/Handler.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @param string|null $file
175 175
 	 * @param int|null $line
176 176
 	 * @param null $context
177
-	 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
177
+	 * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
178 178
 	 */
179 179
 	public function handleError($code = null, $text = null, $file = null, $line = null, $context = null, $ignoreTraceCalls = 0) {
180 180
 		if(!$this->isStarted || error_reporting() === 0 || $this->isHandlingDisabled() || ($this->errorsHandlerLevel && !($code & $this->errorsHandlerLevel))) {
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 * Handle debug data
239 239
 	 * @param mixed $data
240 240
 	 * @param string|null $tags Tags separated by dot, e.g. "low.db.billing"
241
-	 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
241
+	 * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
242 242
 	 */
243 243
 	public function debug($data, $tags = null, $ignoreTraceCalls = 0) {
244 244
 		if($this->connector->isActiveClient()) {
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -224,11 +224,9 @@
 block discarded – undo
224 224
 			if($this->oldExceptionsHandler && $this->callOldHandlers) {
225 225
 				call_user_func($this->oldExceptionsHandler, $exception);
226 226
 			}
227
-		}
228
-		catch(\Throwable $internalException) {
227
+		} catch(\Throwable $internalException) {
229 228
 			$this->handleException($internalException);
230
-		}
231
-		catch(\Exception $internalException) {
229
+		} catch(\Exception $internalException) {
232 230
 			$this->handleException($internalException);
233 231
 		}
234 232
 		$this->onHandlingComplete();
Please login to merge, or discard this 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/Helper.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@
 block discarded – undo
86 86
 		 * Analog of Handler::getInstance()->debug(...) method
87 87
 		 * @param mixed $data
88 88
 		 * @param string|null $tags Tags separated by dot, e.g. "low.db.billing"
89
-		 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
89
+		 * @param integer $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
90 90
 		 */
91 91
 		public static function debug($data, $tags = null, $ignoreTraceCalls = 0) {
92 92
 			if(self::$isActive) {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
 		 * @return Connector
39 39
 		 */
40 40
 		public static function register(Connector $connector = null, Handler $handler = null) {
41
-			if(static::$connector) {
41
+			if (static::$connector) {
42 42
 				throw new \Exception('Helper already registered');
43 43
 			}
44 44
 			self::$handler = $handler;
45
-			self::$connector = $connector ? : Connector::getInstance();
45
+			self::$connector = $connector ?: Connector::getInstance();
46 46
 			self::$isActive = self::$connector->isActiveClient();
47 47
 			return self::$connector;
48 48
 		}
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		 * @throws \Exception
62 62
 		 */
63 63
 		public static function getConnector() {
64
-			if(!self::$connector) {
64
+			if (!self::$connector) {
65 65
 				throw new \Exception('Helper is not registered. Call ' . get_called_class() . '::register()');
66 66
 			}
67 67
 			return self::$connector;
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 		 * @throws \Exception
74 74
 		 */
75 75
 		public static function getHandler() {
76
-			if(!self::$connector) {
76
+			if (!self::$connector) {
77 77
 				throw new \Exception('Helper is not registered. Call ' . get_called_class() . '::register()');
78 78
 			}
79
-			if(!self::$handler) {
79
+			if (!self::$handler) {
80 80
 				self::$handler = Handler::getInstance();
81 81
 			}
82 82
 			return self::$handler;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		 * @param int|array $ignoreTraceCalls Ignore tracing classes by name prefix `array('PhpConsole')` or fixed number of calls to ignore
90 90
 		 */
91 91
 		public static function debug($data, $tags = null, $ignoreTraceCalls = 0) {
92
-			if(self::$isActive) {
92
+			if (self::$isActive) {
93 93
 				self::$connector->getDebugDispatcher()->dispatchDebug($data, $tags, is_numeric($ignoreTraceCalls) ? $ignoreTraceCalls + 1 : $ignoreTraceCalls);
94 94
 			}
95 95
 		}
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 		 * @param $args
102 102
 		 */
103 103
 		public static function __callStatic($tags, $args) {
104
-			if(isset($args[1])) {
104
+			if (isset($args[1])) {
105 105
 				$tags .= '.' . $args[1];
106 106
 			}
107 107
 			static::debug(isset($args[0]) ? $args[0] : null, $tags, 1);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
 	use PhpConsole\Helper;
115 115
 
116
-	if(!class_exists('PC', false)) {
116
+	if (!class_exists('PC', false)) {
117 117
 		/**
118 118
 		 * Helper short class name in global namespace
119 119
 		 */
Please login to merge, or discard this patch.
src/PhpConsole/OldVersionAdapter.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 		 * @param null|string $sourceBasePath
59 59
 		 */
60 60
 		public static function start($handleErrors = true, $handleExceptions = true, $sourceBasePath = null) {
61
-			if(self::$instance) {
61
+			if (self::$instance) {
62 62
 				die('PhpConsole already started');
63 63
 			}
64 64
 			self::$instance = new static();
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		}
75 75
 
76 76
 		public static function getInstance() {
77
-			if(!self::$instance) {
77
+			if (!self::$instance) {
78 78
 				throw new \Exception('PhpConsole not started');
79 79
 			}
80 80
 			return self::$instance;
@@ -113,13 +113,13 @@  discard block
 block discarded – undo
113 113
 	use PhpConsole\Handler;
114 114
 	use PhpConsole\OldVersionAdapter;
115 115
 
116
-	if(!class_exists('PhpConsole', false)) {
116
+	if (!class_exists('PhpConsole', false)) {
117 117
 		class PhpConsole extends OldVersionAdapter {
118 118
 
119 119
 		}
120 120
 	}
121 121
 
122
-	if(!function_exists('debug')) {
122
+	if (!function_exists('debug')) {
123 123
 		function debug($message, $tags = 'debug') {
124 124
 			Handler::getInstance()->debug($message, $tags, 1);
125 125
 		}
Please login to merge, or discard this patch.
src/PhpConsole/__autoload.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@
 block discarded – undo
2 2
 
3 3
 namespace PhpConsole;
4 4
 
5
-spl_autoload_register(function ($class) {
6
-	if(strpos($class, __NAMESPACE__) === 0) {
5
+spl_autoload_register(function($class) {
6
+	if (strpos($class, __NAMESPACE__) === 0) {
7 7
 		/** @noinspection PhpIncludeInspection */
8 8
 		require_once(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php');
9 9
 	}
Please login to merge, or discard this patch.