Total Complexity | 10 |
Total Lines | 85 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class Field |
||
9 | { |
||
10 | /** |
||
11 | * Indicates the number of characters/positions the information uses. |
||
12 | */ |
||
13 | protected int $size; |
||
14 | |||
15 | /** |
||
16 | * Identifies the information starting position in the file. |
||
17 | */ |
||
18 | protected int $start; |
||
19 | |||
20 | /** |
||
21 | * Indicates the type of information the field holds. |
||
22 | */ |
||
23 | protected Type $type; |
||
24 | |||
25 | /** |
||
26 | * Identifies field name. |
||
27 | */ |
||
28 | protected string $name = ''; |
||
29 | |||
30 | /** |
||
31 | * The field contents. |
||
32 | */ |
||
33 | protected $content; |
||
34 | |||
35 | 51 | public function getSize(): int |
|
36 | { |
||
37 | 51 | return $this->size; |
|
38 | } |
||
39 | |||
40 | 51 | public function setSize(int $size): self |
|
41 | { |
||
42 | 51 | $this->size = $size; |
|
43 | |||
44 | 51 | return $this; |
|
45 | } |
||
46 | |||
47 | 51 | public function getStart(): int |
|
48 | { |
||
49 | 51 | return $this->start; |
|
50 | } |
||
51 | |||
52 | 51 | public function setStart(int $start): self |
|
53 | { |
||
54 | 51 | $this->start = $start; |
|
55 | |||
56 | 51 | return $this; |
|
57 | } |
||
58 | |||
59 | 55 | public function getType(): Type |
|
60 | { |
||
61 | 55 | return $this->type ?? new Any(); |
|
62 | } |
||
63 | |||
64 | 55 | public function setType(Type $type): self |
|
65 | { |
||
66 | 55 | $this->type = $type; |
|
67 | |||
68 | 55 | return $this; |
|
69 | } |
||
70 | |||
71 | 4 | public function getName(): string |
|
72 | { |
||
73 | 4 | return $this->name; |
|
74 | } |
||
75 | |||
76 | 53 | public function setName(string $name): self |
|
77 | { |
||
78 | 53 | $this->name = $name; |
|
79 | |||
80 | 53 | return $this; |
|
81 | } |
||
82 | |||
83 | 8 | public function getContent() |
|
86 | } |
||
87 | |||
88 | 55 | public function setContent(string $content): self |
|
89 | { |
||
90 | 55 | $this->content = $this->getType()->castFromLine($this, $content); |
|
91 | |||
92 | 51 | return $this; |
|
93 | } |
||
94 | } |
||
95 |