1 | <?php |
||
15 | class Client |
||
16 | { |
||
17 | const ENV_DEV = 'dev'; |
||
18 | const ENV_PRODUCTION = 'production'; |
||
19 | |||
20 | /** |
||
21 | * This URL is used for testing purposes |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $testServerUrl = 'http://sstest.consignor.com/ship/ShipmentServerModule.dll'; |
||
26 | |||
27 | /** |
||
28 | * This URL is used for production requests |
||
29 | * |
||
30 | * @var string |
||
31 | */ |
||
32 | protected $productionServerUrl = 'https://www.shipmentserver.com/ship/ShipmentServerModule.dll'; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $actor; |
||
38 | |||
39 | /** |
||
40 | * @var string |
||
41 | */ |
||
42 | protected $key; |
||
43 | |||
44 | /** |
||
45 | * Should be either 'dev' or 'production' |
||
46 | * |
||
47 | * @var string |
||
48 | */ |
||
49 | protected $environment; |
||
50 | |||
51 | /** |
||
52 | * @var HttpClient |
||
53 | */ |
||
54 | protected $httpClient; |
||
55 | |||
56 | /** |
||
57 | * @var RequestFactory |
||
58 | */ |
||
59 | protected $requestFactory; |
||
60 | |||
61 | /** |
||
62 | * This is the last request |
||
63 | * |
||
64 | * @var PsrRequestInterface|null |
||
65 | */ |
||
66 | protected $request; |
||
67 | |||
68 | /** |
||
69 | * This is the last response |
||
70 | * |
||
71 | * @var ResponseInterface|null |
||
72 | */ |
||
73 | protected $response; |
||
74 | |||
75 | 1 | public function __construct(string $actor, string $key, HttpClient $httpClient = null, RequestFactory $requestFactory = null, string $environment = 'production') |
|
85 | |||
86 | 1 | public function doRequest(RequestInterface $request) : array |
|
115 | |||
116 | /** |
||
117 | * @return null|PsrRequestInterface |
||
118 | */ |
||
119 | public function getRequest(): ?PsrRequestInterface |
||
123 | |||
124 | /** |
||
125 | * @return null|ResponseInterface |
||
126 | */ |
||
127 | public function getResponse(): ?ResponseInterface |
||
131 | } |
||
132 |