tmp; $dir = $tmp . DIRECTORY_SEPARATOR . "OpenWeatherMapPHPAPI"; if (!is_dir($dir)) { mkdir($dir); } $path = $dir . DIRECTORY_SEPARATOR . md5($url); return $path; } /** * @inheritdoc */ public function isCached($url) { $path = $this->urlToPath($url); if (!file_exists($path) || filectime($path) + $this->seconds < time()) { return false; } return true; } /** * @inheritdoc */ public function getCached($url) { return file_get_contents($this->urlToPath($url)); } /** * @inheritdoc */ public function setCached($url, $content) { file_put_contents($this->urlToPath($url), $content); } /** * @inheritdoc */ public function setSeconds($seconds) { $this->seconds = $seconds; } /** * @inheritdoc */ public function setTempPath($path) { if (!is_dir($path)) { mkdir($path); } $this->tmp = $path; } }