DiscountCode   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 19
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A _container() 0 3 1
A getPriceRule() 0 3 1
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
}