Passed
Branch master (783881)
by tsms
02:24
created
src/PEAR_Exception.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -260,9 +260,9 @@  discard block
 block discarded – undo
260 260
     {
261 261
         $trace = $this->getTraceSafe();
262 262
         $cause = array('class'   => get_class($this),
263
-                       'message' => $this->message,
264
-                       'file' => 'unknown',
265
-                       'line' => 'unknown');
263
+                        'message' => $this->message,
264
+                        'file' => 'unknown',
265
+                        'line' => 'unknown');
266 266
         if (isset($trace[0])) {
267 267
             if (isset($trace[0]['file'])) {
268 268
                 $cause['file'] = $trace[0]['file'];
@@ -274,30 +274,30 @@  discard block
 block discarded – undo
274 274
             $this->cause->getCauseMessage($causes);
275 275
         } elseif ($this->cause instanceof Exception) {
276 276
             $causes[] = array('class'   => get_class($this->cause),
277
-                              'message' => $this->cause->getMessage(),
278
-                              'file' => $this->cause->getFile(),
279
-                              'line' => $this->cause->getLine());
277
+                                'message' => $this->cause->getMessage(),
278
+                                'file' => $this->cause->getFile(),
279
+                                'line' => $this->cause->getLine());
280 280
         } elseif (class_exists('PEAR_Error') && $this->cause instanceof PEAR_Error) {
281 281
             $causes[] = array('class' => get_class($this->cause),
282
-                              'message' => $this->cause->getMessage(),
283
-                              'file' => 'unknown',
284
-                              'line' => 'unknown');
282
+                                'message' => $this->cause->getMessage(),
283
+                                'file' => 'unknown',
284
+                                'line' => 'unknown');
285 285
         } elseif (is_array($this->cause)) {
286 286
             foreach ($this->cause as $cause) {
287 287
                 if ($cause instanceof PEAR_Exception) {
288 288
                     $cause->getCauseMessage($causes);
289 289
                 } elseif ($cause instanceof Exception) {
290 290
                     $causes[] = array('class'   => get_class($cause),
291
-                                   'message' => $cause->getMessage(),
292
-                                   'file' => $cause->getFile(),
293
-                                   'line' => $cause->getLine());
291
+                                    'message' => $cause->getMessage(),
292
+                                    'file' => $cause->getFile(),
293
+                                    'line' => $cause->getLine());
294 294
                 } elseif (class_exists('PEAR_Error')
295 295
                     && $cause instanceof PEAR_Error
296 296
                 ) {
297 297
                     $causes[] = array('class' => get_class($cause),
298
-                                      'message' => $cause->getMessage(),
299
-                                      'file' => 'unknown',
300
-                                      'line' => 'unknown');
298
+                                        'message' => $cause->getMessage(),
299
+                                        'file' => 'unknown',
300
+                                        'line' => 'unknown');
301 301
                 } elseif (is_array($cause) && isset($cause['message'])) {
302 302
                     // PEAR_ErrorStack warning
303 303
                     $causes[] = array(
@@ -383,20 +383,20 @@  discard block
 block discarded – undo
383 383
         $html =  '<table style="border: 1px" cellspacing="0">' . "\n";
384 384
         foreach ($causes as $i => $cause) {
385 385
             $html .= '<tr><td colspan="3" style="background: #ff9999">'
386
-               . str_repeat('-', $i) . ' <b>' . $cause['class'] . '</b>: '
387
-               . htmlspecialchars($cause['message'])
386
+                . str_repeat('-', $i) . ' <b>' . $cause['class'] . '</b>: '
387
+                . htmlspecialchars($cause['message'])
388 388
                 . ' in <b>' . $cause['file'] . '</b> '
389
-               . 'on line <b>' . $cause['line'] . '</b>'
390
-               . "</td></tr>\n";
389
+                . 'on line <b>' . $cause['line'] . '</b>'
390
+                . "</td></tr>\n";
391 391
         }
392 392
         $html .= '<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>' . "\n"
393
-               . '<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td>'
394
-               . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td>'
395
-               . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>' . "\n";
393
+                . '<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td>'
394
+                . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td>'
395
+                . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>' . "\n";
396 396
 
397 397
         foreach ($trace as $k => $v) {
398 398
             $html .= '<tr><td style="text-align: center;">' . $k . '</td>'
399
-                   . '<td>';
399
+                    . '<td>';
400 400
             if (!empty($v['class'])) {
401 401
                 $html .= $v['class'] . $v['type'];
402 402
             }
@@ -425,15 +425,15 @@  discard block
 block discarded – undo
425 425
                 }
426 426
             }
427 427
             $html .= '(' . implode(', ', $args) . ')'
428
-                   . '</td>'
429
-                   . '<td>' . (isset($v['file']) ? $v['file'] : 'unknown')
430
-                   . ':' . (isset($v['line']) ? $v['line'] : 'unknown')
431
-                   . '</td></tr>' . "\n";
428
+                    . '</td>'
429
+                    . '<td>' . (isset($v['file']) ? $v['file'] : 'unknown')
430
+                    . ':' . (isset($v['line']) ? $v['line'] : 'unknown')
431
+                    . '</td></tr>' . "\n";
432 432
         }
433 433
         $html .= '<tr><td style="text-align: center;">' . ($k+1) . '</td>'
434
-               . '<td>{main}</td>'
435
-               . '<td>&nbsp;</td></tr>' . "\n"
436
-               . '</table>';
434
+                . '<td>{main}</td>'
435
+                . '<td>&nbsp;</td></tr>' . "\n"
436
+                . '</table>';
437 437
         return $html;
438 438
     }
439 439
 
@@ -449,8 +449,8 @@  discard block
 block discarded – undo
449 449
         $causeMsg = '';
450 450
         foreach ($causes as $i => $cause) {
451 451
             $causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': '
452
-                   . $cause['message'] . ' in ' . $cause['file']
453
-                   . ' on line ' . $cause['line'] . "\n";
452
+                    . $cause['message'] . ' in ' . $cause['file']
453
+                    . ' on line ' . $cause['line'] . "\n";
454 454
         }
455 455
         return $causeMsg . $this->getTraceAsString();
456 456
     }
Please login to merge, or discard this patch.
Switch Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -201,20 +201,20 @@
 block discarded – undo
201 201
             }
202 202
             settype($func, 'array');
203 203
             switch ($func[0]) {
204
-            case self::OBSERVER_PRINT :
205
-                $f = (isset($func[1])) ? $func[1] : '%s';
206
-                printf($f, $this->getMessage());
207
-                break;
208
-            case self::OBSERVER_TRIGGER :
209
-                $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE;
210
-                trigger_error($this->getMessage(), $f);
211
-                break;
212
-            case self::OBSERVER_DIE :
213
-                $f = (isset($func[1])) ? $func[1] : '%s';
214
-                die(printf($f, $this->getMessage()));
215
-                break;
216
-            default:
217
-                trigger_error('invalid observer type', E_USER_WARNING);
204
+                case self::OBSERVER_PRINT :
205
+                    $f = (isset($func[1])) ? $func[1] : '%s';
206
+                    printf($f, $this->getMessage());
207
+                    break;
208
+                case self::OBSERVER_TRIGGER :
209
+                    $f = (isset($func[1])) ? $func[1] : E_USER_NOTICE;
210
+                    trigger_error($this->getMessage(), $f);
211
+                    break;
212
+                case self::OBSERVER_DIE :
213
+                    $f = (isset($func[1])) ? $func[1] : '%s';
214
+                    die(printf($f, $this->getMessage()));
215
+                    break;
216
+                default:
217
+                    trigger_error('invalid observer type', E_USER_WARNING);
218 218
             }
219 219
         }
220 220
     }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -26 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             if (is_object($p2) && !($p2 instanceof Exception)) {
130 130
                 if (!class_exists('PEAR_Error') || !($p2 instanceof PEAR_Error)) {
131 131
                     throw new PEAR_Exception(
132
-                        'exception cause must be Exception, ' .
132
+                        'exception cause must be Exception, '.
133 133
                         'array, or PEAR_Error'
134 134
                     );
135 135
                 }
@@ -304,11 +304,9 @@  discard block
 block discarded – undo
304 304
                         'class' => $cause['package'],
305 305
                         'message' => $cause['message'],
306 306
                         'file' => isset($cause['context']['file']) ?
307
-                                            $cause['context']['file'] :
308
-                                            'unknown',
307
+                                            $cause['context']['file'] : 'unknown',
309 308
                         'line' => isset($cause['context']['line']) ?
310
-                                            $cause['context']['line'] :
311
-                                            'unknown',
309
+                                            $cause['context']['line'] : 'unknown',
312 310
                     );
313 311
                 }
314 312
             }
@@ -326,7 +324,7 @@  discard block
 block discarded – undo
326 324
             $this->_trace = $this->getTrace();
327 325
             if (empty($this->_trace)) {
328 326
                 $backtrace = debug_backtrace();
329
-                $this->_trace = array($backtrace[count($backtrace)-1]);
327
+                $this->_trace = array($backtrace[count($backtrace) - 1]);
330 328
             }
331 329
         }
332 330
         return $this->_trace;
@@ -380,25 +378,25 @@  discard block
 block discarded – undo
380 378
         $trace = $this->getTraceSafe();
381 379
         $causes = array();
382 380
         $this->getCauseMessage($causes);
383
-        $html =  '<table style="border: 1px" cellspacing="0">' . "\n";
381
+        $html = '<table style="border: 1px" cellspacing="0">'."\n";
384 382
         foreach ($causes as $i => $cause) {
385 383
             $html .= '<tr><td colspan="3" style="background: #ff9999">'
386
-               . str_repeat('-', $i) . ' <b>' . $cause['class'] . '</b>: '
384
+               . str_repeat('-', $i).' <b>'.$cause['class'].'</b>: '
387 385
                . htmlspecialchars($cause['message'])
388
-                . ' in <b>' . $cause['file'] . '</b> '
389
-               . 'on line <b>' . $cause['line'] . '</b>'
386
+                . ' in <b>'.$cause['file'].'</b> '
387
+               . 'on line <b>'.$cause['line'].'</b>'
390 388
                . "</td></tr>\n";
391 389
         }
392
-        $html .= '<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>' . "\n"
390
+        $html .= '<tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>'."\n"
393 391
                . '<tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td>'
394 392
                . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td>'
395
-               . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>' . "\n";
393
+               . '<td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>'."\n";
396 394
 
397 395
         foreach ($trace as $k => $v) {
398
-            $html .= '<tr><td style="text-align: center;">' . $k . '</td>'
396
+            $html .= '<tr><td style="text-align: center;">'.$k.'</td>'
399 397
                    . '<td>';
400 398
             if (!empty($v['class'])) {
401
-                $html .= $v['class'] . $v['type'];
399
+                $html .= $v['class'].$v['type'];
402 400
             }
403 401
             $html .= $v['function'];
404 402
             $args = array();
@@ -415,24 +413,24 @@  discard block
 block discarded – undo
415 413
                     } else if (is_int($arg) || is_double($arg)) {
416 414
                         $args[] = $arg;
417 415
                     } else {
418
-                        $arg = (string)$arg;
416
+                        $arg = (string) $arg;
419 417
                         $str = htmlspecialchars(substr($arg, 0, 16));
420 418
                         if (strlen($arg) > 16) {
421 419
                             $str .= '&hellip;';
422 420
                         }
423
-                        $args[] = "'" . $str . "'";
421
+                        $args[] = "'".$str."'";
424 422
                     }
425 423
                 }
426 424
             }
427
-            $html .= '(' . implode(', ', $args) . ')'
425
+            $html .= '('.implode(', ', $args).')'
428 426
                    . '</td>'
429
-                   . '<td>' . (isset($v['file']) ? $v['file'] : 'unknown')
430
-                   . ':' . (isset($v['line']) ? $v['line'] : 'unknown')
431
-                   . '</td></tr>' . "\n";
427
+                   . '<td>'.(isset($v['file']) ? $v['file'] : 'unknown')
428
+                   . ':'.(isset($v['line']) ? $v['line'] : 'unknown')
429
+                   . '</td></tr>'."\n";
432 430
         }
433
-        $html .= '<tr><td style="text-align: center;">' . ($k+1) . '</td>'
431
+        $html .= '<tr><td style="text-align: center;">'.($k + 1).'</td>'
434 432
                . '<td>{main}</td>'
435
-               . '<td>&nbsp;</td></tr>' . "\n"
433
+               . '<td>&nbsp;</td></tr>'."\n"
436 434
                . '</table>';
437 435
         return $html;
438 436
     }
@@ -448,10 +446,10 @@  discard block
 block discarded – undo
448 446
         $this->getCauseMessage($causes);
449 447
         $causeMsg = '';
450 448
         foreach ($causes as $i => $cause) {
451
-            $causeMsg .= str_repeat(' ', $i) . $cause['class'] . ': '
452
-                   . $cause['message'] . ' in ' . $cause['file']
453
-                   . ' on line ' . $cause['line'] . "\n";
449
+            $causeMsg .= str_repeat(' ', $i).$cause['class'].': '
450
+                   . $cause['message'].' in '.$cause['file']
451
+                   . ' on line '.$cause['line']."\n";
454 452
         }
455
-        return $causeMsg . $this->getTraceAsString();
453
+        return $causeMsg.$this->getTraceAsString();
456 454
     }
457 455
 }
Please login to merge, or discard this patch.