|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Botonomous; |
|
4
|
|
|
|
|
5
|
|
|
use Botonomous\client\ApiClient; |
|
6
|
|
|
use Botonomous\utility\LoggerUtility; |
|
7
|
|
|
use Botonomous\utility\MessageUtility; |
|
8
|
|
|
use /* @noinspection PhpUndefinedClassInspection */ |
|
9
|
|
|
GuzzleHttp\Client; |
|
10
|
|
|
|
|
11
|
|
|
abstract class AbstractSender |
|
12
|
|
|
{ |
|
13
|
|
|
private $loggerUtility; |
|
14
|
|
|
private $messageUtility; |
|
15
|
|
|
private $config; |
|
16
|
|
|
private $apiClient; |
|
17
|
|
|
private $client; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @return LoggerUtility |
|
21
|
|
|
*/ |
|
22
|
9 |
|
public function getLoggerUtility() |
|
23
|
|
|
{ |
|
24
|
9 |
|
if (!isset($this->loggerUtility)) { |
|
25
|
9 |
|
$this->setLoggerUtility(new LoggerUtility()); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
9 |
|
return $this->loggerUtility; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @param LoggerUtility $loggerUtility |
|
33
|
|
|
*/ |
|
34
|
9 |
|
public function setLoggerUtility(LoggerUtility $loggerUtility) |
|
35
|
|
|
{ |
|
36
|
9 |
|
$this->loggerUtility = $loggerUtility; |
|
37
|
9 |
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @return Config |
|
41
|
|
|
*/ |
|
42
|
3 |
|
public function getConfig() |
|
43
|
|
|
{ |
|
44
|
3 |
|
if (!isset($this->config)) { |
|
45
|
2 |
|
$this->config = (new Config()); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
3 |
|
return $this->config; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @param Config $config |
|
53
|
|
|
*/ |
|
54
|
1 |
|
public function setConfig(Config $config) |
|
55
|
|
|
{ |
|
56
|
1 |
|
$this->config = $config; |
|
57
|
1 |
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @return ApiClient |
|
61
|
|
|
*/ |
|
62
|
3 |
|
public function getApiClient() |
|
63
|
|
|
{ |
|
64
|
3 |
|
if (!isset($this->apiClient)) { |
|
65
|
1 |
|
$this->setApiClient(new ApiClient()); |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
3 |
|
return $this->apiClient; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* @param ApiClient $apiClient |
|
73
|
|
|
*/ |
|
74
|
3 |
|
public function setApiClient(ApiClient $apiClient) |
|
75
|
|
|
{ |
|
76
|
3 |
|
$this->apiClient = $apiClient; |
|
77
|
3 |
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @return Client |
|
81
|
|
|
*/ |
|
82
|
2 |
|
public function getClient() |
|
83
|
|
|
{ |
|
84
|
2 |
|
if (!isset($this->client)) { |
|
85
|
1 |
|
$this->setClient(new Client()); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
2 |
|
return $this->client; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @param Client $client |
|
93
|
|
|
*/ |
|
94
|
2 |
|
public function setClient(Client $client) |
|
95
|
|
|
{ |
|
96
|
2 |
|
$this->client = $client; |
|
97
|
2 |
|
} |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @return MessageUtility |
|
101
|
|
|
*/ |
|
102
|
1 |
|
public function getMessageUtility() |
|
103
|
|
|
{ |
|
104
|
1 |
|
if (!isset($this->messageUtility)) { |
|
105
|
1 |
|
$this->setMessageUtility(new MessageUtility()); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
1 |
|
return $this->messageUtility; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
|
|
/** |
|
112
|
|
|
* @param MessageUtility $messageUtility |
|
113
|
|
|
*/ |
|
114
|
1 |
|
public function setMessageUtility(MessageUtility $messageUtility) |
|
115
|
|
|
{ |
|
116
|
1 |
|
$this->messageUtility = $messageUtility; |
|
117
|
1 |
|
} |
|
118
|
|
|
} |
|
119
|
|
|
|