Passed
Push — master ( 199ece...6bc7da )
by y
02:13
created

AbstractCollect::getProduct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Helix\Shopify\Collection;
4
5
use Helix\Shopify\Base\AbstractEntity;
6
use Helix\Shopify\Base\AbstractEntity\CreateTrait;
7
use Helix\Shopify\Base\AbstractEntity\DeleteTrait;
8
use Helix\Shopify\Base\AbstractEntity\ImmutableInterface;
9
use Helix\Shopify\Product;
10
11
/**
12
 * A link between a collection and a product.
13
 *
14
 * @immutable Collects can only be created and deleted.
15
 *
16
 * @see https://shopify.dev/docs/admin-api/rest/reference/products/collect
17
 *
18
 * @method string   getCollectionId () injected
19
 * @method string   getCreatedAt    ()
20
 * @method string   getPosition     ()
21
 * @method string   getProductId    () injected
22
 * @method string   getSortValue    ()
23
 * @method string   getUpdatedAt    ()
24
 */
25
abstract class AbstractCollect extends AbstractEntity implements ImmutableInterface {
26
27
    use CreateTrait;
28
    use DeleteTrait;
29
30
    const TYPE = 'collect';
31
    const DIR = 'collects';
32
33
    /**
34
     * @return AbstractCollection
35
     */
36
    abstract public function getCollection ();
37
38
    /**
39
     * @return Product
40
     */
41
    public function getProduct () {
42
        return Product::load($this, $this->getProductId());
43
    }
44
}