Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
CRAP | |
100.00% |
1 / 1 |
| Address | |
100.00% |
7 / 7 |
|
100.00% |
3 / 3 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| jsonSerialize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| toArray | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package phpOMS\Stdlib\Base |
| 8 | * @copyright Dennis Eichhorn |
| 9 | * @license OMS License 2.0 |
| 10 | * @version 1.0.0 |
| 11 | * @link https://jingga.app |
| 12 | */ |
| 13 | declare(strict_types=1); |
| 14 | |
| 15 | namespace phpOMS\Stdlib\Base; |
| 16 | |
| 17 | /** |
| 18 | * Address class. |
| 19 | * |
| 20 | * @package phpOMS\Stdlib\Base |
| 21 | * @license OMS License 2.0 |
| 22 | * @link https://jingga.app |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | class Address implements \JsonSerializable |
| 26 | { |
| 27 | /** |
| 28 | * Name of the receiver. |
| 29 | * |
| 30 | * @var string |
| 31 | * @since 1.0.0 |
| 32 | */ |
| 33 | public string $recipient = ''; |
| 34 | |
| 35 | /** |
| 36 | * Sub of the address. |
| 37 | * |
| 38 | * @var string |
| 39 | * @since 1.0.0 |
| 40 | */ |
| 41 | public string $fao = ''; |
| 42 | |
| 43 | /** |
| 44 | * Location. |
| 45 | * |
| 46 | * @var Location |
| 47 | * @since 1.0.0 |
| 48 | */ |
| 49 | public Location $location; |
| 50 | |
| 51 | /** |
| 52 | * Constructor. |
| 53 | * |
| 54 | * @since 1.0.0 |
| 55 | */ |
| 56 | public function __construct() |
| 57 | { |
| 58 | $this->location = new Location(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * {@inheritdoc} |
| 63 | */ |
| 64 | public function jsonSerialize() : mixed |
| 65 | { |
| 66 | return $this->toArray(); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * {@inheritdoc} |
| 71 | */ |
| 72 | public function toArray() : array |
| 73 | { |
| 74 | return [ |
| 75 | 'recipient' => $this->recipient, |
| 76 | 'fao' => $this->fao, |
| 77 | 'location' => $this->location->toArray(), |
| 78 | ]; |
| 79 | } |
| 80 | } |