@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * Seaches the key of the given class constant value. |
234 | 234 | * @param array $_aExceptionDetails The value of an exception constant. |
235 | 235 | * @param string $_sExceptionClass The class the exception constant has to be searched. |
236 | - * @return mixed the key for <i>needle</i> if it is found in the array, <b>FALSE</b> otherwise. |
|
236 | + * @return string the key for <i>needle</i> if it is found in the array, <b>FALSE</b> otherwise. |
|
237 | 237 | * @todo Could be cached with storing all exceptions in opCache |
238 | 238 | * @todo Inner exception should be added when getExceptionCode fails. But at the moment innerNotice function has circular reference to ExceptinShortMessage |
239 | 239 | */ |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | |
389 | 389 | /** |
390 | 390 | * Sets the ShortMessage and returns message object. |
391 | - * @return Gelf\Message Sets the ShortMessage and returns message object. |
|
391 | + * @return \Gelf\Message Sets the ShortMessage and returns message object. |
|
392 | 392 | */ |
393 | 393 | private function setShortMessage() { |
394 | 394 | return $this->gelfMessage->setShortMessage($this->iExceptionCode . ":" . $this->sExceptionShortMessage); |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | |
397 | 397 | /** |
398 | 398 | * Sets the Message and returns message object. |
399 | - * @return Gelf\Message Sets the Message and returns message object. |
|
399 | + * @return \Gelf\Message Sets the Message and returns message object. |
|
400 | 400 | */ |
401 | 401 | private function setMessage() { |
402 | 402 | return $this->gelfMessage->setFullMessage($this->sExceptionMessage); |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | |
405 | 405 | /** |
406 | 406 | * Sets the Level and returns message object. |
407 | - * @return Gelf\Message Sets the Level and returns message object. |
|
407 | + * @return \Gelf\Message Sets the Level and returns message object. |
|
408 | 408 | */ |
409 | 409 | private function setLevel() { |
410 | 410 | return $this->gelfMessage->setLevel($this->sExceptionLevel); |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | |
413 | 413 | /** |
414 | 414 | * Sets the Facility and returns message object. |
415 | - * @return Gelf\Message Sets the Facility and returns message object. |
|
415 | + * @return \Gelf\Message Sets the Facility and returns message object. |
|
416 | 416 | */ |
417 | 417 | private function setFacility() { |
418 | 418 | return $this->gelfMessage->setFacility($this->sApplication); |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Sets additional details from exception object and returns message object. |
423 | - * @return Gelf\Message Sets the additional details from exception object and returns message object. |
|
423 | + * @return \Gelf\Message Sets the additional details from exception object and returns message object. |
|
424 | 424 | */ |
425 | 425 | private function setAdditionals() { |
426 | 426 | $this->gelfMessage->setAdditional('ModuleName', $this->sModuleName); |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | /** |
436 | 436 | * Checks if function/method parameters are equal to function declaration and logs warning if not. |
437 | 437 | * Gets all names of function/method parameters and its values and adds it to message object as additional. |
438 | - * @return Gelf\Message Sets additional details to message object and returns the message object. |
|
438 | + * @return \Gelf\Message Sets additional details to message object and returns the message object. |
|
439 | 439 | */ |
440 | 440 | private function addParameters() { |
441 | 441 | //get function/method parameters and parameters function was called |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | parent::__construct($this->sExceptionMessage, $this->iExceptionCode); |
164 | 164 | //set additional exception details |
165 | 165 | $this->sExceptionShortMessage = $this->getExceptionCode($_aExceptionDetails, get_called_class()); |
166 | - $this->sExceptionClass = $this->getTrace()[0]['class']; |
|
167 | - $this->sExceptionFunction = $this->getTrace()[0]['function']; |
|
166 | + $this->sExceptionClass = $this->getTrace()[ 0 ][ 'class' ]; |
|
167 | + $this->sExceptionFunction = $this->getTrace()[ 0 ][ 'function' ]; |
|
168 | 168 | $this->sModuleName = get_called_class(); |
169 | 169 | //log exception |
170 | 170 | $sFunctionToCall = $this->sExceptionLevel; |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | * @param array $_aExceptionDetails The exceptionDetails in form: "[int ExceptionCode, lfException::LOGLEVEL, string ExceptionMessage]". |
183 | 183 | */ |
184 | 184 | private function validateExceptionDetails(Array $_aExceptionDetails) { |
185 | - if (isset($_aExceptionDetails[0]) && is_numeric($_aExceptionDetails[0])) { |
|
186 | - $this->iExceptionCode = $_aExceptionDetails[0]; |
|
187 | - if (isset($_aExceptionDetails[1]) && method_exists($this, $_aExceptionDetails[1])) { |
|
188 | - $this->sExceptionLevel = $_aExceptionDetails[1]; |
|
189 | - if (isset($_aExceptionDetails[2]) && is_string($_aExceptionDetails[2])) { |
|
190 | - $this->sExceptionMessage = $_aExceptionDetails[2]; |
|
185 | + if (isset($_aExceptionDetails[ 0 ]) && is_numeric($_aExceptionDetails[ 0 ])) { |
|
186 | + $this->iExceptionCode = $_aExceptionDetails[ 0 ]; |
|
187 | + if (isset($_aExceptionDetails[ 1 ]) && method_exists($this, $_aExceptionDetails[ 1 ])) { |
|
188 | + $this->sExceptionLevel = $_aExceptionDetails[ 1 ]; |
|
189 | + if (isset($_aExceptionDetails[ 2 ]) && is_string($_aExceptionDetails[ 2 ])) { |
|
190 | + $this->sExceptionMessage = $_aExceptionDetails[ 2 ]; |
|
191 | 191 | } else { |
192 | 192 | $this->sExceptionMessage = "__ERR_NOT_FOUND__"; |
193 | 193 | $this->innerNotice("WrongConfig", "The exeption thrown, has no exceptionMessage."); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | */ |
225 | 225 | public function getNumberOfVariables(string $_sReplaceableString) { |
226 | 226 | if (preg_match_all("~%(?:(\d+)[$])?[-+]?(?:[ 0]|['].)?(?:[-]?\d+)?(?:[.]\d+)?[%bcdeEufFgGosxX]~", $_sReplaceableString, $iNumberOfVariables) > 0) { |
227 | - return count($iNumberOfVariables[1]); |
|
227 | + return count($iNumberOfVariables[ 1 ]); |
|
228 | 228 | } |
229 | 229 | return 0; |
230 | 230 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | public function getExceptionCode($_aExceptionDetails, $_sExceptionClass) { |
241 | 241 | $oClass = new \ReflectionClass($_sExceptionClass); |
242 | 242 | $sExceptionCode = array_search($_aExceptionDetails, $oClass->getConstants()); |
243 | - if($sExceptionCode === false){ |
|
243 | + if ($sExceptionCode === false) { |
|
244 | 244 | $sExceptionCode = "UNKNOWN"; |
245 | 245 | } |
246 | 246 | return $sExceptionCode; |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | //get function/method parameters and parameters function was called |
442 | 442 | $ref = new \ReflectionMethod($this->sExceptionClass, $this->sExceptionFunction); |
443 | 443 | $aFunctionParameters = $ref->getParameters(); |
444 | - $aFunctionParametersSetted = $this->getTrace()[0]['args']; |
|
444 | + $aFunctionParametersSetted = $this->getTrace()[ 0 ][ 'args' ]; |
|
445 | 445 | //log notice if number of parameters does not match |
446 | 446 | if (count($aFunctionParameters) < count($aFunctionParametersSetted)) { |
447 | 447 | $this->innerNotice("MissUse", "Function was called with '" . count($aFunctionParametersSetted) . "' parameters, but defined on function is only '" . count($aFunctionParameters) . "'"); |
@@ -449,10 +449,10 @@ discard block |
||
449 | 449 | //add parameters and values to exception to log |
450 | 450 | $i = 0; |
451 | 451 | foreach ($aFunctionParametersSetted as $mParameterValue) { |
452 | - if (!isset($aFunctionParameters[$i])) { |
|
452 | + if (!isset($aFunctionParameters[ $i ])) { |
|
453 | 453 | $this->gelfMessage->setAdditional("Param_UNKNOWN" . $i, serialize($mParameterValue)); |
454 | 454 | } else { |
455 | - $this->gelfMessage->setAdditional("Param_" . $aFunctionParameters[$i]->name, serialize($mParameterValue)); |
|
455 | + $this->gelfMessage->setAdditional("Param_" . $aFunctionParameters[ $i ]->name, serialize($mParameterValue)); |
|
456 | 456 | } |
457 | 457 | $i++; |
458 | 458 | } |