@@ -47,6 +47,9 @@ |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | + /** |
|
| 51 | + * @param string $code |
|
| 52 | + */ |
|
| 50 | 53 | public function getFormat($code) |
| 51 | 54 | { |
| 52 | 55 | if (isset($this->formats[$code])) { |
@@ -42,6 +42,9 @@ |
||
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | + /** |
|
| 46 | + * @param string $format |
|
| 47 | + */ |
|
| 45 | 48 | protected function setDate($format, $value) |
| 46 | 49 | { |
| 47 | 50 | $this->date = DateTime::createFromFormat($format, $value); |
@@ -47,9 +47,10 @@ |
||
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Count and format number. |
| 50 | - * @param number $number |
|
| 50 | + * @param double $number |
|
| 51 | 51 | * @param string|NULL |
| 52 | 52 | * @param string $to output currency, NULL set actual |
| 53 | + * @param string $from |
|
| 53 | 54 | * @return string |
| 54 | 55 | */ |
| 55 | 56 | public function format($number, $from = null, $to = null) |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | if ($date === null) { |
| 59 | 59 | return $url; |
| 60 | 60 | } |
| 61 | - return $url . '?date=' . urlencode($date->format('d.m.Y')); |
|
| 61 | + return $url.'?date='.urlencode($date->format('d.m.Y')); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | { |
| 90 | 90 | $listRates = $driver->download($date, $this->allowedCurrencies); |
| 91 | 91 | |
| 92 | - file_put_contents(Utils\SafeStream::PROTOCOL . '://' . $file->getPathname(), serialize($listRates)); |
|
| 92 | + file_put_contents(Utils\SafeStream::PROTOCOL.'://'.$file->getPathname(), serialize($listRates)); |
|
| 93 | 93 | if (self::isFileCurrent($file)) { |
| 94 | 94 | touch($file->getPathname(), $this->getRefresh()); |
| 95 | 95 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | { |
| 103 | 103 | if ($this->isFileValid($file)) { |
| 104 | 104 | Utils\FileSystem::createDir($file->getPath(), 0755); |
| 105 | - $handle = fopen(Utils\SafeStream::PROTOCOL . '://' . $this->temp . DIRECTORY_SEPARATOR . 'lock', 'w'); |
|
| 105 | + $handle = fopen(Utils\SafeStream::PROTOCOL.'://'.$this->temp.DIRECTORY_SEPARATOR.'lock', 'w'); |
|
| 106 | 106 | |
| 107 | 107 | if ($this->isFileValid($file)) { |
| 108 | 108 | $listRate = $this->saveCurrencies($driver, $file, $date); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | private function getRefresh() |
| 131 | 131 | { |
| 132 | 132 | if (!is_int($this->refresh)) { |
| 133 | - $this->refresh = (int) (new \DateTime('today ' . $this->refresh))->format('U'); |
|
| 133 | + $this->refresh = (int) (new \DateTime('today '.$this->refresh))->format('U'); |
|
| 134 | 134 | if (time() >= $this->refresh) { |
| 135 | 135 | $this->refresh += Utils\DateTime::DAY; |
| 136 | 136 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | private function createFileInfo(Driver\ADriver $driver, \DateTime $date = null) |
| 143 | 143 | { |
| 144 | 144 | $filename = $date === null ? self::FILE_CURRENT : $date->format('Y-m-d'); |
| 145 | - return new \SplFileInfo($this->temp . DIRECTORY_SEPARATOR . $driver->getName() . DIRECTORY_SEPARATOR . $filename); |
|
| 145 | + return new \SplFileInfo($this->temp.DIRECTORY_SEPARATOR.$driver->getName().DIRECTORY_SEPARATOR.$filename); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | if ($this->getListRates()->offsetExists($index)) { |
| 178 | 178 | return $this->getListRates()->offsetGet($index); |
| 179 | 179 | } |
| 180 | - throw new UnknownCurrencyException('Undefined currency code: "' . $index . '".'); |
|
| 180 | + throw new UnknownCurrencyException('Undefined currency code: "'.$index.'".'); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |