@@ -31,7 +31,7 @@ |
||
31 | 31 | * |
32 | 32 | * @var array |
33 | 33 | */ |
34 | - public static $crypto_enabled = []; |
|
34 | + public static $crypto_enabled = [ ]; |
|
35 | 35 | |
36 | 36 | /** |
37 | 37 | * Load all enabled cryptocurrencies. |
@@ -26,40 +26,40 @@ |
||
26 | 26 | |
27 | 27 | final class CryptocurrencyCollection |
28 | 28 | { |
29 | - /** |
|
30 | - * List of enabled cryptocurrencies. |
|
31 | - * |
|
32 | - * @var array |
|
33 | - */ |
|
34 | - public static $crypto_enabled = []; |
|
29 | + /** |
|
30 | + * List of enabled cryptocurrencies. |
|
31 | + * |
|
32 | + * @var array |
|
33 | + */ |
|
34 | + public static $crypto_enabled = []; |
|
35 | 35 | |
36 | - /** |
|
37 | - * Load all enabled cryptocurrencies. |
|
38 | - * |
|
39 | - * @param array $crypto_enabled |
|
40 | - * |
|
41 | - * @return \CryptoTech\Cryptocurrency\CryptocurrencyCollection |
|
42 | - */ |
|
43 | - public function loadEnabledCrypto(array $crypto_enabled): CryptocurrencyCollection |
|
44 | - { |
|
45 | - foreach ($crypto_enabled as $crypto) { |
|
46 | - $this->addCrypto($crypto); |
|
47 | - } |
|
36 | + /** |
|
37 | + * Load all enabled cryptocurrencies. |
|
38 | + * |
|
39 | + * @param array $crypto_enabled |
|
40 | + * |
|
41 | + * @return \CryptoTech\Cryptocurrency\CryptocurrencyCollection |
|
42 | + */ |
|
43 | + public function loadEnabledCrypto(array $crypto_enabled): CryptocurrencyCollection |
|
44 | + { |
|
45 | + foreach ($crypto_enabled as $crypto) { |
|
46 | + $this->addCrypto($crypto); |
|
47 | + } |
|
48 | 48 | |
49 | - return $this; |
|
50 | - } |
|
49 | + return $this; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Add a crypto to the cryptocurrencies list. |
|
54 | - * |
|
55 | - * @param string $crypto |
|
56 | - * |
|
57 | - * @return \CryptoTech\Cryptocurrency\CryptocurrencyCollection |
|
58 | - */ |
|
59 | - public function addCrypto($crypto): CryptocurrencyCollection |
|
60 | - { |
|
61 | - array_push(self::$crypto_enabled, $crypto); |
|
52 | + /** |
|
53 | + * Add a crypto to the cryptocurrencies list. |
|
54 | + * |
|
55 | + * @param string $crypto |
|
56 | + * |
|
57 | + * @return \CryptoTech\Cryptocurrency\CryptocurrencyCollection |
|
58 | + */ |
|
59 | + public function addCrypto($crypto): CryptocurrencyCollection |
|
60 | + { |
|
61 | + array_push(self::$crypto_enabled, $crypto); |
|
62 | 62 | |
63 | - return $this; |
|
64 | - } |
|
63 | + return $this; |
|
64 | + } |
|
65 | 65 | } |
@@ -83,21 +83,21 @@ discard block |
||
83 | 83 | * |
84 | 84 | * @var array |
85 | 85 | */ |
86 | - protected $website = []; |
|
86 | + protected $website = [ ]; |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Cryptocurrency explorer urls. |
90 | 90 | * |
91 | 91 | * @var array |
92 | 92 | */ |
93 | - protected $explorer = []; |
|
93 | + protected $explorer = [ ]; |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Cryptocurrency sourcecode url. |
97 | 97 | * |
98 | 98 | * @var array |
99 | 99 | */ |
100 | - protected $source_code = []; |
|
100 | + protected $source_code = [ ]; |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * {@inheritdoc} |
@@ -242,6 +242,6 @@ discard block |
||
242 | 242 | throw new CryptoNotEnabledException(sprintf('The cryptocurrency ("%s") you have selected is not enabled in your configuration!', $name)); |
243 | 243 | } |
244 | 244 | |
245 | - return call_user_func([new $class_name($name), 'build']); |
|
245 | + return call_user_func([ new $class_name($name), 'build' ]); |
|
246 | 246 | } |
247 | 247 | } |
@@ -29,219 +29,219 @@ |
||
29 | 29 | |
30 | 30 | class Cryptocurrency implements CryptocurrencyInterface |
31 | 31 | { |
32 | - /** |
|
33 | - * Cryptocurrency CoinMarketCap id. |
|
34 | - * |
|
35 | - * @var int |
|
36 | - */ |
|
37 | - protected $id = 0; |
|
38 | - |
|
39 | - /** |
|
40 | - * Cryptocurrency name. |
|
41 | - * |
|
42 | - * @var string |
|
43 | - */ |
|
44 | - protected $name = ''; |
|
45 | - |
|
46 | - /** |
|
47 | - * Cryptocurrency symbol. |
|
48 | - * |
|
49 | - * @var string |
|
50 | - */ |
|
51 | - protected $symbol = ''; |
|
52 | - |
|
53 | - /** |
|
54 | - * Cryptocurrency type. |
|
55 | - * |
|
56 | - * @var string |
|
57 | - */ |
|
58 | - protected $type = ''; |
|
59 | - |
|
60 | - /** |
|
61 | - * Cryptocurrency logo. |
|
62 | - * |
|
63 | - * @var string |
|
64 | - */ |
|
65 | - protected $logo = ''; |
|
66 | - |
|
67 | - /** |
|
68 | - * Cryptocurrency mineable. |
|
69 | - * |
|
70 | - * @var bool |
|
71 | - */ |
|
72 | - protected $mineable = false; |
|
73 | - |
|
74 | - /** |
|
75 | - * Cryptocurrency description. |
|
76 | - * |
|
77 | - * @var string |
|
78 | - */ |
|
79 | - protected $description = ''; |
|
80 | - |
|
81 | - /** |
|
82 | - * Cryptocurrency website url. |
|
83 | - * |
|
84 | - * @var array |
|
85 | - */ |
|
86 | - protected $website = []; |
|
87 | - |
|
88 | - /** |
|
89 | - * Cryptocurrency explorer urls. |
|
90 | - * |
|
91 | - * @var array |
|
92 | - */ |
|
93 | - protected $explorer = []; |
|
94 | - |
|
95 | - /** |
|
96 | - * Cryptocurrency sourcecode url. |
|
97 | - * |
|
98 | - * @var array |
|
99 | - */ |
|
100 | - protected $source_code = []; |
|
101 | - |
|
102 | - /** |
|
103 | - * {@inheritdoc} |
|
104 | - */ |
|
105 | - public function getId(): int |
|
106 | - { |
|
107 | - return $this->id; |
|
108 | - } |
|
109 | - |
|
110 | - /** |
|
111 | - * {@inheritdoc} |
|
112 | - */ |
|
113 | - public function getName(): string |
|
114 | - { |
|
115 | - return $this->name; |
|
116 | - } |
|
117 | - |
|
118 | - /** |
|
119 | - * {@inheritdoc} |
|
120 | - */ |
|
121 | - public function getSymbol(): string |
|
122 | - { |
|
123 | - return $this->symbol; |
|
124 | - } |
|
125 | - |
|
126 | - /** |
|
127 | - * {@inheritdoc} |
|
128 | - */ |
|
129 | - public function getType(): string |
|
130 | - { |
|
131 | - return $this->type; |
|
132 | - } |
|
133 | - |
|
134 | - /** |
|
135 | - * {@inheritdoc} |
|
136 | - */ |
|
137 | - public function getLogo($size, $path): string |
|
138 | - { |
|
139 | - return $path.'crypto-logo'.DIRECTORY_SEPARATOR.(string) $size.'px'.DIRECTORY_SEPARATOR.$this->id.'.png'; |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * {@inheritdoc} |
|
144 | - */ |
|
145 | - public function isMineable(): bool |
|
146 | - { |
|
147 | - return $this->mineable; |
|
148 | - } |
|
149 | - |
|
150 | - /** |
|
151 | - * {@inheritdoc} |
|
152 | - */ |
|
153 | - public function setDescription($description) |
|
154 | - { |
|
155 | - $this->description = $description; |
|
156 | - } |
|
157 | - |
|
158 | - /** |
|
159 | - * {@inheritdoc} |
|
160 | - */ |
|
161 | - public function getDescription(): string |
|
162 | - { |
|
163 | - return $this->description; |
|
164 | - } |
|
165 | - |
|
166 | - /** |
|
167 | - * {@inheritdoc} |
|
168 | - */ |
|
169 | - public function setProjectUrl($website) |
|
170 | - { |
|
171 | - $this->website = $website; |
|
172 | - } |
|
173 | - |
|
174 | - /** |
|
175 | - * {@inheritdoc} |
|
176 | - */ |
|
177 | - public function getProjectUrl(): array |
|
178 | - { |
|
179 | - return $this->website; |
|
180 | - } |
|
181 | - |
|
182 | - /** |
|
183 | - * {@inheritdoc} |
|
184 | - */ |
|
185 | - public function setExplorerUrl($explorer) |
|
186 | - { |
|
187 | - $this->explorer = $explorer; |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * {@inheritdoc} |
|
192 | - */ |
|
193 | - public function getExplorerUrl(): array |
|
194 | - { |
|
195 | - return $this->explorer; |
|
196 | - } |
|
197 | - |
|
198 | - /** |
|
199 | - * {@inheritdoc} |
|
200 | - */ |
|
201 | - public function setSourceCodeUrl($source_code) |
|
202 | - { |
|
203 | - $this->source_code = $source_code; |
|
204 | - } |
|
205 | - |
|
206 | - /** |
|
207 | - * {@inheritdoc} |
|
208 | - */ |
|
209 | - public function getSourceCodeUrl(): array |
|
210 | - { |
|
211 | - return $this->source_code; |
|
212 | - } |
|
213 | - |
|
214 | - /** |
|
215 | - * {@inheritdoc} |
|
216 | - */ |
|
217 | - public function build() |
|
218 | - { |
|
219 | - } |
|
220 | - |
|
221 | - /** |
|
222 | - * Cryptocurrency loader. |
|
223 | - * |
|
224 | - * @param string $name |
|
225 | - * Must be the class name of the selected cryptocurrency. |
|
226 | - * |
|
227 | - * @throws \CryptoTech\Cryptocurrency\Exception\CryptoNotFoundException |
|
228 | - * @throws \CryptoTech\Cryptocurrency\Exception\CryptoNotEnabledException |
|
229 | - * |
|
230 | - * @return \CryptoTech\Cryptocurrency\Cryptocurrency |
|
231 | - */ |
|
232 | - public function load(string $name): Cryptocurrency |
|
233 | - { |
|
234 | - $class_name = '\\CryptoTech\\Cryptocurrency\\'.$name; |
|
235 | - if ( ! in_array($name, CryptocurrencyCollection::$crypto_enabled, false)) { |
|
236 | - if ( ! class_exists($class_name)) { |
|
237 | - /* @noinspection PhpUnhandledExceptionInspection */ |
|
238 | - throw new CryptoNotFoundException(sprintf('Cryptocurrency class "%s" not found! This cryptocurrency is not implemented yet.', $class_name)); |
|
239 | - } |
|
240 | - |
|
241 | - /* @noinspection PhpUnhandledExceptionInspection */ |
|
242 | - throw new CryptoNotEnabledException(sprintf('The cryptocurrency ("%s") you have selected is not enabled in your configuration!', $name)); |
|
243 | - } |
|
244 | - |
|
245 | - return call_user_func([new $class_name($name), 'build']); |
|
246 | - } |
|
32 | + /** |
|
33 | + * Cryptocurrency CoinMarketCap id. |
|
34 | + * |
|
35 | + * @var int |
|
36 | + */ |
|
37 | + protected $id = 0; |
|
38 | + |
|
39 | + /** |
|
40 | + * Cryptocurrency name. |
|
41 | + * |
|
42 | + * @var string |
|
43 | + */ |
|
44 | + protected $name = ''; |
|
45 | + |
|
46 | + /** |
|
47 | + * Cryptocurrency symbol. |
|
48 | + * |
|
49 | + * @var string |
|
50 | + */ |
|
51 | + protected $symbol = ''; |
|
52 | + |
|
53 | + /** |
|
54 | + * Cryptocurrency type. |
|
55 | + * |
|
56 | + * @var string |
|
57 | + */ |
|
58 | + protected $type = ''; |
|
59 | + |
|
60 | + /** |
|
61 | + * Cryptocurrency logo. |
|
62 | + * |
|
63 | + * @var string |
|
64 | + */ |
|
65 | + protected $logo = ''; |
|
66 | + |
|
67 | + /** |
|
68 | + * Cryptocurrency mineable. |
|
69 | + * |
|
70 | + * @var bool |
|
71 | + */ |
|
72 | + protected $mineable = false; |
|
73 | + |
|
74 | + /** |
|
75 | + * Cryptocurrency description. |
|
76 | + * |
|
77 | + * @var string |
|
78 | + */ |
|
79 | + protected $description = ''; |
|
80 | + |
|
81 | + /** |
|
82 | + * Cryptocurrency website url. |
|
83 | + * |
|
84 | + * @var array |
|
85 | + */ |
|
86 | + protected $website = []; |
|
87 | + |
|
88 | + /** |
|
89 | + * Cryptocurrency explorer urls. |
|
90 | + * |
|
91 | + * @var array |
|
92 | + */ |
|
93 | + protected $explorer = []; |
|
94 | + |
|
95 | + /** |
|
96 | + * Cryptocurrency sourcecode url. |
|
97 | + * |
|
98 | + * @var array |
|
99 | + */ |
|
100 | + protected $source_code = []; |
|
101 | + |
|
102 | + /** |
|
103 | + * {@inheritdoc} |
|
104 | + */ |
|
105 | + public function getId(): int |
|
106 | + { |
|
107 | + return $this->id; |
|
108 | + } |
|
109 | + |
|
110 | + /** |
|
111 | + * {@inheritdoc} |
|
112 | + */ |
|
113 | + public function getName(): string |
|
114 | + { |
|
115 | + return $this->name; |
|
116 | + } |
|
117 | + |
|
118 | + /** |
|
119 | + * {@inheritdoc} |
|
120 | + */ |
|
121 | + public function getSymbol(): string |
|
122 | + { |
|
123 | + return $this->symbol; |
|
124 | + } |
|
125 | + |
|
126 | + /** |
|
127 | + * {@inheritdoc} |
|
128 | + */ |
|
129 | + public function getType(): string |
|
130 | + { |
|
131 | + return $this->type; |
|
132 | + } |
|
133 | + |
|
134 | + /** |
|
135 | + * {@inheritdoc} |
|
136 | + */ |
|
137 | + public function getLogo($size, $path): string |
|
138 | + { |
|
139 | + return $path.'crypto-logo'.DIRECTORY_SEPARATOR.(string) $size.'px'.DIRECTORY_SEPARATOR.$this->id.'.png'; |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * {@inheritdoc} |
|
144 | + */ |
|
145 | + public function isMineable(): bool |
|
146 | + { |
|
147 | + return $this->mineable; |
|
148 | + } |
|
149 | + |
|
150 | + /** |
|
151 | + * {@inheritdoc} |
|
152 | + */ |
|
153 | + public function setDescription($description) |
|
154 | + { |
|
155 | + $this->description = $description; |
|
156 | + } |
|
157 | + |
|
158 | + /** |
|
159 | + * {@inheritdoc} |
|
160 | + */ |
|
161 | + public function getDescription(): string |
|
162 | + { |
|
163 | + return $this->description; |
|
164 | + } |
|
165 | + |
|
166 | + /** |
|
167 | + * {@inheritdoc} |
|
168 | + */ |
|
169 | + public function setProjectUrl($website) |
|
170 | + { |
|
171 | + $this->website = $website; |
|
172 | + } |
|
173 | + |
|
174 | + /** |
|
175 | + * {@inheritdoc} |
|
176 | + */ |
|
177 | + public function getProjectUrl(): array |
|
178 | + { |
|
179 | + return $this->website; |
|
180 | + } |
|
181 | + |
|
182 | + /** |
|
183 | + * {@inheritdoc} |
|
184 | + */ |
|
185 | + public function setExplorerUrl($explorer) |
|
186 | + { |
|
187 | + $this->explorer = $explorer; |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * {@inheritdoc} |
|
192 | + */ |
|
193 | + public function getExplorerUrl(): array |
|
194 | + { |
|
195 | + return $this->explorer; |
|
196 | + } |
|
197 | + |
|
198 | + /** |
|
199 | + * {@inheritdoc} |
|
200 | + */ |
|
201 | + public function setSourceCodeUrl($source_code) |
|
202 | + { |
|
203 | + $this->source_code = $source_code; |
|
204 | + } |
|
205 | + |
|
206 | + /** |
|
207 | + * {@inheritdoc} |
|
208 | + */ |
|
209 | + public function getSourceCodeUrl(): array |
|
210 | + { |
|
211 | + return $this->source_code; |
|
212 | + } |
|
213 | + |
|
214 | + /** |
|
215 | + * {@inheritdoc} |
|
216 | + */ |
|
217 | + public function build() |
|
218 | + { |
|
219 | + } |
|
220 | + |
|
221 | + /** |
|
222 | + * Cryptocurrency loader. |
|
223 | + * |
|
224 | + * @param string $name |
|
225 | + * Must be the class name of the selected cryptocurrency. |
|
226 | + * |
|
227 | + * @throws \CryptoTech\Cryptocurrency\Exception\CryptoNotFoundException |
|
228 | + * @throws \CryptoTech\Cryptocurrency\Exception\CryptoNotEnabledException |
|
229 | + * |
|
230 | + * @return \CryptoTech\Cryptocurrency\Cryptocurrency |
|
231 | + */ |
|
232 | + public function load(string $name): Cryptocurrency |
|
233 | + { |
|
234 | + $class_name = '\\CryptoTech\\Cryptocurrency\\'.$name; |
|
235 | + if ( ! in_array($name, CryptocurrencyCollection::$crypto_enabled, false)) { |
|
236 | + if ( ! class_exists($class_name)) { |
|
237 | + /* @noinspection PhpUnhandledExceptionInspection */ |
|
238 | + throw new CryptoNotFoundException(sprintf('Cryptocurrency class "%s" not found! This cryptocurrency is not implemented yet.', $class_name)); |
|
239 | + } |
|
240 | + |
|
241 | + /* @noinspection PhpUnhandledExceptionInspection */ |
|
242 | + throw new CryptoNotEnabledException(sprintf('The cryptocurrency ("%s") you have selected is not enabled in your configuration!', $name)); |
|
243 | + } |
|
244 | + |
|
245 | + return call_user_func([new $class_name($name), 'build']); |
|
246 | + } |
|
247 | 247 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | // Initialize new CryptocurrencyCollection() |
28 | 28 | $crypto_coll = new \CryptoTech\Cryptocurrency\CryptocurrencyCollection(); |
29 | 29 | // Load the array with all cryptocurrencies enabled |
30 | -$crypto_enabled = (include 'config/cryptocurrency.php')['crypto_enabled']; |
|
30 | +$crypto_enabled = (include 'config/cryptocurrency.php')[ 'crypto_enabled' ]; |
|
31 | 31 | |
32 | 32 | // Inject the enabled cryptocurrencies' array in the collection |
33 | 33 | $crypto_coll->loadEnabledCrypto($crypto_enabled); |
@@ -23,13 +23,13 @@ |
||
23 | 23 | declare(strict_types=1); |
24 | 24 | |
25 | 25 | return [ |
26 | - /* |
|
26 | + /* |
|
27 | 27 | * The name of cryptocurrency must be the same as filename of files in |
28 | 28 | * src/Cryptocurrencies directory which is the same of its classname. |
29 | 29 | */ |
30 | - 'crypto_enabled' => [ |
|
31 | - 'Bitcoin', |
|
32 | - 'Ethereum', |
|
33 | - 'Ripple', |
|
34 | - ], |
|
30 | + 'crypto_enabled' => [ |
|
31 | + 'Bitcoin', |
|
32 | + 'Ethereum', |
|
33 | + 'Ripple', |
|
34 | + ], |
|
35 | 35 | ]; |
@@ -29,120 +29,120 @@ |
||
29 | 29 | */ |
30 | 30 | interface CryptocurrencyInterface |
31 | 31 | { |
32 | - /** |
|
33 | - * Get cryptocurrency id. |
|
34 | - * |
|
35 | - * @return int |
|
36 | - */ |
|
37 | - public function getId(): int; |
|
38 | - |
|
39 | - /** |
|
40 | - * Get cryptocurrency name. |
|
41 | - * |
|
42 | - * @return string |
|
43 | - */ |
|
44 | - public function getName(): string; |
|
45 | - |
|
46 | - /** |
|
47 | - * Get cryptocurrency symbol. |
|
48 | - * |
|
49 | - * @return string |
|
50 | - */ |
|
51 | - public function getSymbol(): string; |
|
52 | - |
|
53 | - /** |
|
54 | - * Get cryptocurrency type. |
|
55 | - * Can be 'coin' or 'token'. |
|
56 | - * |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - public function getType(): string; |
|
60 | - |
|
61 | - /** |
|
62 | - * Get cryptocurrency logo. |
|
63 | - * |
|
64 | - * @param int|string $size |
|
65 | - * The size of logo, which can be '16', '32', '64', '128' or '200'. |
|
66 | - * @param string $path |
|
67 | - * The path of logo. |
|
68 | - * The path must be the sub-path that allows you to get the correct logo path, |
|
69 | - * depending on whether you want to load the logo locally, rather than on a website, |
|
70 | - * or use it with some plugin (Laravel, Symfony, etc). |
|
71 | - * Sub-path must be point to the parent directory of crypto-logo directory. |
|
72 | - * |
|
73 | - * @return string |
|
74 | - */ |
|
75 | - public function getLogo($size, $path): string; |
|
76 | - |
|
77 | - /** |
|
78 | - * Get cryptocurrency mineable state. |
|
79 | - * Is returned 'coin' or 'token'. |
|
80 | - * |
|
81 | - * @return bool |
|
82 | - */ |
|
83 | - public function isMineable(): bool; |
|
84 | - |
|
85 | - /** |
|
86 | - * Set cryptocurrency description. |
|
87 | - * |
|
88 | - * @param string $description |
|
89 | - */ |
|
90 | - public function setDescription($description); |
|
91 | - |
|
92 | - /** |
|
93 | - * Get cryptocurrency description. |
|
94 | - * |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public function getDescription(): string; |
|
98 | - |
|
99 | - /** |
|
100 | - * Set cryptocurrency official project url. |
|
101 | - * |
|
102 | - * @param array $url |
|
103 | - */ |
|
104 | - public function setProjectUrl($url); |
|
105 | - |
|
106 | - /** |
|
107 | - * Get cryptocurrency official project url. |
|
108 | - * |
|
109 | - * @return array |
|
110 | - */ |
|
111 | - public function getProjectUrl(): array; |
|
112 | - |
|
113 | - /** |
|
114 | - * Set cryptocurrency explorer urls. |
|
115 | - * |
|
116 | - * @param array $url |
|
117 | - */ |
|
118 | - public function setExplorerUrl($url); |
|
119 | - |
|
120 | - /** |
|
121 | - * Get cryptocurrency explorer urls. |
|
122 | - * |
|
123 | - * @return array |
|
124 | - */ |
|
125 | - public function getExplorerUrl(): array; |
|
126 | - |
|
127 | - /** |
|
128 | - * Set cryptocurrency sourcecode url. |
|
129 | - * |
|
130 | - * @param array $url |
|
131 | - */ |
|
132 | - public function setSourceCodeUrl($url); |
|
133 | - |
|
134 | - /** |
|
135 | - * Get cryptocurrency sourcecode url. |
|
136 | - * |
|
137 | - * @return array |
|
138 | - */ |
|
139 | - public function getSourceCodeUrl(): array; |
|
140 | - |
|
141 | - /** |
|
142 | - * Method overridable by single cryptocurrency class which contains |
|
143 | - * all informations about the crypto. |
|
144 | - * |
|
145 | - * @return mixed |
|
146 | - */ |
|
147 | - public function build(); |
|
32 | + /** |
|
33 | + * Get cryptocurrency id. |
|
34 | + * |
|
35 | + * @return int |
|
36 | + */ |
|
37 | + public function getId(): int; |
|
38 | + |
|
39 | + /** |
|
40 | + * Get cryptocurrency name. |
|
41 | + * |
|
42 | + * @return string |
|
43 | + */ |
|
44 | + public function getName(): string; |
|
45 | + |
|
46 | + /** |
|
47 | + * Get cryptocurrency symbol. |
|
48 | + * |
|
49 | + * @return string |
|
50 | + */ |
|
51 | + public function getSymbol(): string; |
|
52 | + |
|
53 | + /** |
|
54 | + * Get cryptocurrency type. |
|
55 | + * Can be 'coin' or 'token'. |
|
56 | + * |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + public function getType(): string; |
|
60 | + |
|
61 | + /** |
|
62 | + * Get cryptocurrency logo. |
|
63 | + * |
|
64 | + * @param int|string $size |
|
65 | + * The size of logo, which can be '16', '32', '64', '128' or '200'. |
|
66 | + * @param string $path |
|
67 | + * The path of logo. |
|
68 | + * The path must be the sub-path that allows you to get the correct logo path, |
|
69 | + * depending on whether you want to load the logo locally, rather than on a website, |
|
70 | + * or use it with some plugin (Laravel, Symfony, etc). |
|
71 | + * Sub-path must be point to the parent directory of crypto-logo directory. |
|
72 | + * |
|
73 | + * @return string |
|
74 | + */ |
|
75 | + public function getLogo($size, $path): string; |
|
76 | + |
|
77 | + /** |
|
78 | + * Get cryptocurrency mineable state. |
|
79 | + * Is returned 'coin' or 'token'. |
|
80 | + * |
|
81 | + * @return bool |
|
82 | + */ |
|
83 | + public function isMineable(): bool; |
|
84 | + |
|
85 | + /** |
|
86 | + * Set cryptocurrency description. |
|
87 | + * |
|
88 | + * @param string $description |
|
89 | + */ |
|
90 | + public function setDescription($description); |
|
91 | + |
|
92 | + /** |
|
93 | + * Get cryptocurrency description. |
|
94 | + * |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public function getDescription(): string; |
|
98 | + |
|
99 | + /** |
|
100 | + * Set cryptocurrency official project url. |
|
101 | + * |
|
102 | + * @param array $url |
|
103 | + */ |
|
104 | + public function setProjectUrl($url); |
|
105 | + |
|
106 | + /** |
|
107 | + * Get cryptocurrency official project url. |
|
108 | + * |
|
109 | + * @return array |
|
110 | + */ |
|
111 | + public function getProjectUrl(): array; |
|
112 | + |
|
113 | + /** |
|
114 | + * Set cryptocurrency explorer urls. |
|
115 | + * |
|
116 | + * @param array $url |
|
117 | + */ |
|
118 | + public function setExplorerUrl($url); |
|
119 | + |
|
120 | + /** |
|
121 | + * Get cryptocurrency explorer urls. |
|
122 | + * |
|
123 | + * @return array |
|
124 | + */ |
|
125 | + public function getExplorerUrl(): array; |
|
126 | + |
|
127 | + /** |
|
128 | + * Set cryptocurrency sourcecode url. |
|
129 | + * |
|
130 | + * @param array $url |
|
131 | + */ |
|
132 | + public function setSourceCodeUrl($url); |
|
133 | + |
|
134 | + /** |
|
135 | + * Get cryptocurrency sourcecode url. |
|
136 | + * |
|
137 | + * @return array |
|
138 | + */ |
|
139 | + public function getSourceCodeUrl(): array; |
|
140 | + |
|
141 | + /** |
|
142 | + * Method overridable by single cryptocurrency class which contains |
|
143 | + * all informations about the crypto. |
|
144 | + * |
|
145 | + * @return mixed |
|
146 | + */ |
|
147 | + public function build(); |
|
148 | 148 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | */ |
30 | 30 | class CryptoNotEnabledException extends \InvalidArgumentException |
31 | 31 | { |
32 | - /** |
|
33 | - * CryptoNotEnabledException constructor. |
|
34 | - * |
|
35 | - * @param string $message [optional] The Exception message to throw. |
|
36 | - * @param int $code [optional] The Exception code. |
|
37 | - * @param \Throwable $previous [optional] The previous throwable used for the exception chaining. |
|
38 | - */ |
|
39 | - public function __construct($message = '', $code = 0, \Throwable $previous = null) |
|
40 | - { |
|
41 | - parent::__construct($message, $code, $previous); |
|
42 | - } |
|
32 | + /** |
|
33 | + * CryptoNotEnabledException constructor. |
|
34 | + * |
|
35 | + * @param string $message [optional] The Exception message to throw. |
|
36 | + * @param int $code [optional] The Exception code. |
|
37 | + * @param \Throwable $previous [optional] The previous throwable used for the exception chaining. |
|
38 | + */ |
|
39 | + public function __construct($message = '', $code = 0, \Throwable $previous = null) |
|
40 | + { |
|
41 | + parent::__construct($message, $code, $previous); |
|
42 | + } |
|
43 | 43 | } |
@@ -29,15 +29,15 @@ |
||
29 | 29 | */ |
30 | 30 | class CryptoNotFoundException extends \Exception |
31 | 31 | { |
32 | - /** |
|
33 | - * CryptoNotFoundException constructor. |
|
34 | - * |
|
35 | - * @param string $message [optional] The Exception message to throw. |
|
36 | - * @param int $code [optional] The Exception code. |
|
37 | - * @param \Throwable $previous [optional] The previous throwable used for the exception chaining. |
|
38 | - */ |
|
39 | - public function __construct($message = '', $code = 0, \Throwable $previous = null) |
|
40 | - { |
|
41 | - parent::__construct($message, $code, $previous); |
|
42 | - } |
|
32 | + /** |
|
33 | + * CryptoNotFoundException constructor. |
|
34 | + * |
|
35 | + * @param string $message [optional] The Exception message to throw. |
|
36 | + * @param int $code [optional] The Exception code. |
|
37 | + * @param \Throwable $previous [optional] The previous throwable used for the exception chaining. |
|
38 | + */ |
|
39 | + public function __construct($message = '', $code = 0, \Throwable $previous = null) |
|
40 | + { |
|
41 | + parent::__construct($message, $code, $previous); |
|
42 | + } |
|
43 | 43 | } |
@@ -29,29 +29,29 @@ |
||
29 | 29 | */ |
30 | 30 | class BitcoinSatoshiVision extends Cryptocurrency |
31 | 31 | { |
32 | - /** |
|
33 | - * {@inheritdoc} |
|
34 | - */ |
|
35 | - public function build() |
|
36 | - { |
|
37 | - $this->id = 3602; |
|
38 | - $this->name = 'Bitcoin Satoshi Vision'; |
|
39 | - $this->symbol = 'BSV'; |
|
40 | - $this->type = 'coin'; |
|
41 | - $this->mineable = true; |
|
42 | - $this->description = 'In 16th November 2018 Bitcoin Cash was hard forked again and split into Bitcoin Satoshi Vision (BSV) and Bitcoin Cash (ABC).'; |
|
43 | - $this->website = [ |
|
44 | - 'https://bitcoinsv.io', |
|
45 | - ]; |
|
46 | - $this->explorer = [ |
|
47 | - 'https://blockchair.com/bitcoin-sv/dashboards/address/%s', |
|
48 | - 'https://svblox.com', |
|
49 | - 'https://bchsv.tokenview.com/en', |
|
50 | - ]; |
|
51 | - $this->source_code = [ |
|
52 | - 'https://github.com/bitcoin-sv/bitcoin-sv', |
|
53 | - ]; |
|
32 | + /** |
|
33 | + * {@inheritdoc} |
|
34 | + */ |
|
35 | + public function build() |
|
36 | + { |
|
37 | + $this->id = 3602; |
|
38 | + $this->name = 'Bitcoin Satoshi Vision'; |
|
39 | + $this->symbol = 'BSV'; |
|
40 | + $this->type = 'coin'; |
|
41 | + $this->mineable = true; |
|
42 | + $this->description = 'In 16th November 2018 Bitcoin Cash was hard forked again and split into Bitcoin Satoshi Vision (BSV) and Bitcoin Cash (ABC).'; |
|
43 | + $this->website = [ |
|
44 | + 'https://bitcoinsv.io', |
|
45 | + ]; |
|
46 | + $this->explorer = [ |
|
47 | + 'https://blockchair.com/bitcoin-sv/dashboards/address/%s', |
|
48 | + 'https://svblox.com', |
|
49 | + 'https://bchsv.tokenview.com/en', |
|
50 | + ]; |
|
51 | + $this->source_code = [ |
|
52 | + 'https://github.com/bitcoin-sv/bitcoin-sv', |
|
53 | + ]; |
|
54 | 54 | |
55 | - return $this; |
|
56 | - } |
|
55 | + return $this; |
|
56 | + } |
|
57 | 57 | } |
@@ -29,29 +29,29 @@ |
||
29 | 29 | */ |
30 | 30 | class Ethereum extends Cryptocurrency |
31 | 31 | { |
32 | - /** |
|
33 | - * {@inheritdoc} |
|
34 | - */ |
|
35 | - public function build() |
|
36 | - { |
|
37 | - $this->id = 1027; |
|
38 | - $this->name = 'Ethereum'; |
|
39 | - $this->symbol = 'ETH'; |
|
40 | - $this->type = 'coin'; |
|
41 | - $this->mineable = true; |
|
42 | - $this->description = 'Ethereum is an open-source, public, blockchain-based distributed computing platform featuring smart contract (scripting) functionality. It provides a decentralized Turing-complete virtual machine, the Ethereum Virtual Machine (EVM), which can execute scripts using an international network of public nodes. Ethereum also provides a cryptocurrency token called "Ether", which can be transferred between accounts and used to compensate participant nodes for computations performed. "Gas", an internal transaction pricing mechanism, is used to mitigate spam and allocate resources on the network.'; |
|
43 | - $this->website = [ |
|
44 | - 'https://www.ethereum.org', |
|
45 | - ]; |
|
46 | - $this->explorer = [ |
|
47 | - 'https://etherscan.io', |
|
48 | - 'https://ethplorer.io/address/%s', |
|
49 | - 'https://blockchair.com/ethereum', |
|
50 | - ]; |
|
51 | - $this->source_code = [ |
|
52 | - 'https://github.com/ethereum', |
|
53 | - ]; |
|
32 | + /** |
|
33 | + * {@inheritdoc} |
|
34 | + */ |
|
35 | + public function build() |
|
36 | + { |
|
37 | + $this->id = 1027; |
|
38 | + $this->name = 'Ethereum'; |
|
39 | + $this->symbol = 'ETH'; |
|
40 | + $this->type = 'coin'; |
|
41 | + $this->mineable = true; |
|
42 | + $this->description = 'Ethereum is an open-source, public, blockchain-based distributed computing platform featuring smart contract (scripting) functionality. It provides a decentralized Turing-complete virtual machine, the Ethereum Virtual Machine (EVM), which can execute scripts using an international network of public nodes. Ethereum also provides a cryptocurrency token called "Ether", which can be transferred between accounts and used to compensate participant nodes for computations performed. "Gas", an internal transaction pricing mechanism, is used to mitigate spam and allocate resources on the network.'; |
|
43 | + $this->website = [ |
|
44 | + 'https://www.ethereum.org', |
|
45 | + ]; |
|
46 | + $this->explorer = [ |
|
47 | + 'https://etherscan.io', |
|
48 | + 'https://ethplorer.io/address/%s', |
|
49 | + 'https://blockchair.com/ethereum', |
|
50 | + ]; |
|
51 | + $this->source_code = [ |
|
52 | + 'https://github.com/ethereum', |
|
53 | + ]; |
|
54 | 54 | |
55 | - return $this; |
|
56 | - } |
|
55 | + return $this; |
|
56 | + } |
|
57 | 57 | } |