1 | <?php |
||
9 | class Cache implements ICache |
||
10 | { |
||
11 | const FILE_CURRENT = 'current'; |
||
12 | |||
13 | /** @var string */ |
||
14 | private $temp; |
||
15 | |||
16 | /** @var Currency\ListRates[] */ |
||
17 | private $listRates; |
||
18 | |||
19 | /** @var array */ |
||
20 | private $allowedCurrencies = []; |
||
21 | |||
22 | private $refresh = '15:00'; |
||
23 | |||
24 | public function __construct($temp) |
||
28 | |||
29 | public function loadListRate(Driver\ADriver $driver, \DateTime $date = NULL) |
||
37 | |||
38 | public function flushCache(Driver\ADriver $driver, \DateTime $date = NULL) |
||
43 | |||
44 | /** |
||
45 | * Invalid by cron. |
||
46 | * @param Driver\ADriver $driver |
||
47 | * @param \DateTime|NULL $date |
||
48 | */ |
||
49 | public function invalidForce(Driver\ADriver $driver, \DateTime $date = NULL) |
||
55 | |||
56 | /** |
||
57 | * @param array $allowedCurrencies |
||
58 | * @return static |
||
59 | */ |
||
60 | public function setAllowedCurrencies(array $allowedCurrencies) |
||
65 | |||
66 | /** |
||
67 | * @param string $hour |
||
68 | * @return Storage |
||
69 | */ |
||
70 | public function setRefresh($hour) |
||
75 | |||
76 | private function saveCurrencies(Driver\ADriver $driver, \SplFileInfo $file, \DateTime $date = NULL) |
||
87 | |||
88 | private function createListRate(Driver\ADriver $driver, \SplFileInfo $file, \DateTime $date = NULL) |
||
104 | |||
105 | /** |
||
106 | * @param \SplFileInfo $file |
||
107 | * @return bool |
||
108 | */ |
||
109 | private function isFileValid(\SplFileInfo $file) |
||
113 | |||
114 | /** @return int */ |
||
115 | private function getRefresh() |
||
125 | |||
126 | private function createFileInfo(Driver\ADriver $driver, \DateTime $date = NULL) |
||
131 | |||
132 | private static function isFileCurrent(\SplFileInfo $file) |
||
136 | |||
137 | } |
||
138 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.