Theme   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAssets() 0 3 1
A newAsset() 0 4 1
1
<?php
2
3
namespace Helix\Shopify;
4
5
use Helix\Shopify\Base\AbstractEntity;
6
use Helix\Shopify\Base\AbstractEntity\CrudTrait;
7
use Helix\Shopify\Theme\Asset;
8
9
/**
10
 * A theme.
11
 *
12
 * @see https://shopify.dev/docs/admin-api/rest/reference/online-store/theme
13
 *
14
 * @method $this setSrc (string $src) @depends create-only
15
 *
16
 * @method string   getCreatedAt    () read-only
17
 * @method string   getName         ()
18
 * @method bool     isPreviewable   () read-only
19
 * @method bool     isProcessing    () read-only
20
 * @method string   getRole         ()
21
 * @method string   getSrc          ()
22
 * @method string   getThemeStoreId () read-only
23
 * @method string   getUpdatedAt    () read-only
24
 *
25
 * @method $this setName (string $name)
26
 * @method $this setRole (string $role)
27
 */
28
class Theme extends AbstractEntity
29
{
30
31
    use CrudTrait;
32
33
    const TYPE = 'theme';
34
    const DIR = 'themes';
35
36
    const ROLE_MAIN = 'main';
37
    const ROLE_UNPUBLISHED = 'unpublished';
38
    const ROLE_DEMO = 'demo';
39
40
    /**
41
     * @return Asset[]
42
     */
43
    public function getAssets()
44
    {
45
        return Asset::loadAll($this, "{$this}/assets");
46
    }
47
48
    /**
49
     * @return Asset
50
     */
51
    public function newAsset()
52
    {
53
        return $this->api->factory($this, Asset::class, [
54
            'theme_id' => $this->getId()
55
        ]);
56
    }
57
}