Code Duplication    Length = 26-26 lines in 4 locations

src/PhpSpreadsheet/Reader/Excel5.php 2 locations

@@ 4720-4745 (lines=26) @@
4717
4718
        // bit: 0-3; mask: 0x0000000F; type
4719
        $type = (0x0000000F & $options) >> 0;
4720
        switch ($type) {
4721
            case 0x00:
4722
                $type = \PhpSpreadsheet\Cell\DataValidation::TYPE_NONE;
4723
                break;
4724
            case 0x01:
4725
                $type = \PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE;
4726
                break;
4727
            case 0x02:
4728
                $type = \PhpSpreadsheet\Cell\DataValidation::TYPE_DECIMAL;
4729
                break;
4730
            case 0x03:
4731
                $type = \PhpSpreadsheet\Cell\DataValidation::TYPE_LIST;
4732
                break;
4733
            case 0x04:
4734
                $type = \PhpSpreadsheet\Cell\DataValidation::TYPE_DATE;
4735
                break;
4736
            case 0x05:
4737
                $type = \PhpSpreadsheet\Cell\DataValidation::TYPE_TIME;
4738
                break;
4739
            case 0x06:
4740
                $type = \PhpSpreadsheet\Cell\DataValidation::TYPE_TEXTLENGTH;
4741
                break;
4742
            case 0x07:
4743
                $type = \PhpSpreadsheet\Cell\DataValidation::TYPE_CUSTOM;
4744
                break;
4745
        }
4746
4747
        // bit: 4-6; mask: 0x00000070; error type
4748
        $errorStyle = (0x00000070 & $options) >> 4;
@@ 4779-4804 (lines=26) @@
4776
4777
        // bit: 20-23; mask: 0x00F00000; condition operator
4778
        $operator = (0x00F00000 & $options) >> 20;
4779
        switch ($operator) {
4780
            case 0x00:
4781
                $operator = \PhpSpreadsheet\Cell\DataValidation::OPERATOR_BETWEEN;
4782
                break;
4783
            case 0x01:
4784
                $operator = \PhpSpreadsheet\Cell\DataValidation::OPERATOR_NOTBETWEEN;
4785
                break;
4786
            case 0x02:
4787
                $operator = \PhpSpreadsheet\Cell\DataValidation::OPERATOR_EQUAL;
4788
                break;
4789
            case 0x03:
4790
                $operator = \PhpSpreadsheet\Cell\DataValidation::OPERATOR_NOTEQUAL;
4791
                break;
4792
            case 0x04:
4793
                $operator = \PhpSpreadsheet\Cell\DataValidation::OPERATOR_GREATERTHAN;
4794
                break;
4795
            case 0x05:
4796
                $operator = \PhpSpreadsheet\Cell\DataValidation::OPERATOR_LESSTHAN;
4797
                break;
4798
            case 0x06:
4799
                $operator = \PhpSpreadsheet\Cell\DataValidation::OPERATOR_GREATERTHANOREQUAL;
4800
                break;
4801
            case 0x07:
4802
                $operator = \PhpSpreadsheet\Cell\DataValidation::OPERATOR_LESSTHANOREQUAL;
4803
                break;
4804
        }
4805
4806
        // offset: 4; size: var; title of the prompt box
4807
        $offset = 4;

src/PhpSpreadsheet/Writer/Excel5/Worksheet.php 2 locations

@@ 2794-2819 (lines=26) @@
2791
2792
                // data type
2793
                $type = $dataValidation->getType();
2794
                switch ($type) {
2795
                    case \PhpSpreadsheet\Cell\DataValidation::TYPE_NONE:
2796
                        $type = 0x00;
2797
                        break;
2798
                    case \PhpSpreadsheet\Cell\DataValidation::TYPE_WHOLE:
2799
                        $type = 0x01;
2800
                        break;
2801
                    case \PhpSpreadsheet\Cell\DataValidation::TYPE_DECIMAL:
2802
                        $type = 0x02;
2803
                        break;
2804
                    case \PhpSpreadsheet\Cell\DataValidation::TYPE_LIST:
2805
                        $type = 0x03;
2806
                        break;
2807
                    case \PhpSpreadsheet\Cell\DataValidation::TYPE_DATE:
2808
                        $type = 0x04;
2809
                        break;
2810
                    case \PhpSpreadsheet\Cell\DataValidation::TYPE_TIME:
2811
                        $type = 0x05;
2812
                        break;
2813
                    case \PhpSpreadsheet\Cell\DataValidation::TYPE_TEXTLENGTH:
2814
                        $type = 0x06;
2815
                        break;
2816
                    case \PhpSpreadsheet\Cell\DataValidation::TYPE_CUSTOM:
2817
                        $type = 0x07;
2818
                        break;
2819
                }
2820
                $options |= $type << 0;
2821
2822
                // error style
@@ 2856-2881 (lines=26) @@
2853
2854
                // condition operator
2855
                $operator = $dataValidation->getOperator();
2856
                switch ($operator) {
2857
                    case \PhpSpreadsheet\Cell\DataValidation::OPERATOR_BETWEEN:
2858
                        $operator = 0x00;
2859
                        break;
2860
                    case \PhpSpreadsheet\Cell\DataValidation::OPERATOR_NOTBETWEEN:
2861
                        $operator = 0x01;
2862
                        break;
2863
                    case \PhpSpreadsheet\Cell\DataValidation::OPERATOR_EQUAL:
2864
                        $operator = 0x02;
2865
                        break;
2866
                    case \PhpSpreadsheet\Cell\DataValidation::OPERATOR_NOTEQUAL:
2867
                        $operator = 0x03;
2868
                        break;
2869
                    case \PhpSpreadsheet\Cell\DataValidation::OPERATOR_GREATERTHAN:
2870
                        $operator = 0x04;
2871
                        break;
2872
                    case \PhpSpreadsheet\Cell\DataValidation::OPERATOR_LESSTHAN:
2873
                        $operator = 0x05;
2874
                        break;
2875
                    case \PhpSpreadsheet\Cell\DataValidation::OPERATOR_GREATERTHANOREQUAL:
2876
                        $operator = 0x06;
2877
                        break;
2878
                    case \PhpSpreadsheet\Cell\DataValidation::OPERATOR_LESSTHANOREQUAL:
2879
                        $operator = 0x07;
2880
                        break;
2881
                }
2882
                $options |= $operator << 20;
2883
2884
                $data        = pack('V', $options);