AbstractCollect::getProduct()   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\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
28
    use CreateTrait;
29
    use DeleteTrait;
30
31
    const TYPE = 'collect';
32
    const DIR = 'collects';
33
34
    /**
35
     * @return AbstractCollection
36
     */
37
    abstract public function getCollection();
38
39
    /**
40
     * @return Product
41
     */
42
    public function getProduct()
43
    {
44
        return Product::load($this, $this->getProductId());
45
    }
46
}