Passed
Push — master ( 0676a7...01ab94 )
by Artem
11:54
created

Invoice::__get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 5
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
// ---------------------------------------------------------------------
4
//
5
//  Copyright (C) 2018-2024 Artem Rodygin
6
//
7
//  You should have received a copy of the MIT License along with
8
//  this file. If not, see <https://opensource.org/licenses/MIT>.
9
//
10
// ---------------------------------------------------------------------
11
12
namespace Linode\Account;
13
14
use Linode\Account\Repository\InvoiceItemRepository;
15
use Linode\Entity;
16
17
/**
18
 * Account Invoice object.
19
 *
20
 * @property int                            $id       The Invoice's unique ID.
21
 * @property string                         $date     When this Invoice was generated.
22
 * @property string                         $label    The Invoice's display label.
23
 * @property float                          $subtotal The amount of the Invoice before taxes in US Dollars.
24
 * @property float                          $tax      The amount of tax levied on the Invoice in US Dollars.
25
 * @property float                          $total    The amount of the Invoice after taxes in US Dollars.
26
 * @property InvoiceItemRepositoryInterface $items    Invoice items.
27
 */
28
class Invoice extends Entity
29
{
30
    // Available fields.
31
    public const FIELD_ID       = 'id';
32
    public const FIELD_DATE     = 'date';
33
    public const FIELD_LABEL    = 'label';
34
    public const FIELD_SUBTOTAL = 'subtotal';
35
    public const FIELD_TAX      = 'tax';
36
    public const FIELD_TOTAL    = 'total';
37
38
    /**
39
     * @codeCoverageIgnore This method was autogenerated.
40
     */
41
    public function __get(string $name): mixed
42
    {
43
        return match ($name) {
44
            'items' => new InvoiceItemRepository($this->client, $this->id),
45
            default => parent::__get($name),
46
        };
47
    }
48
}
49