1 | <?php namespace Arcanedev\Currencies\Converters; |
||
14 | abstract class AbstractConverter implements CurrencyConverter |
||
15 | { |
||
16 | /* ------------------------------------------------------------------------------------------------ |
||
17 | | Properties |
||
18 | | ------------------------------------------------------------------------------------------------ |
||
19 | */ |
||
20 | /** |
||
21 | * The base URL. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $baseUrl = ''; |
||
26 | |||
27 | /** |
||
28 | * @var \Arcanedev\Currencies\Contracts\Http\Client |
||
29 | */ |
||
30 | protected $client; |
||
31 | |||
32 | /** |
||
33 | * The cache repository. |
||
34 | * |
||
35 | * @var \Illuminate\Contracts\Cache\Repository |
||
36 | */ |
||
37 | protected $cache; |
||
38 | |||
39 | /** |
||
40 | * The enabled cache status. |
||
41 | * |
||
42 | * @var bool |
||
43 | */ |
||
44 | protected $cacheEnabled; |
||
45 | |||
46 | /** |
||
47 | * The cache key name. |
||
48 | * |
||
49 | * @var string |
||
50 | */ |
||
51 | protected $cacheKey; |
||
52 | |||
53 | /** |
||
54 | * The cache duration. |
||
55 | * |
||
56 | * @var int |
||
57 | */ |
||
58 | protected $cacheDuration; |
||
59 | |||
60 | /* ------------------------------------------------------------------------------------------------ |
||
61 | | Constructor |
||
62 | | ------------------------------------------------------------------------------------------------ |
||
63 | */ |
||
64 | /** |
||
65 | * AbstractConverter constructor. |
||
66 | * |
||
67 | * @param \Arcanedev\Currencies\Contracts\Http\Client $client |
||
68 | * @param \Illuminate\Contracts\Cache\Repository $cache |
||
69 | * @param array $configs |
||
70 | */ |
||
71 | 24 | public function __construct(ClientContract $client, CacheContract $cache, array $configs = []) |
|
78 | |||
79 | /* ------------------------------------------------------------------------------------------------ |
||
80 | | Getters & Setters |
||
81 | | ------------------------------------------------------------------------------------------------ |
||
82 | */ |
||
83 | /** |
||
84 | * Get the base URL. |
||
85 | * |
||
86 | * @return string |
||
87 | */ |
||
88 | 12 | public function getBaseUrl() |
|
92 | |||
93 | /** |
||
94 | * Get the default currency. |
||
95 | * |
||
96 | * @return string |
||
97 | */ |
||
98 | 12 | public function getDefaultCurrency() |
|
102 | |||
103 | /** |
||
104 | * Get the supported currencies. |
||
105 | * |
||
106 | * @return array |
||
107 | */ |
||
108 | 12 | public function getSupportedCurrencies() |
|
112 | |||
113 | /** |
||
114 | * Set the cache configs. |
||
115 | * |
||
116 | * @param array $configs |
||
117 | */ |
||
118 | 24 | protected function setCacheConfigs(array $configs) |
|
124 | |||
125 | /** |
||
126 | * Set the configs. |
||
127 | * |
||
128 | * @param array $configs |
||
129 | * |
||
130 | * @return mixed |
||
131 | */ |
||
132 | abstract protected function setProviderConfigs(array $configs); |
||
133 | |||
134 | /** |
||
135 | * Check if cache is enabled. |
||
136 | * |
||
137 | * @return bool |
||
138 | */ |
||
139 | 12 | public function isCacheEnabled() |
|
143 | |||
144 | /* ------------------------------------------------------------------------------------------------ |
||
145 | | Main Functions |
||
146 | | ------------------------------------------------------------------------------------------------ |
||
147 | */ |
||
148 | } |
||
149 |