|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Hborras\TwitterAdsSDK\TwitterAds\TailoredAudience; |
|
4
|
|
|
|
|
5
|
|
|
use Hborras\TwitterAdsSDK\TwitterAds; |
|
6
|
|
|
use Hborras\TwitterAdsSDK\Arrayable; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* Represents a Tailored Audience member |
|
10
|
|
|
* |
|
11
|
|
|
* @since 2016-06-27 |
|
12
|
|
|
*/ |
|
13
|
|
|
final class TailoredAudienceMember implements Arrayable |
|
14
|
|
|
{ |
|
15
|
|
|
const TYPE_TAWEB_PARTNER_USER_ID = 'TAWEB_PARTNER_USER_ID'; |
|
16
|
|
|
|
|
17
|
|
|
protected $advertiser_account_id; |
|
18
|
|
|
protected $user_identifier; |
|
19
|
|
|
protected $user_identifier_type = self::TYPE_TAWEB_PARTNER_USER_ID; |
|
20
|
|
|
protected $score = 0; |
|
21
|
|
|
protected $audience_names = []; |
|
22
|
|
|
protected $effective_at; |
|
23
|
|
|
protected $expires_at; |
|
24
|
|
|
|
|
25
|
|
|
protected $properties = [ |
|
26
|
|
|
'advertiser_account_id', |
|
27
|
|
|
'user_identifier', |
|
28
|
|
|
'user_identifier_type', |
|
29
|
|
|
'score', |
|
30
|
|
|
'audience_names', |
|
31
|
|
|
'effective_at', |
|
32
|
|
|
'expires_at', |
|
33
|
|
|
]; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* {@inheritdoc} |
|
37
|
|
|
*/ |
|
38
|
|
|
public function getId() |
|
39
|
|
|
{ |
|
40
|
|
|
return null; |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getAdvertiserAccountId() |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->advertiser_account_id; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function setAdvertiserAccountId($id) |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->advertiser_account_id = $id; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getUserIdentifier() |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->user_identifier; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function setUserIdentifier($id) |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->user_identifier = $id; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function getUserIdentifierType() |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->user_identifier_type; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function setUserIdentifierType($type) |
|
69
|
|
|
{ |
|
70
|
|
|
$this->user_identifier_type = $type; |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
public function getScore() |
|
74
|
|
|
{ |
|
75
|
|
|
return $this->score; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
public function setScore($score) |
|
79
|
|
|
{ |
|
80
|
|
|
$this->score = $score; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
public function getAudienceNames() |
|
84
|
|
|
{ |
|
85
|
|
|
return implode(', ', $this->audience_names); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
public function setAudienceNames(array $names) |
|
89
|
|
|
{ |
|
90
|
|
|
$this->audience_names = explode(', ', $names); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
public function getEffectiveAt() |
|
94
|
|
|
{ |
|
95
|
|
|
return $this->effective_at; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
public function setEffectiveAt(\DateTimeInterface $date) |
|
99
|
|
|
{ |
|
100
|
|
|
$this->effective_at = $date; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
public function getExpiresAt() |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->expires_at; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
public function setExpiresAt(\DateTimeInterface $date) |
|
109
|
|
|
{ |
|
110
|
|
|
$this->expires_at = $date; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
|
|
public function toArray() |
|
114
|
|
|
{ |
|
115
|
|
|
return [ |
|
116
|
|
|
'advertiser_account_id' => $this->getAdvertiserAccountId(), |
|
117
|
|
|
'user_identifier' => $this->getUserIdentifier(), |
|
118
|
|
|
'user_identifier_type' => $this->getUserIdentifierType(), |
|
119
|
|
|
'score' => $this->getScore(), |
|
120
|
|
|
'audience_names' => $this->getAudienceNames(), |
|
121
|
|
|
'effective_at' => $this->getEffectiveAt(), |
|
122
|
|
|
'expires_at' => $this->getExpiresAt(), |
|
123
|
|
|
]; |
|
124
|
|
|
} |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* @return array |
|
128
|
|
|
*/ |
|
129
|
|
|
public function getProperties() |
|
130
|
|
|
{ |
|
131
|
|
|
return $this->properties; |
|
132
|
|
|
} |
|
133
|
|
|
} |
|
134
|
|
|
|