Passed
Push — main ( 0b6967...cc8184 )
by Dylan
02:05
created

Collection::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 2
nc 2
nop 2
1
<?php
2
3
namespace Lifeboat\Models;
4
5
use Lifeboat\Connector;
6
use Lifeboat\Services\Collections;
7
8
/**
9
 * Class Customer
10
 * @package Lifeboat\Models
11
 *
12
 * @property string|null $Description
13
 * @property int $Priority
14
 * @property bool $isAuto
15
 * @property bool $MatchAny
16
 * @property array|null $Rules
17
 * @property array $Products
18
 * @property array $Tags
19
 * @property string|null $Thumbnail
20
 */
21
class Collection extends Model {
22
23
    protected static array $casting = [
24
        'ExcludeFromSitemap'    => 'boolval',
25
        'isAuto'                => 'boolval',
26
        'MatchAny'              => 'boolval'
27
    ];
28
29
    public function __construct(Connector $client, array $_object_data = [])
30
    {
31
        parent::__construct($client, $_object_data);
32
        if (array_key_exists('Rules', $_object_data)) {
33
            $this->Rules = json_decode($_object_data['Rules'], true);
34
        }
35
    }
36
37
    /**
38
     * @return string
39
     */
40
    public function model(): string
41
    {
42
        return 'Collection';
43
    }
44
45
    /**
46
     * @return Collections
47
     */
48
    public function getService(): Collections
49
    {
50
        return new Collections($this->getClient());
51
    }
52
}
53