1 | <?php |
||
7 | abstract class Gateway |
||
8 | { |
||
9 | /** |
||
10 | * The HTTP client instance. |
||
11 | * |
||
12 | * @var \CryptoMarkets\Common\Client |
||
13 | */ |
||
14 | protected $httpClient; |
||
15 | |||
16 | /** |
||
17 | * The gateway's options. |
||
18 | * |
||
19 | * @var array |
||
20 | */ |
||
21 | protected $options = []; |
||
22 | |||
23 | /** |
||
24 | * Create a new Gateway instance. |
||
25 | * |
||
26 | * @param array $options |
||
27 | * @return void |
||
|
|||
28 | */ |
||
29 | public function __construct(array $options = []) |
||
33 | |||
34 | /** |
||
35 | * Merge the custom options with the defaults. |
||
36 | * |
||
37 | * @param array $options |
||
38 | * @return void |
||
39 | */ |
||
40 | public function setOptions(array $options = []) |
||
44 | |||
45 | /** |
||
46 | * Get the options. |
||
47 | * |
||
48 | * @return array |
||
49 | */ |
||
50 | public function getOptions() |
||
54 | |||
55 | /** |
||
56 | * et the specified option value (if any). |
||
57 | * |
||
58 | * @param string $key |
||
59 | * @param mixed $default |
||
60 | * @return mixed |
||
61 | */ |
||
62 | public function getOption($key, $default = null) |
||
66 | |||
67 | /** |
||
68 | * Get the default options. |
||
69 | * |
||
70 | * @return array |
||
71 | */ |
||
72 | public function getDefaultOptions() |
||
76 | |||
77 | /** |
||
78 | * Get the gateway name. |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | abstract public function getName(); |
||
83 | |||
84 | /** |
||
85 | * Create a new request object. |
||
86 | * |
||
87 | * @param string $class |
||
88 | * @param array $params |
||
89 | * @return \CryptoMarkets\Common\Http\Request |
||
90 | */ |
||
91 | public function createRequest($class, array $params = []) |
||
97 | |||
98 | /** |
||
99 | * Get a instance of the HTTP client. |
||
100 | * |
||
101 | * @return \CryptoMarkets\Common\Client |
||
102 | */ |
||
103 | public function getHttpClient() |
||
111 | |||
112 | /** |
||
113 | * Set the HTTP client instance. |
||
114 | * |
||
115 | * @param \CryptoMarkets\Common\Client $client |
||
116 | * @return $this |
||
117 | */ |
||
118 | public function setHttpClient(Client $client) |
||
124 | } |
||
125 |
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.