$free = disk_free_space($this->directory);
- return array(
+ return [
Cache::STATS_HITS => null,
Cache::STATS_MISSES => null,
Cache::STATS_UPTIME => null,
Cache::STATS_MEMORY_USAGE => $usage,
Cache::STATS_MEMORY_AVAILABLE => $free,
- );
+ ];
}
/**
* @param string $path
* @return bool TRUE on success or if path already exists, FALSE if path cannot be created.
*/
- private function createPathIfNeeded($path)
+ private function createPathIfNeeded(string $path) : bool
{
if ( ! is_dir($path)) {
if (false === @mkdir($path, 0777 & (~$this->umask), true) && !is_dir($path)) {
*
* @return bool TRUE on success, FALSE if path cannot be created, if path is not writable or an any other error.
*/
- protected function writeFile($filename, $content)
+ protected function writeFile(string $filename, string $content) : bool
{
$filepath = pathinfo($filename, PATHINFO_DIRNAME);
@chmod($tmpFile, 0666 & (~$this->umask));
if (file_put_contents($tmpFile, $content) !== false) {
+ @chmod($tmpFile, 0666 & (~$this->umask));
if (@rename($tmpFile, $filename)) {
return true;
}
/**
* @return \Iterator
*/
- private function getIterator()
+ private function getIterator() : \Iterator
{
return new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($this->directory, \FilesystemIterator::SKIP_DOTS),
*
* @return bool
*/
- private function isFilenameEndingWithExtension($name)
+ private function isFilenameEndingWithExtension(string $name) : bool
{
return '' === $this->extension
|| strrpos($name, $this->extension) === (strlen($name) - $this->extensionStringLength);