@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | use Appino\Blockchain\Objects\Rate; |
| 8 | 8 | use Appino\Blockchain\Objects\ReceiveResponse; |
| 9 | 9 | |
| 10 | -class Exchange{ |
|
| 10 | +class Exchange { |
|
| 11 | 11 | |
| 12 | 12 | private $blockchain; |
| 13 | 13 | |
| 14 | - public function __construct(Blockchain $blockchain){ |
|
| 14 | + public function __construct(Blockchain $blockchain) { |
|
| 15 | 15 | $this->blockchain = $blockchain; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | const URL = 'https://blockchain.info/'; |
| 19 | 19 | |
| 20 | - private function Uri($uri){ |
|
| 20 | + private function Uri($uri) { |
|
| 21 | 21 | return self::URL.'/'.$uri; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -28,26 +28,26 @@ discard block |
||
| 28 | 28 | * @return array |
| 29 | 29 | * @throws \Appino\Blockchain\Exception\HttpError |
| 30 | 30 | */ |
| 31 | - private function call($method, $uri, $params = array()){ |
|
| 31 | + private function call($method, $uri, $params = array()) { |
|
| 32 | 32 | return $this->blockchain->Request($method, $this->Uri($uri), $params); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | - public function Rates(){ |
|
| 36 | - $response = $this->call('GET','ticker'); |
|
| 35 | + public function Rates() { |
|
| 36 | + $response = $this->call('GET', 'ticker'); |
|
| 37 | 37 | $rates = array(); |
| 38 | - foreach ($response as $Currency => $params){ |
|
| 38 | + foreach ($response as $Currency => $params) { |
|
| 39 | 39 | $rates[$Currency] = new Rate($Currency, $params); |
| 40 | 40 | } |
| 41 | 41 | return $rates; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public function ToBTC($currency, $amount){ |
|
| 44 | + public function ToBTC($currency, $amount) { |
|
| 45 | 45 | $params = [ |
| 46 | 46 | 'currency' => $currency, |
| 47 | 47 | 'value' => $amount |
| 48 | 48 | ]; |
| 49 | 49 | $params = array_merge($this->params, $params); |
| 50 | - $response = $this->call('GET','',$params); |
|
| 50 | + $response = $this->call('GET', '', $params); |
|
| 51 | 51 | return new ReceiveResponse($response); |
| 52 | 52 | } |
| 53 | 53 | |