1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Passbook package. |
5
|
|
|
* |
6
|
|
|
* (c) Eymen Gunay <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Passbook\Apple; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Beacon |
16
|
|
|
* |
17
|
|
|
* @author Sotaro Omura <http://omoon.org> |
18
|
|
|
*/ |
19
|
|
|
class Beacon implements BeaconInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* Unique identifier of a Bluetooth Low Energy location beacon. |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
protected $proximityUUID; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Major identifier of a Bluetooth Low Energy location beacon. |
29
|
|
|
* @var integer |
30
|
|
|
*/ |
31
|
|
|
protected $major; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Minor identifier of a Bluetooth Low Energy location beacon. |
35
|
|
|
* @var integer |
36
|
|
|
*/ |
37
|
|
|
protected $minor; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Text displayed on the lock screen when the pass is currently relevant. |
41
|
|
|
* For example, a description of the nearby location such as |
42
|
|
|
* “Store nearby on 1st and Main.” |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
protected $relevantText; |
46
|
|
|
|
47
|
3 |
|
public function __construct($proximityUUID) |
48
|
|
|
{ |
49
|
|
|
// Required |
50
|
3 |
|
$this->setProximityUUID($proximityUUID); |
51
|
|
|
} |
52
|
|
|
|
53
|
2 |
|
public function toArray() |
54
|
|
|
{ |
55
|
2 |
|
$array = [ |
56
|
2 |
|
'proximityUUID' => $this->getProximityUUID() |
57
|
2 |
|
]; |
58
|
|
|
|
59
|
2 |
|
if ($major = $this->getMajor()) { |
60
|
1 |
|
$array['major'] = $major; |
61
|
|
|
} |
62
|
|
|
|
63
|
2 |
|
if ($minor = $this->getMinor()) { |
64
|
1 |
|
$array['minor'] = $minor; |
65
|
|
|
} |
66
|
|
|
|
67
|
2 |
|
if ($relevantText = $this->getRelevantText()) { |
68
|
1 |
|
$array['relevantText'] = $relevantText; |
69
|
|
|
} |
70
|
|
|
|
71
|
2 |
|
return $array; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* {@inheritdoc} |
76
|
|
|
*/ |
77
|
2 |
|
public function setMajor($major) |
78
|
|
|
{ |
79
|
2 |
|
$this->major = $major; |
80
|
|
|
|
81
|
2 |
|
return $this; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* {@inheritdoc} |
86
|
|
|
*/ |
87
|
3 |
|
public function getMajor() |
88
|
|
|
{ |
89
|
3 |
|
return $this->major; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* {@inheritdoc} |
94
|
|
|
*/ |
95
|
2 |
|
public function setMinor($minor) |
96
|
|
|
{ |
97
|
2 |
|
$this->minor = $minor; |
98
|
|
|
|
99
|
2 |
|
return $this; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* {@inheritdoc} |
104
|
|
|
*/ |
105
|
3 |
|
public function getMinor() |
106
|
|
|
{ |
107
|
3 |
|
return $this->minor; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* {@inheritdoc} |
112
|
|
|
*/ |
113
|
3 |
|
public function setProximityUUID($proximityUUID) |
114
|
|
|
{ |
115
|
3 |
|
$this->proximityUUID = $proximityUUID; |
116
|
|
|
|
117
|
3 |
|
return $this; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* {@inheritdoc} |
122
|
|
|
*/ |
123
|
3 |
|
public function getProximityUUID() |
124
|
|
|
{ |
125
|
3 |
|
return $this->proximityUUID; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
/** |
129
|
|
|
* {@inheritdoc} |
130
|
|
|
*/ |
131
|
1 |
|
public function setRelevantText($relevantText) |
132
|
|
|
{ |
133
|
1 |
|
$this->relevantText = $relevantText; |
134
|
|
|
|
135
|
1 |
|
return $this; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* {@inheritdoc} |
140
|
|
|
*/ |
141
|
2 |
|
public function getRelevantText() |
142
|
|
|
{ |
143
|
2 |
|
return $this->relevantText; |
144
|
|
|
} |
145
|
|
|
} |
146
|
|
|
|