Completed
Pull Request — master (#15)
by Nick
04:01
created

DecideResponse::getTouchIdentifier()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace Acquia\LiftClient\Entity;
4
5
class DecideResponse extends Entity
6
{
7
    /**
8
     * Gets the 'touch_identifier' parameter.
9
     *
10
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
11
     *
12
     * @return string
13
     */
14
    public function getTouchIdentifier()
15
    {
16
        $lwr = $this->getLiftWebResponse();
17
        return $lwr->getEntityValue('touch_identifier', '');
18
    }
19
20
    private function getLiftWebResponse() {
21
        $lwr = $this->getEntityValue('lift_web_response', []);
22
        return new Entity($lwr);
23
    }
24
25
    /**
26
     * Gets the 'identity' parameter.
27
     *
28
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
29
     *
30
     * @return string
31
     */
32
    public function getIdentity()
33
    {
34
        $lwr = $this->getLiftWebResponse();
35
        return $lwr->getEntityValue('identity', '');
36
    }
37
38
    /**
39
     * Gets the 'identity_source' parameter.
40
     *
41
     * Type of visitor's primary identity information. Specific string (account, email,
42
     * facebook, twitter, tracking, name) or custom identifier type
43
     *
44
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
45
     *
46
     * @return int
47
     */
48
    public function getIdentityExpiry()
49
    {
50
        $lwr = $this->getLiftWebResponse();
51
        return $lwr->getEntityValue('identity_expiry', 0);
52
    }
53
54
    /**
55
     * Gets the 'segments' parameter.
56
     *
57
     * @return Segment[]
58
     */
59 View Code Duplication
    public function getMatchedSegments()
60
    {
61
        $lwr = $this->getLiftWebResponse();
62
        $ret = [];
63
        $segments = $lwr->getEntityValue('segments', []);
64
        foreach ($segments as $segment) {
65
            $ret[] = new Segment($segment);
66
        }
67
68
        return $ret;
69
    }
70
71
    /**
72
     * gets the 'set_do_not_track' parameter.
73
     *
74
     * Flag to indicate whether the person should not be tracked
75
     *
76
     * @throws \Acquia\LiftClient\Exception\LiftSdkException
77
     *
78
     * @return bool
79
     */
80
    public function getSetDoNotTrack()
81
    {
82
        return $this->getEntityValue('set_do_not_track', false);
83
    }
84
85
    /**
86
     * Gets the 'matched_segments' parameter.
87
     *
88
     * @return Segment[]
89
     */
90
    public function getDecisions()
91
    {
92
        $ret = [];
93
        $decisions = $this->getEntityValue('decisions', []);
94
        foreach ($decisions as $decision) {
95
            $ret[] = new Decision($decision);
96
        }
97
98
        return $ret;
99
    }
100
}
101