| 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 | 66 | public function getSize(): int |
|
| 36 | { |
||
| 37 | 66 | return $this->size; |
|
| 38 | } |
||
| 39 | |||
| 40 | 66 | public function setSize(int $size): self |
|
| 41 | { |
||
| 42 | 66 | $this->size = $size; |
|
| 43 | |||
| 44 | 66 | return $this; |
|
| 45 | } |
||
| 46 | |||
| 47 | 64 | public function getStart(): int |
|
| 48 | { |
||
| 49 | 64 | return $this->start; |
|
| 50 | } |
||
| 51 | |||
| 52 | 66 | public function setStart(int $start): self |
|
| 53 | { |
||
| 54 | 66 | $this->start = $start; |
|
| 55 | |||
| 56 | 66 | return $this; |
|
| 57 | } |
||
| 58 | |||
| 59 | 68 | public function getType(): Type |
|
| 60 | { |
||
| 61 | 68 | return $this->type ?? new Any(); |
|
| 62 | } |
||
| 63 | |||
| 64 | 70 | public function setType(Type $type): self |
|
| 65 | { |
||
| 66 | 70 | $this->type = $type; |
|
| 67 | |||
| 68 | 70 | return $this; |
|
| 69 | } |
||
| 70 | |||
| 71 | 4 | public function getName(): string |
|
| 72 | { |
||
| 73 | 4 | return $this->name; |
|
| 74 | } |
||
| 75 | |||
| 76 | 68 | public function setName(string $name): self |
|
| 77 | { |
||
| 78 | 68 | $this->name = $name; |
|
| 79 | |||
| 80 | 68 | return $this; |
|
| 81 | } |
||
| 82 | |||
| 83 | 18 | public function getContent() |
|
| 86 | } |
||
| 87 | |||
| 88 | 68 | public function setContent(string $content): self |
|
| 89 | { |
||
| 90 | 68 | $this->content = $this->getType()->castFromLine($this, $content); |
|
| 91 | |||
| 92 | 64 | return $this; |
|
| 93 | } |
||
| 94 | } |
||
| 95 |