DiscountCode::getPriceRule()   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\PriceRule;
4
5
use Helix\Shopify\Base\AbstractEntity;
6
use Helix\Shopify\Base\AbstractEntity\CrudTrait;
7
use Helix\Shopify\PriceRule;
8
9
/**
10
 * A price rule discount code.
11
 *
12
 * @see https://help.shopify.com/en/api/reference/discounts/discountcode
13
 *
14
 * @method string   getCode         ()
15
 * @method string   getCreatedAt    ()
16
 * @method string   getPriceRuleId  () injected
17
 * @method string   getUpdatedAt    ()
18
 * @method int      getUsageCount   ()
19
 *
20
 * @method $this    setCode         (string $code)
21
 */
22
class DiscountCode extends AbstractEntity
23
{
24
25
    use CrudTrait;
26
27
    const TYPE = 'discount_code';
28
    const DIR = 'discount_codes';
29
30
    protected function _container()
31
    {
32
        return $this->getPriceRule();
33
    }
34
35
    /**
36
     * @return PriceRule
37
     */
38
    public function getPriceRule()
39
    {
40
        return PriceRule::load($this, $this->getPriceRuleId());
41
    }
42
}