Code Duplication    Length = 8-10 lines in 3 locations

class/cache.php 1 location

@@ 292-299 (lines=8) @@
289
		if (empty($dir))
290
			$s = "Cache dir {$dir} is not defined.";
291
292
		if (!file_exists($dir)) {
293
			if (false == mkdir($dir, 0755, true))
294
				$s = "Fail to create cache dir {$dir}.";
295
		}
296
		else {
297
			if (!is_writable($dir))
298
				$s = "Cache dir {$dir} is not writable.";
299
		}
300
301
		if (!empty($s))
302
			$this->Log($s, 5);

class/cache/cache-file.php 1 location

@@ 76-83 (lines=8) @@
73
		if (empty($dir))
74
			$s = "Cache dir {$dir} is not defined.";
75
76
		if (!file_exists($dir)) {
77
			if (false == mkdir($dir, 0755, true))
78
				$s = "Fail to create cache dir {$dir}.";
79
		}
80
		else {
81
			if (!is_writable($dir))
82
				$s = "Cache dir {$dir} is not writable.";
83
		}
84
85
		return $s;
86
	} // end of func ChkCfgFileDir

src/Fwlib/Cache/Handler/File.php 1 location

@@ 83-92 (lines=10) @@
80
    {
81
        $message = '';
82
83
        if (!file_exists($dir)) {
84
            if (false == mkdir($dir, 0755, true)) {
85
                $message = "Fail to create cache directory \"{$dir}\"";
86
            }
87
88
        } else {
89
            if (!is_writable($dir)) {
90
                $message = "Cache directory \"{$dir}\" is not writable.";
91
            }
92
        }
93
94
        return $message;
95
    }