Passed
Branch master (7504a7)
by Lukas
02:19
created
src/GreyLogException/GreyLogException.php 2 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
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 false|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
      */
239 239
     public function getExceptionCode($_aExceptionDetails, $_sExceptionClass) {
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 
384 384
     /**
385 385
      * Sets the ShortMessage and returns message object.
386
-     * @return Gelf\Message Sets the ShortMessage and returns message object.
386
+     * @return \Gelf\Message Sets the ShortMessage and returns message object.
387 387
      */
388 388
     private function setShortMessage() {
389 389
         return $this->gelfMessage->setShortMessage($this->iExceptionCode . ":" . $this->sExceptionShortMessage);
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
 
392 392
     /**
393 393
      * Sets the Message and returns message object.
394
-     * @return Gelf\Message Sets the Message and returns message object.
394
+     * @return \Gelf\Message Sets the Message and returns message object.
395 395
      */
396 396
     private function setMessage() {
397 397
         return $this->gelfMessage->setFullMessage($this->sExceptionMessage);
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 
400 400
     /**
401 401
      * Sets the Level and returns message object.
402
-     * @return Gelf\Message Sets the Level and returns message object.
402
+     * @return \Gelf\Message Sets the Level and returns message object.
403 403
      */
404 404
     private function setLevel() {
405 405
         return $this->gelfMessage->setLevel($this->sExceptionLevel);
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 
408 408
     /**
409 409
      * Sets the Facility and returns message object.
410
-     * @return Gelf\Message Sets the Facility and returns message object.
410
+     * @return \Gelf\Message Sets the Facility and returns message object.
411 411
      */
412 412
     private function setFacility() {
413 413
         return $this->gelfMessage->setFacility($this->sApplication);
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 
416 416
     /**
417 417
      * Sets additional details from exception object and returns message object.
418
-     * @return Gelf\Message Sets the additional details from exception object and returns message object.
418
+     * @return \Gelf\Message Sets the additional details from exception object and returns message object.
419 419
      */
420 420
     private function setAdditionals() {
421 421
         $this->gelfMessage->setAdditional('ModuleName', $this->sModuleName);
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
     /**
431 431
      * Checks if function/method parameters are equal to function declaration and logs warning if not.
432 432
      * Gets all names of function/method parameters and its values and adds it to message object as additional.
433
-     * @return Gelf\Message Sets additional details to message object and returns the message object.
433
+     * @return \Gelf\Message Sets additional details to message object and returns the message object.
434 434
      */
435 435
     private function addParameters() {
436 436
         //get function/method parameters and parameters function was called
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
         //get function/method parameters and parameters function was called
437 437
         $ref = new \ReflectionMethod($this->sExceptionClass, $this->sExceptionFunction);
438 438
         $aFunctionParameters = $ref->getParameters();
439
-        $aFunctionParametersSetted = $this->getTrace()[0]['args'];
439
+        $aFunctionParametersSetted = $this->getTrace()[ 0 ][ 'args' ];
440 440
         //log notice if number of parameters does not match
441 441
         if (count($aFunctionParameters) < count($aFunctionParametersSetted)) {
442 442
             $this->innerNotice("MissUse", "Function was called with '" . count($aFunctionParametersSetted) . "' parameters, but defined on function is only '" . count($aFunctionParameters) . "'");
@@ -444,10 +444,10 @@  discard block
 block discarded – undo
444 444
         //add parameters and values to exception to log
445 445
         $i = 0;
446 446
         foreach ($aFunctionParametersSetted as $mParameterValue) {
447
-            if (!isset($aFunctionParameters[$i])) {
447
+            if (!isset($aFunctionParameters[ $i ])) {
448 448
                 $this->gelfMessage->setAdditional("Param_UNKNOWN" . $i, serialize($mParameterValue));
449 449
             } else {
450
-                $this->gelfMessage->setAdditional("Param_" . $aFunctionParameters[$i]->name, serialize($mParameterValue));
450
+                $this->gelfMessage->setAdditional("Param_" . $aFunctionParameters[ $i ]->name, serialize($mParameterValue));
451 451
             }
452 452
             $i++;
453 453
         }
Please login to merge, or discard this patch.