Code Duplication    Length = 25-25 lines in 3 locations

class/PEAR.php 3 locations

@@ 346-370 (lines=25) @@
343
            $setoptions = &$GLOBALS['_PEAR_default_error_options'];
344
        }
345
346
        switch ($mode) {
347
            case references_PEAR_ERROR_EXCEPTION:
348
            case references_PEAR_ERROR_RETURN:
349
            case references_PEAR_ERROR_PRINT:
350
            case references_PEAR_ERROR_TRIGGER:
351
            case references_PEAR_ERROR_DIE:
352
            case null:
353
                $setmode    = $mode;
354
                $setoptions = $options;
355
                break;
356
357
            case references_PEAR_ERROR_CALLBACK:
358
                $setmode = $mode;
359
                // class/object method callback
360
                if (is_callable($options)) {
361
                    $setoptions = $options;
362
                } else {
363
                    trigger_error('invalid error callback', E_USER_WARNING);
364
                }
365
                break;
366
367
            default:
368
                trigger_error('invalid error mode', E_USER_WARNING);
369
                break;
370
        }
371
    }
372
373
    // }}}
@@ 609-633 (lines=25) @@
606
        $def_mode    = &$GLOBALS['_PEAR_default_error_mode'];
607
        $def_options = &$GLOBALS['_PEAR_default_error_options'];
608
        $stack[]     = array($def_mode, $def_options);
609
        switch ($mode) {
610
            case references_PEAR_ERROR_EXCEPTION:
611
            case references_PEAR_ERROR_RETURN:
612
            case references_PEAR_ERROR_PRINT:
613
            case references_PEAR_ERROR_TRIGGER:
614
            case references_PEAR_ERROR_DIE:
615
            case null:
616
                $def_mode    = $mode;
617
                $def_options = $options;
618
                break;
619
620
            case references_PEAR_ERROR_CALLBACK:
621
                $def_mode = $mode;
622
                // class/object method callback
623
                if (is_callable($options)) {
624
                    $def_options = $options;
625
                } else {
626
                    trigger_error('invalid error callback', E_USER_WARNING);
627
                }
628
                break;
629
630
            default:
631
                trigger_error('invalid error mode', E_USER_WARNING);
632
                break;
633
        }
634
        $stack[] = array($mode, $options);
635
636
        return true;
@@ 647-671 (lines=25) @@
644
        array_pop($stack);
645
        list($mode, $options) = $stack[count($stack) - 1];
646
        array_pop($stack);
647
        switch ($mode) {
648
            case references_PEAR_ERROR_EXCEPTION:
649
            case references_PEAR_ERROR_RETURN:
650
            case references_PEAR_ERROR_PRINT:
651
            case references_PEAR_ERROR_TRIGGER:
652
            case references_PEAR_ERROR_DIE:
653
            case null:
654
                $setmode    = $mode;
655
                $setoptions = $options;
656
                break;
657
658
            case references_PEAR_ERROR_CALLBACK:
659
                $setmode = $mode;
660
                // class/object method callback
661
                if (is_callable($options)) {
662
                    $setoptions = $options;
663
                } else {
664
                    trigger_error('invalid error callback', E_USER_WARNING);
665
                }
666
                break;
667
668
            default:
669
                trigger_error('invalid error mode', E_USER_WARNING);
670
                break;
671
        }
672
673
        return true;
674
    }