Completed
Push — master ( 91a0f5...aaf4d8 )
by Giacomo "Mr. Wolf"
01:50
created

BeesWaxSegmentUserData::getUserId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Audiens\BeesWax\Segment;
4
5
use JsonSerializable;
6
7
class BeesWaxSegmentUserData implements JsonSerializable
8
{
9
    public const USER_ID_TYPE_BEESWAX_COOKIE = 'BEESWAX';
10
    public const USER_ID_TYPE_CUSTOMER = 'CUSTOMER';
11
    public const USER_ID_TYPE_IDFA = 'IDFA';
12
    public const USER_ID_TYPE_IDFA_MD5 = 'IDFA_MD5';
13
    public const USER_ID_TYPE_IDFA_SHA = 'IDFA_SHA';
14
    public const USER_ID_TYPE_AD_ID = 'AD_ID';
15
    public const USER_ID_TYPE_AD_ID_MD5 = 'AD_ID_MD5';
16
    public const USER_ID_TYPE_AD_ID_SHA = 'AD_ID_SHA';
17
    public const USER_ID_TYPE_IP_ADDRESS = 'IP_ADDRESS';
18
19
    /** @var string */
20
    protected $userId;
21
22
    /** @var string[] */
23
    protected $segments;
24
25
    /**
26
     * BeesWaxSegmentUserData constructor.
27
     *
28
     * @param string   $userId
29
     * @param string[] $segments
30
     *
31
     * @see BeesWaxSegmentUserData::USER_ID_TYPE_*
32
     */
33
    public function __construct(string $userId, array $segments)
34
    {
35
        $this->userId = $userId;
36
        $this->segments = $segments;
37
    }
38
39
    public function getUserId(): string
40
    {
41
        return $this->userId;
42
    }
43
44
    public function getSegments(): array
45
    {
46
        return $this->segments;
47
    }
48
49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function jsonSerialize()
53
    {
54
        return [
55
            'user_id' => $this->userId,
56
            'segments' => $this->segments,
57
        ];
58
    }
59
}
60