Total Complexity | 8 |
Total Lines | 80 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
17 | final class Field |
||
18 | { |
||
19 | /** @var array|string */ |
||
20 | private $typecast; |
||
21 | |||
22 | /** @var string */ |
||
23 | private $column; |
||
24 | |||
25 | /** @var bool */ |
||
26 | private $referenced = false; |
||
27 | |||
28 | /** |
||
29 | * @param array|string $typecast |
||
30 | * @return Field |
||
31 | */ |
||
32 | public function setTypecast($typecast) |
||
33 | { |
||
34 | $this->typecast = $typecast; |
||
35 | |||
36 | return $this; |
||
37 | } |
||
38 | |||
39 | /** |
||
40 | * @return bool |
||
41 | */ |
||
42 | public function hasTypecast(): bool |
||
43 | { |
||
44 | return $this->typecast !== null; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @return array|string |
||
49 | */ |
||
50 | public function getTypecast() |
||
51 | { |
||
52 | return $this->typecast; |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * @param string $column |
||
57 | * @return Field |
||
58 | */ |
||
59 | public function setColumn(string $column): Field |
||
60 | { |
||
61 | $this->column = $column; |
||
62 | |||
63 | return $this; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | * |
||
69 | * @throws FieldException |
||
70 | */ |
||
71 | public function getColumn(): string |
||
72 | { |
||
73 | if (empty($this->column)) { |
||
74 | throw new FieldException("Column mapping must be set"); |
||
75 | } |
||
76 | |||
77 | return $this->column; |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * @param bool $indexed |
||
82 | * @return Field |
||
83 | */ |
||
84 | public function setReferenced(bool $indexed): Field |
||
85 | { |
||
86 | $this->referenced = $indexed; |
||
87 | |||
88 | return $this; |
||
89 | } |
||
90 | |||
91 | /** |
||
92 | * @return bool |
||
93 | */ |
||
94 | public function isReferenced(): bool |
||
97 | } |
||
98 | } |