Completed
Push — master ( c9d352...0a28f2 )
by Francesco
10:28
created

UserListClient::preProcess()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
c 0
b 0
f 0
rs 9.2
cc 4
eloc 6
nc 4
nop 1
1
<?php
2
3
namespace Audiens\DoubleclickClient\entity;
4
5
class UserListClient
6
{
7
    use HydratableTrait;
8
9
    public const        STATUS_ACTIVE   = 'ACTIVE';
10
    public const        STATUS_INACTIVE = 'INACTIVE';
11
    public const        STATUS_UNKNOWN  = 'UNKNOWN';
12
13
    /** @var string @required */
14
    protected $userlistid;
15
16
    /** @var string|null */
17
    protected $clientcustomername;
18
19
    /** @var string @required */
20
    protected $status;
21
22
    /** @var string|null */
23
    protected $userlistname;
24
25
    /** @var UserListPricing|null */
26
    protected $pricingInfo;
27
28
    /** @var string @required */
29
    protected $clientproduct;
30
31
    /** @var string @required */
32
    protected $clientid;
33
34
    public function setUserlistid(string $userlistid): void
35
    {
36
        $this->userlistid = $userlistid;
37
    }
38
39
    public function setStatus(string $status): void
40
    {
41
        $this->status = $status;
42
    }
43
44
    public function getStatus(): string
45
    {
46
        return $this->status;
47
    }
48
49
    public function setUserlistname(string $userlistname): void
50
    {
51
        $this->userlistname = $userlistname;
52
    }
53
54
    public function setPricingInfo(UserListPricing $pricingInfo): void
55
    {
56
        $this->pricingInfo = $pricingInfo;
57
    }
58
59
    public function setClientproduct(string $clientproduct): void
60
    {
61
        $this->clientproduct = $clientproduct;
62
    }
63
64
    public function setClientid(string $clientid): void
65
    {
66
        $this->clientid = $clientid;
67
    }
68
69
    public function getUserlistid(): string
70
    {
71
        return $this->userlistid;
72
    }
73
74
    public function getClientcustomername(): ?string
75
    {
76
        return $this->clientcustomername;
77
    }
78
79
    public function getUserlistname(): ?string
80
    {
81
        return $this->userlistname;
82
    }
83
84
    public function getPricingInfo(): ?UserListPricing
85
    {
86
        return $this->pricingInfo;
87
    }
88
89
    public function getClientproduct(): string
90
    {
91
        return $this->clientproduct;
92
    }
93
94
    public function getClientid(): string
95
    {
96
        return $this->clientid;
97
    }
98
99
    public static function preProcess(array $objectArray): array
100
    {
101
        if (isset($objectArray['clientcustomername']) && \is_array($objectArray['clientcustomername'])) {
102
            $objectArray['clientcustomername'] = implode(',', $objectArray['clientcustomername']) ?? '';
103
        }
104
105
        if (array_key_exists('pricinginfo', $objectArray)) {
106
            $objectArray['pricingInfo'] = UserListPricing::fromArray($objectArray['pricinginfo']);
107
        }
108
109
        return $objectArray;
110
    }
111
}
112