| Total Complexity | 7 |
| Total Lines | 96 |
| Duplicated Lines | 0 % |
| Coverage | 30.43% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class Timezone extends Model |
||
| 12 | { |
||
| 13 | /** @var int */ |
||
| 14 | protected $id; |
||
| 15 | |||
| 16 | /** @var string */ |
||
| 17 | protected $name; |
||
| 18 | |||
| 19 | /** @var string */ |
||
| 20 | protected $abbr; |
||
| 21 | |||
| 22 | /** @var int */ |
||
| 23 | protected $offsetSec; |
||
| 24 | |||
| 25 | /** @var string */ |
||
| 26 | protected $label; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * parse |
||
| 30 | * |
||
| 31 | * @param array $data |
||
| 32 | * @author Casper Rasmussen <[email protected]> |
||
| 33 | */ |
||
| 34 | 5 | public function parse(array $data) |
|
| 35 | { |
||
| 36 | 5 | $this->id = (int)$data['id']; |
|
| 37 | 5 | $this->name = (string)$data['name']; |
|
| 38 | 5 | $this->abbr = (string)$data['abbr']; |
|
| 39 | 5 | $this->offsetSec = (int)$data['offset_sec']; |
|
| 40 | 5 | $this->label = (string)$data['label']; |
|
| 41 | 5 | } |
|
| 42 | |||
| 43 | /** |
||
| 44 | * toArray |
||
| 45 | * |
||
| 46 | * @return array |
||
| 47 | * @author Casper Rasmussen <[email protected]> |
||
| 48 | */ |
||
| 49 | public function toArray(): array |
||
| 50 | { |
||
| 51 | return [ |
||
| 52 | 'id' => $this->id, |
||
| 53 | 'name' => $this->name, |
||
| 54 | 'abbr' => $this->abbr, |
||
| 55 | 'offset_sec' => $this->offsetSec, |
||
| 56 | 'label' => $this->label, |
||
| 57 | ]; |
||
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * @return int |
||
| 62 | * @author Casper Rasmussen <[email protected]> |
||
| 63 | */ |
||
| 64 | public function getId(): int |
||
| 65 | { |
||
| 66 | return $this->id; |
||
| 67 | } |
||
| 68 | |||
| 69 | /** |
||
| 70 | * @return string |
||
| 71 | * @author Casper Rasmussen <[email protected]> |
||
| 72 | */ |
||
| 73 | public function getName(): string |
||
| 74 | { |
||
| 75 | return $this->name; |
||
| 76 | } |
||
| 77 | |||
| 78 | /** |
||
| 79 | * @return string |
||
| 80 | * @author Casper Rasmussen <[email protected]> |
||
| 81 | */ |
||
| 82 | public function getAbbr(): string |
||
| 83 | { |
||
| 84 | return $this->abbr; |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * getOffsetSec |
||
| 89 | * |
||
| 90 | * @return int |
||
| 91 | * @author Casper Rasmussen <[email protected]> |
||
| 92 | */ |
||
| 93 | public function getOffsetSec(): int |
||
| 96 | } |
||
| 97 | |||
| 98 | /** |
||
| 99 | * getLabel |
||
| 100 | * |
||
| 101 | * @return string |
||
| 102 | * @author Casper Rasmussen <[email protected]> |
||
| 103 | */ |
||
| 104 | public function getLabel(): string |
||
| 107 | } |
||
| 108 | } |