GiftCard::getOrder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Helix\Shopify;
4
5
use Helix\Shopify\Base\AbstractEntity;
6
use Helix\Shopify\Base\AbstractEntity\CreateTrait;
7
use Helix\Shopify\Base\AbstractEntity\UpdateTrait;
8
9
/**
10
 * A Shopify+ gift card.
11
 *
12
 * Gift cards cannot be deleted.
13
 *
14
 * @see https://shopify.dev/docs/admin-api/rest/reference/plus/giftcard
15
 *
16
 * @method $this setCode            (string $code) @depends create-only, write-only
17
 * @method $this setInitialValue    (number $value) @depends create-only
18
 *
19
 * @method string       getApiClientId      ()
20
 * @method number       getBalance          ()
21
 * @method string       getCreatedAt        ()
22
 * @method string       getCurrency         ()
23
 * @method string       getCustomerId       ()
24
 * @method string       getDisabledAt       ()
25
 * @method null|string  getExpiresOn        ()
26
 * @method number       getInitialValue     ()
27
 * @method string       getLastCharacters   () read-only
28
 * @method string       getLineItemId       ()
29
 * @method string       getNote             ()
30
 * @method string       getOrderId          ()
31
 * @method null|string  getTemplateSuffix   ()
32
 * @method string       getUpdatedAt        ()
33
 * @method string       getUserId           ()
34
 *
35
 * @method $this setApiClientId     (string $id)
36
 * @method $this setBalance         (number $balance)
37
 * @method $this setCreatedAt       (string $iso8601)
38
 * @method $this setCurrency        (string $currency)
39
 * @method $this setCustomerId      (string $id)
40
 * @method $this setDisabledAt      (string $iso8601)
41
 * @method $this setExpiresOn       (?string $date)
42
 * @method $this setLineItemId      (string $id)
43
 * @method $this setNote            (string $note)
44
 * @method $this setOrderId         (string $id)
45
 * @method $this setTemplateSuffix  (?string $suffix)
46
 * @method $this setUpdatedAt       (string $iso8601)
47
 * @method $this setUserId          (string $id)
48
 */
49
class GiftCard extends AbstractEntity
50
{
51
52
    use CreateTrait;
53
    use UpdateTrait;
54
55
    const TYPE = 'gift_card';
56
    const DIR = 'gift_cards';
57
58
    const SEARCH_STATUS_DISABLED = 'disabled';
59
    const SEARCH_STATUS_ENABLED = 'enabled';
60
61
    /**
62
     * @return Customer
63
     */
64
    public function getCustomer()
65
    {
66
        return Customer::load($this, $this->getCustomerId());
67
    }
68
69
    /**
70
     * @return Order
71
     */
72
    public function getOrder()
73
    {
74
        return Order::load($this, $this->getOrderId());
75
    }
76
77
    /**
78
     * @return User
79
     */
80
    public function getUser()
81
    {
82
        return User::load($this, $this->getUserId());
83
    }
84
85
}