1 | <?php |
||
5 | abstract class Gateway implements GatewayInterface |
||
6 | { |
||
7 | /** |
||
8 | * The HTTP client instance. |
||
9 | * |
||
10 | * @var \CryptoMarkets\Common\Client |
||
11 | */ |
||
12 | protected $httpClient; |
||
13 | |||
14 | /** |
||
15 | * The gateway's options. |
||
16 | * |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $options = []; |
||
20 | |||
21 | /** |
||
22 | * Create a new Gateway instance. |
||
23 | * |
||
24 | * @param array $options |
||
25 | * @return void |
||
|
|||
26 | */ |
||
27 | public function __construct(array $options = []) |
||
31 | |||
32 | /** |
||
33 | * Merge the custom options with the defaults. |
||
34 | * |
||
35 | * @param array $options |
||
36 | * @return void |
||
37 | */ |
||
38 | public function setOptions(array $options = []) |
||
42 | |||
43 | /** |
||
44 | * Get the options. |
||
45 | * |
||
46 | * @return array |
||
47 | */ |
||
48 | public function getOptions() |
||
52 | |||
53 | /** |
||
54 | * et the specified option value (if any). |
||
55 | * |
||
56 | * @param string $key |
||
57 | * @param mixed $default |
||
58 | * @return mixed |
||
59 | */ |
||
60 | public function getOption($key, $default = null) |
||
64 | |||
65 | /** |
||
66 | * Get the default options. |
||
67 | * |
||
68 | * @return array |
||
69 | */ |
||
70 | public function getDefaultOptions() |
||
74 | |||
75 | /** |
||
76 | * Get the gateway name. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | abstract public function getName(); |
||
81 | |||
82 | /** |
||
83 | * Create a new request object. |
||
84 | * |
||
85 | * @param string $class |
||
86 | * @param array $params |
||
87 | * @return \CryptoMarkets\Common\Http\Request |
||
88 | */ |
||
89 | public function createRequest($class, array $params = []) |
||
95 | |||
96 | /** |
||
97 | * Get a instance of the HTTP client. |
||
98 | * |
||
99 | * @return \CryptoMarkets\Common\Client |
||
100 | */ |
||
101 | public function getHttpClient() |
||
109 | |||
110 | /** |
||
111 | * Set the HTTP client instance. |
||
112 | * |
||
113 | * @param \CryptoMarkets\Common\Client $client |
||
114 | * @return $this |
||
115 | */ |
||
116 | public function setHttpClient(Client $client) |
||
122 | } |
||
123 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.