Failed Conditions
Pull Request — master (#3876)
by Abdul Malik
22:45 queued 13:31
created

ConditionalFormatting   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 33
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A type() 0 3 1
A operator() 0 3 1
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Reader\Xls;
4
5
use PhpOffice\PhpSpreadsheet\Style\Conditional;
6
7
class ConditionalFormatting
8
{
9
    /**
10
     * @var array<int, string>
11
     */
12
    private static array $types = [
13
        0x01 => Conditional::CONDITION_CELLIS,
14
        0x02 => Conditional::CONDITION_EXPRESSION,
15
    ];
16
17
    /**
18
     * @var array<int, string>
19
     */
20
    private static array $operators = [
21
        0x00 => Conditional::OPERATOR_NONE,
22
        0x01 => Conditional::OPERATOR_BETWEEN,
23
        0x02 => Conditional::OPERATOR_NOTBETWEEN,
24
        0x03 => Conditional::OPERATOR_EQUAL,
25
        0x04 => Conditional::OPERATOR_NOTEQUAL,
26
        0x05 => Conditional::OPERATOR_GREATERTHAN,
27
        0x06 => Conditional::OPERATOR_LESSTHAN,
28
        0x07 => Conditional::OPERATOR_GREATERTHANOREQUAL,
29
        0x08 => Conditional::OPERATOR_LESSTHANOREQUAL,
30
    ];
31
32 15
    public static function type(int $type): ?string
33
    {
34 15
        return self::$types[$type] ?? null;
35
    }
36
37 15
    public static function operator(int $operator): ?string
38
    {
39 15
        return self::$operators[$operator] ?? null;
40
    }
41
}
42