Skip to content

Commit

Permalink
Merge pull request #9 from teknomavi/analysis-4xpyJG
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
GoktugOzturk committed Jul 2, 2020
2 parents e71ca34 + 0f13549 commit d34dd14
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/Doviz.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

namespace Teknomavi\Tcmb;

use Teknomavi\Common\Wrapper\Curl;
Expand Down Expand Up @@ -93,7 +92,7 @@ private function getTcmbData(Curl $curl = null)
throw new Exception\ConnectionFailed('Sunucu Bağlantısı Kurulamadı: ' . $curl->error());
}
$curl->close();
$this->data = $this->formatTcmbData((array)simplexml_load_string($response));
$this->data = $this->formatTcmbData((array) simplexml_load_string($response));
$timezone = new \DateTimeZone('Europe/Istanbul');
$now = new \DateTime('now', $timezone);
$expire = $this->data['today'] == $now->format('d.m.Y') ? 'Tomorrow 15:30' : 'Today 15:30';
Expand All @@ -118,21 +117,21 @@ private function formatTcmbData($data)
$currencies = [];
if (isset($data['Currency']) && count($data['Currency'])) {
foreach ($data['Currency'] as $currency) {
$currency = (array)$currency;
$currency = (array) $currency;
$currencyCode = $currency['@attributes']['CurrencyCode'];
if (!in_array($currencyCode, $this->ignoredCurrencies)) {
$currencies[$currencyCode] = [
self::TYPE_ALIS => $currency[self::TYPE_ALIS] / $currency['Unit'],
self::TYPE_EFEKTIFALIS => $currency[self::TYPE_EFEKTIFALIS] / $currency['Unit'],
self::TYPE_SATIS => $currency[self::TYPE_SATIS] / $currency['Unit'],
self::TYPE_ALIS => $currency[self::TYPE_ALIS] / $currency['Unit'],
self::TYPE_EFEKTIFALIS => $currency[self::TYPE_EFEKTIFALIS] / $currency['Unit'],
self::TYPE_SATIS => $currency[self::TYPE_SATIS] / $currency['Unit'],
self::TYPE_EFEKTIFSATIS => $currency[self::TYPE_EFEKTIFSATIS] / $currency['Unit'],
];
}
}
}

return [
'today' => $data['@attributes']['Tarih'],
'today' => $data['@attributes']['Tarih'],
'currencies' => $currencies,
];
}
Expand Down Expand Up @@ -193,7 +192,7 @@ public function getCurrencyExchangeRate($currency, $type = self::TYPE_ALIS)
case self::TYPE_SATIS:
case self::TYPE_EFEKTIFALIS:
case self::TYPE_EFEKTIFSATIS:
return (float)$this->data['currencies'][$currency][$type];
return (float) $this->data['currencies'][$currency][$type];
default:
throw new Exception\UnknownPriceType('Tanımlanamayan Kur Tipi: ' . $type);
}
Expand Down

0 comments on commit d34dd14

Please sign in to comment.