|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Aosmak\Laravel\Layer\Sdk\Services\Subservices; |
|
4
|
|
|
|
|
5
|
|
|
use GuzzleHttp\ClientInterface; |
|
6
|
|
|
use Aosmak\Laravel\Layer\Sdk\Routers\RouterInterface; |
|
7
|
|
|
use Aosmak\Laravel\Layer\Sdk\Services\Subservices\Interfaces\RequestServiceInterface; |
|
8
|
|
|
use Aosmak\Laravel\Layer\Sdk\Services\Subservices\Interfaces\BaseServiceInterface; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Class BaseService |
|
12
|
|
|
* @package namespace Aosmak\Laravel\Layer\Sdk\Services\Subservices |
|
13
|
|
|
*/ |
|
14
|
|
|
abstract class BaseService implements BaseServiceInterface |
|
15
|
|
|
{ |
|
16
|
|
|
/** |
|
17
|
|
|
* Router |
|
18
|
|
|
* |
|
19
|
|
|
* @var \Aosmak\Laravel\Layer\Sdk\Routers\RouterInterface |
|
20
|
|
|
*/ |
|
21
|
|
|
protected $router; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* Request service |
|
25
|
|
|
* |
|
26
|
|
|
* @var \Aosmak\Laravel\Layer\Sdk\Services\Subservices\Interfaces\RequestServiceInterface |
|
27
|
|
|
*/ |
|
28
|
|
|
private $requestService; |
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* Set a Guzzle client |
|
32
|
|
|
* |
|
33
|
|
|
* @param \GuzzleHttp\ClientInterface $client |
|
34
|
|
|
* |
|
35
|
|
|
* @return void |
|
36
|
|
|
*/ |
|
37
|
53 |
|
public function setClient(ClientInterface $client): void |
|
38
|
|
|
{ |
|
39
|
53 |
|
$this->requestService->setClient($client); |
|
40
|
53 |
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* Set a request service |
|
44
|
|
|
* |
|
45
|
|
|
* @param \Aosmak\Laravel\Layer\Sdk\Services\Subservices\Interfaces\RequestServiceInterface $requestService |
|
46
|
|
|
* |
|
47
|
|
|
* @return void |
|
48
|
|
|
*/ |
|
49
|
53 |
|
public function setRequestService(RequestServiceInterface $requestService): void |
|
50
|
|
|
{ |
|
51
|
53 |
|
$this->requestService = $requestService; |
|
52
|
53 |
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Set a configuration array |
|
56
|
|
|
* |
|
57
|
|
|
* @param array $config configuration array |
|
58
|
|
|
* |
|
59
|
|
|
* @return void |
|
60
|
|
|
*/ |
|
61
|
53 |
|
public function setConfig(array $config): void |
|
62
|
|
|
{ |
|
63
|
53 |
|
$this->requestService->setConfig($config); |
|
64
|
53 |
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Set a router |
|
68
|
|
|
* |
|
69
|
|
|
* @param \Aosmak\Laravel\Layer\Sdk\Routers\RouterInterface $router router |
|
70
|
|
|
* |
|
71
|
|
|
* @return void |
|
72
|
|
|
*/ |
|
73
|
53 |
|
public function setRouter(RouterInterface $router): void |
|
74
|
|
|
{ |
|
75
|
53 |
|
$this->router = $router; |
|
76
|
53 |
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* Get a request service |
|
80
|
|
|
* |
|
81
|
|
|
* @return \Aosmak\Laravel\Layer\Sdk\Services\Subservices\Interfaces\RequestServiceInterface |
|
82
|
|
|
*/ |
|
83
|
87 |
|
public function getRequestService(): RequestServiceInterface |
|
84
|
|
|
{ |
|
85
|
87 |
|
return $this->requestService; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Get a router |
|
90
|
|
|
* |
|
91
|
|
|
* @return \Aosmak\Laravel\Layer\Sdk\Routers\RouterInterface |
|
92
|
|
|
*/ |
|
93
|
85 |
|
public function getRouter(): RouterInterface |
|
94
|
|
|
{ |
|
95
|
85 |
|
return $this->router; |
|
96
|
|
|
} |
|
97
|
|
|
} |
|
98
|
|
|
|