Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
83.33% |
5 / 6 |
|
75.00% |
3 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Balance | |
83.33% |
5 / 6 |
|
75.00% |
3 / 4 |
4.07 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getId | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| toArray | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
1 | |||
| jsonSerialize | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package Modules\Accounting\Models |
| 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 Modules\Accounting\Models; |
| 16 | |
| 17 | /** |
| 18 | * Balance class. |
| 19 | * |
| 20 | * @package Modules\Accounting\Models |
| 21 | * @license OMS License 2.0 |
| 22 | * @link https://jingga.app |
| 23 | * @since 1.0.0 |
| 24 | */ |
| 25 | class Balance |
| 26 | { |
| 27 | /** |
| 28 | * ID. |
| 29 | * |
| 30 | * @var int |
| 31 | * @since 1.0.0 |
| 32 | */ |
| 33 | public int $id = 0; |
| 34 | |
| 35 | /** |
| 36 | * Balance data. |
| 37 | * |
| 38 | * @var array |
| 39 | * @since 1.0.0 |
| 40 | */ |
| 41 | public array $balance = []; |
| 42 | |
| 43 | /** |
| 44 | * Localization. |
| 45 | * |
| 46 | * @var BalanceL11n |
| 47 | * @since 1.0.0 |
| 48 | */ |
| 49 | public BalanceL11n $l11n; |
| 50 | |
| 51 | /** |
| 52 | * Constructor. |
| 53 | * |
| 54 | * @since 1.0.0 |
| 55 | */ |
| 56 | public function __construct() |
| 57 | { |
| 58 | $this->l11n = new BalanceL11n(); |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Get balance id |
| 63 | * |
| 64 | * @return int |
| 65 | * |
| 66 | * @since 1.0.0 |
| 67 | */ |
| 68 | public function getId() : int |
| 69 | { |
| 70 | return $this->id; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * {@inheritdoc} |
| 75 | */ |
| 76 | public function toArray() : array |
| 77 | { |
| 78 | return [ |
| 79 | 'id' => $this->id, |
| 80 | ]; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * {@inheritdoc} |
| 85 | */ |
| 86 | public function jsonSerialize() : mixed |
| 87 | { |
| 88 | return $this->toArray(); |
| 89 | } |
| 90 | } |