Passed
Push — master ( 4f61a5...7504a7 )
by Lukas
02:16
created
src/GreyLogException/GreyLogException.php 1 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.