| @@ -42,6 +42,9 @@ | ||
| 42 | 42 | unset($this->formats[$code]); | 
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | + /** | |
| 46 | + * @param string $code | |
| 47 | + */ | |
| 45 | 48 | public function getFormat($code) | 
| 46 | 49 |  	{ | 
| 47 | 50 |  		if (isset($this->formats[$code])) { | 
| @@ -2,8 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace h4kuna\Exchange\Currency; | 
| 4 | 4 | |
| 5 | -use h4kuna\Exchange, | |
| 6 | - h4kuna\Number; | |
| 5 | +use h4kuna\Exchange; | |
| 6 | +use h4kuna\Number; | |
| 7 | 7 | |
| 8 | 8 | class Formats | 
| 9 | 9 |  { | 
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 |  		if (is_array($setup)) { | 
| 30 | 30 | $setup = $this->numberFormatFactory->createUnit($setup); | 
| 31 | 31 |  		} elseif (!$setup instanceof Number\UnitFormatState) { | 
| 32 | -			throw new Exchange\InvalidArgumentException('$setup must be array or ' . Number\UnitPersistentFormatState::class); | |
| 32 | +			throw new Exchange\InvalidArgumentException('$setup must be array or '.Number\UnitPersistentFormatState::class); | |
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | 35 | $this->default = $setup; | 
| @@ -44,6 +44,9 @@ | ||
| 44 | 44 | return $currencies; | 
| 45 | 45 | } | 
| 46 | 46 | |
| 47 | + /** | |
| 48 | + * @param string $format | |
| 49 | + */ | |
| 47 | 50 | protected function setDate($format, $value) | 
| 48 | 51 |  	{ | 
| 49 | 52 | $this->date = DateTime::createFromFormat($format, $value); | 
| @@ -2,8 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace h4kuna\Exchange\Driver; | 
| 4 | 4 | |
| 5 | -use DateTime, | |
| 6 | - h4kuna\Exchange; | |
| 5 | +use DateTime; | |
| 6 | +use h4kuna\Exchange; | |
| 7 | 7 | |
| 8 | 8 | /** | 
| 9 | 9 | * Download currency from server. | 
| @@ -2,8 +2,8 @@ | ||
| 2 | 2 | |
| 3 | 3 | namespace h4kuna\Exchange\Http; | 
| 4 | 4 | |
| 5 | -use h4kuna\Exchange, | |
| 6 | - Nette\Http; | |
| 5 | +use h4kuna\Exchange; | |
| 6 | +use Nette\Http; | |
| 7 | 7 | |
| 8 | 8 | class CookieManager | 
| 9 | 9 |  { | 
| @@ -169,7 +169,7 @@ | ||
| 169 | 169 |  		if ($this->getListRates()->offsetExists($index)) { | 
| 170 | 170 | return $this->getListRates()->offsetGet($index); | 
| 171 | 171 | } | 
| 172 | -		throw new UnknownCurrencyException('Undefined currency code: "' . $index . '".'); | |
| 172 | +		throw new UnknownCurrencyException('Undefined currency code: "'.$index.'".'); | |
| 173 | 173 | } | 
| 174 | 174 | |
| 175 | 175 | public function offsetExists($offset) | 
| @@ -55,7 +55,7 @@ | ||
| 55 | 55 |  		if ($date === NULL) { | 
| 56 | 56 | return $url; | 
| 57 | 57 | } | 
| 58 | -		return $url . '?date=' . urlencode($date->format('d.m.Y')); | |
| 58 | +		return $url.'?date='.urlencode($date->format('d.m.Y')); | |
| 59 | 59 | } | 
| 60 | 60 | |
| 61 | 61 | } | 
| @@ -81,7 +81,7 @@ discard block | ||
| 81 | 81 |  	{ | 
| 82 | 82 | $listRates = $driver->download($date, $this->allowedCurrencies); | 
| 83 | 83 | |
| 84 | - file_put_contents(Utils\SafeStream::PROTOCOL . '://' . $file->getPathname(), serialize($listRates)); | |
| 84 | + file_put_contents(Utils\SafeStream::PROTOCOL.'://'.$file->getPathname(), serialize($listRates)); | |
| 85 | 85 |  		if (self::isFileCurrent($file)) { | 
| 86 | 86 | touch($file->getPathname(), $this->getRefresh()); | 
| 87 | 87 | } | 
| @@ -93,7 +93,7 @@ discard block | ||
| 93 | 93 |  	{ | 
| 94 | 94 |  		if ($this->isFileValid($file)) { | 
| 95 | 95 | Utils\FileSystem::createDir($file->getPath(), 0755); | 
| 96 | - $handle = fopen(Utils\SafeStream::PROTOCOL . '://' . $this->temp . DIRECTORY_SEPARATOR . 'lock', 'w'); | |
| 96 | + $handle = fopen(Utils\SafeStream::PROTOCOL.'://'.$this->temp.DIRECTORY_SEPARATOR.'lock', 'w'); | |
| 97 | 97 | |
| 98 | 98 |  			if ($this->isFileValid($file)) { | 
| 99 | 99 | $listRate = $this->saveCurrencies($driver, $file, $date); | 
| @@ -119,7 +119,7 @@ discard block | ||
| 119 | 119 | private function getRefresh() | 
| 120 | 120 |  	{ | 
| 121 | 121 |  		if (!is_int($this->refresh)) { | 
| 122 | -			$this->refresh = (int) (new \DateTime('today ' . $this->refresh))->format('U'); | |
| 122 | +			$this->refresh = (int) (new \DateTime('today '.$this->refresh))->format('U'); | |
| 123 | 123 |  			if (time() >= $this->refresh) { | 
| 124 | 124 | $this->refresh += Utils\DateTime::DAY; | 
| 125 | 125 | } | 
| @@ -130,7 +130,7 @@ discard block | ||
| 130 | 130 | private function createFileInfo(Driver\ADriver $driver, \DateTime $date = NULL) | 
| 131 | 131 |  	{ | 
| 132 | 132 |  		$filename = $date === NULL ? self::FILE_CURRENT : $date->format('Y-m-d'); | 
| 133 | - return new \SplFileInfo($this->temp . DIRECTORY_SEPARATOR . $driver->getName() . DIRECTORY_SEPARATOR . $filename); | |
| 133 | + return new \SplFileInfo($this->temp.DIRECTORY_SEPARATOR.$driver->getName().DIRECTORY_SEPARATOR.$filename); | |
| 134 | 134 | } | 
| 135 | 135 | |
| 136 | 136 | private static function isFileCurrent(\SplFileInfo $file) |