Ptg   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 141
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 4
Bugs 1 Features 0
Metric Value
wmc 6
c 4
b 1
f 0
lcom 1
cbo 0
dl 0
loc 141
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A exists() 0 6 1
A get() 0 6 2
A cache() 0 6 2
B getAll() 0 96 1
1
<?php
2
3
namespace Xls;
4
5
class Ptg
6
{
7
    /**
8
     * @var null|array
9
     */
10
    protected static $ptgs = null;
11
12
    /**
13
     * @param $ptg
14
     *
15
     * @return bool
16
     */
17
    public static function exists($ptg)
18
    {
19
        self::cache();
20
21
        return isset(self::$ptgs[$ptg]);
22
    }
23
24
    /**
25
     * @param $ptg
26
     *
27
     * @return bool
28
     */
29
    public static function get($ptg)
30
    {
31
        self::cache();
32
33
        return isset(self::$ptgs[$ptg]) ? self::$ptgs[$ptg] : null;
34
    }
35
36
    /**
37
     *
38
     */
39
    protected static function cache()
40
    {
41
        if (is_null(self::$ptgs)) {
42
            self::$ptgs = self::getAll();
43
        }
44
    }
45
46
    /**
47
     * @return array
48
     */
49
    public static function getAll()
50
    {
51
        return array(
52
            'ptgExp' => 0x01,
53
            'ptgTbl' => 0x02,
54
            'ptgAdd' => 0x03,
55
            'ptgSub' => 0x04,
56
            'ptgMul' => 0x05,
57
            'ptgDiv' => 0x06,
58
            'ptgPower' => 0x07,
59
            'ptgConcat' => 0x08,
60
            'ptgLT' => 0x09,
61
            'ptgLE' => 0x0A,
62
            'ptgEQ' => 0x0B,
63
            'ptgGE' => 0x0C,
64
            'ptgGT' => 0x0D,
65
            'ptgNE' => 0x0E,
66
            'ptgIsect' => 0x0F,
67
            'ptgUnion' => 0x10,
68
            'ptgRange' => 0x11,
69
            'ptgUplus' => 0x12,
70
            'ptgUminus' => 0x13,
71
            'ptgPercent' => 0x14,
72
            'ptgParen' => 0x15,
73
            'ptgMissArg' => 0x16,
74
            'ptgStr' => 0x17,
75
            'ptgAttr' => 0x19,
76
            'ptgSheet' => 0x1A,
77
            'ptgEndSheet' => 0x1B,
78
            'ptgErr' => 0x1C,
79
            'ptgBool' => 0x1D,
80
            'ptgInt' => 0x1E,
81
            'ptgNum' => 0x1F,
82
            'ptgArray' => 0x20,
83
            'ptgFunc' => 0x21,
84
            'ptgFuncVar' => 0x22,
85
            'ptgName' => 0x23,
86
            'ptgRef' => 0x24,
87
            'ptgArea' => 0x25,
88
            'ptgMemArea' => 0x26,
89
            'ptgMemErr' => 0x27,
90
            'ptgMemNoMem' => 0x28,
91
            'ptgMemFunc' => 0x29,
92
            'ptgRefErr' => 0x2A,
93
            'ptgAreaErr' => 0x2B,
94
            'ptgRefN' => 0x2C,
95
            'ptgAreaN' => 0x2D,
96
            'ptgMemAreaN' => 0x2E,
97
            'ptgNameX' => 0x39,
98
            'ptgRef3d' => 0x3A,
99
            'ptgArea3d' => 0x3B,
100
            'ptgRefErr3d' => 0x3C,
101
            'ptgArrayV' => 0x40,
102
            'ptgFuncV' => 0x41,
103
            'ptgFuncVarV' => 0x42,
104
            'ptgNameV' => 0x43,
105
            'ptgRefV' => 0x44,
106
            'ptgAreaV' => 0x45,
107
            'ptgMemAreaV' => 0x46,
108
            'ptgMemErrV' => 0x47,
109
            'ptgMemNoMemV' => 0x48,
110
            'ptgMemFuncV' => 0x49,
111
            'ptgRefErrV' => 0x4A,
112
            'ptgAreaErrV' => 0x4B,
113
            'ptgRefNV' => 0x4C,
114
            'ptgAreaNV' => 0x4D,
115
            'ptgMemAreaNV' => 0x4E,
116
            'ptgFuncCEV' => 0x58,
117
            'ptgNameXV' => 0x59,
118
            'ptgRef3dV' => 0x5A,
119
            'ptgArea3dV' => 0x5B,
120
            'ptgRefErr3dV' => 0x5C,
121
            'ptgArrayA' => 0x60,
122
            'ptgFuncA' => 0x61,
123
            'ptgFuncVarA' => 0x62,
124
            'ptgNameA' => 0x63,
125
            'ptgRefA' => 0x64,
126
            'ptgAreaA' => 0x65,
127
            'ptgMemAreaA' => 0x66,
128
            'ptgMemErrA' => 0x67,
129
            'ptgMemNoMemA' => 0x68,
130
            'ptgMemFuncA' => 0x69,
131
            'ptgRefErrA' => 0x6A,
132
            'ptgAreaErrA' => 0x6B,
133
            'ptgRefNA' => 0x6C,
134
            'ptgAreaNA' => 0x6D,
135
            'ptgMemAreaNA' => 0x6E,
136
            'ptgMemNoMemN' => 0x6F,
137
            'ptgFuncCEA' => 0x78,
138
            'ptgNameXA' => 0x79,
139
            'ptgRef3dA' => 0x7A,
140
            'ptgArea3dA' => 0x7B,
141
            'ptgRefErr3dA' => 0x7C,
142
            'ptgAreaErr3d' => 0x7D
143
        );
144
    }
145
}
146