Total Complexity | 4 |
Total Lines | 27 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
6 | class Symbol |
||
7 | { |
||
8 | /** @var string */ |
||
9 | private $value; |
||
10 | |||
11 | /** @var array */ |
||
12 | public static $table = []; |
||
13 | |||
14 | public static function make($sym): self |
||
15 | { |
||
16 | if (isset(static::$table[$sym])) { |
||
17 | return static::$table[$sym]; |
||
18 | } |
||
19 | |||
20 | static::$table[$sym] = new static($sym); |
||
21 | |||
22 | return static::$table[$sym]; |
||
23 | } |
||
24 | |||
25 | private function __construct($value) |
||
26 | { |
||
27 | $this->value = $value; |
||
28 | } |
||
29 | |||
30 | public function __toString() |
||
33 | } |
||
34 | |||
35 | } |