1 | <?php |
||
17 | class Client |
||
18 | { |
||
19 | const ENV_DEV = 'dev'; |
||
20 | const ENV_PRODUCTION = 'production'; |
||
21 | |||
22 | /** |
||
23 | * This URL is used for testing purposes |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $testServerUrl = 'http://sstest.consignor.com/ship/ShipmentServerModule.dll'; |
||
28 | |||
29 | /** |
||
30 | * This URL is used for production requests |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $productionServerUrl = 'https://www.shipmentserver.com/ship/ShipmentServerModule.dll'; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $actor; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $key; |
||
45 | |||
46 | /** |
||
47 | * Should be either 'dev' or 'production' |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $environment; |
||
52 | |||
53 | /** |
||
54 | * @var HttpClient |
||
55 | */ |
||
56 | protected $httpClient; |
||
57 | |||
58 | /** |
||
59 | * @var RequestFactory |
||
60 | */ |
||
61 | protected $requestFactory; |
||
62 | |||
63 | /** |
||
64 | * This is the last request |
||
65 | * |
||
66 | * @var PsrRequestInterface|null |
||
67 | */ |
||
68 | protected $request; |
||
69 | |||
70 | /** |
||
71 | * This is the last PSR response (differs from the response returned form the doRequest method) |
||
72 | * |
||
73 | * @var PsrResponseInterface|null |
||
74 | */ |
||
75 | protected $response; |
||
76 | |||
77 | 1 | public function __construct(string $actor, string $key, array $plugins = [], HttpClient $httpClient = null, RequestFactory $requestFactory = null, string $environment = 'production') |
|
89 | |||
90 | /** |
||
91 | * @param RequestInterface $request |
||
92 | * @return ResponseInterface |
||
93 | */ |
||
94 | 1 | public function doRequest(RequestInterface $request) : ResponseInterface |
|
127 | |||
128 | /** |
||
129 | * @return string |
||
130 | */ |
||
131 | 1 | public function getActor(): string |
|
135 | |||
136 | /** |
||
137 | * @return null|PsrRequestInterface |
||
138 | */ |
||
139 | 1 | public function getRequest(): ?PsrRequestInterface |
|
143 | |||
144 | /** |
||
145 | * @return null|PsrResponseInterface |
||
146 | */ |
||
147 | 1 | public function getResponse(): ?PsrResponseInterface |
|
151 | } |
||
152 |