CustomCollection   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A newCollect() 0 5 1
1
<?php
2
3
namespace Helix\Shopify;
4
5
use Helix\Shopify\Collection\AbstractCollection;
6
use Helix\Shopify\CustomCollection\CustomCollect;
7
8
/**
9
 * A custom collection.
10
 *
11
 * @see https://shopify.dev/docs/admin-api/rest/reference/products/customcollection
12
 *
13
 * @method bool     isPublished     ()
14
 * @method $this    setPublished    (bool $published)
15
 */
16
class CustomCollection extends AbstractCollection
17
{
18
19
    const TYPE = 'custom_collection';
20
    const DIR = 'custom_collections';
21
22
    /**
23
     * @param Product $product
24
     * @return CustomCollect
25
     */
26
    public function newCollect(Product $product)
27
    {
28
        return $this->api->factory($this, CustomCollect::class, [
29
            'collection_id' => $this->getId(),
30
            'product_id' => $product->getId()
31
        ]);
32
    }
33
}