-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathAbstractSMS.php
More file actions
82 lines (72 loc) · 1.68 KB
/
Copy pathAbstractSMS.php
File metadata and controls
82 lines (72 loc) · 1.68 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
<?php
namespace SimpleSoftwareIO\SMS\Drivers;
use SimpleSoftwareIO\SMS\IncomingMessage;
use SimpleSoftwareIO\SMS\SMSNotSentException;
abstract class AbstractSMS
{
protected $debug;
/**
* Throw a not sent exception.
*
* @param string $message
* @param null|int $code
*
* @throws SMSNotSentException
*/
protected function throwNotSentException($message, $code = null)
{
throw new SMSNotSentException($message, $code);
}
/**
* Creates a new IncomingMessage instance.
*
* @return IncomingMessage
*/
protected function createIncomingMessage()
{
return new IncomingMessage();
}
/**
* Creates many IncomingMessage objects.
*
* @param string $rawMessages
*
* @return array
*/
protected function makeMessages($rawMessages)
{
$incomingMessages = [];
foreach ($rawMessages as $rawMessage) {
$incomingMessages[] = $this->processReceive($rawMessage);
}
return $incomingMessages;
}
/**
* Creates a single IncomingMessage object.
*
* @param string $rawMessage
*
* @return mixed
*/
protected function makeMessage($rawMessage)
{
return $this->processReceive($rawMessage);
}
/**
* Creates many IncomingMessage objects and sets all of the properties.
*
* @param string $rawMessage
*
* @return mixed
*/
abstract protected function processReceive($rawMessage);
/**
* Defines if debug is enabled or disabled (SMS77).
*
* @param $debug
*/
public function setDebug($debug)
{
$this->debug = $debug;
}
}