-
Notifications
You must be signed in to change notification settings - Fork 456
Expand file tree
/
Copy pathSMS.php
More file actions
85 lines (74 loc) · 1.53 KB
/
SMS.php
File metadata and controls
85 lines (74 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
namespace SimpleSoftwareIO\QrCode\DataTypes;
class SMS implements DataTypeInterface
{
/**
* The prefix of the QrCode.
*
* @var string
*/
protected $prefix = 'sms:';
/**
* The separator between the variables.
*
* @var string
*/
protected $separator = '&body=';
/**
* The phone number.
*
* @var string
*/
protected $phoneNumber;
/**
* The SMS message.
*
* @var string
*/
protected $message;
/**
* Generates the DataType Object and sets all of its properties.
*
* @param $arguments
*/
public function create(array $arguments)
{
$this->setProperties($arguments);
}
/**
* Returns the correct QrCode format.
*
* @return string
*/
public function __toString()
{
return $this->buildSMSString();
}
/**
* Sets the phone number and message for a sms message.
*
* @param array $arguments
*/
protected function setProperties(array $arguments)
{
if (isset($arguments[0])) {
$this->phoneNumber = $arguments[0];
}
if (isset($arguments[1])) {
$this->message = $arguments[1];
}
}
/**
* Builds a SMS string.
*
* @return string
*/
protected function buildSMSString()
{
$sms = $this->prefix.$this->phoneNumber;
if (isset($this->message)) {
$sms .= $this->separator.$this->message;
}
return $sms;
}
}