Passed
Push — master ( f89ee0...ab76f6 )
by Patryk
01:15
created
src/Cache/CacheFile.php 1 patch
Indentation   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -4,101 +4,101 @@
 block discarded – undo
4 4
 
5 5
 class CacheFile
6 6
 {
7
-    /**
8
-     * check if is cache dir
9
-     *
10
-     * @return bool
11
-     */
12
-    public static function isCacheDir()
13
-    {
14
-        if(!is_dir(__DIR__ .'/cache/')) mkdir(__DIR__ ."/cache/", 0700);
15
-
16
-        return true;
17
-    }
18
-
19
-    /**
20
-     * check if cache file exists
21
-     *
22
-     * @return bool
23
-     */
24
-    public static function isFile()
25
-    {
26
-        $files = glob(__DIR__ .'/cache/*.txt');
27
-        $count = count($files);
28
-        if($count>0){
29
-            $output = true;
30
-        }else{
31
-            $output = false;
32
-        }
33
-
34
-        return $output;
35
-    }
36
-
37
-    /**
38
-     *  get name of cache file
39
-     *
40
-     * @return string
41
-     */
42
-    public static function getFileName()
43
-    {
44
-        $files = glob(__DIR__ .'/cache/*.txt');
45
-        $file = $files[0];
46
-        $fileName = explode("/cache/", $file);
47
-        $fileName = $fileName[1];
48
-
49
-        return $fileName;
50
-    }
51
-
52
-    /**
53
-     *  check if cache file is needed to update
54
-     *
55
-     * @return bool
56
-     */
57
-    public static function isCurrent($file)
58
-    {
59
-        $getSourceName = explode(".", $file);
60
-        $getSourceName = $getSourceName[0];
61
-
62
-        $current_time = time();
63
-        if($current_time>$getSourceName){
64
-                $output = false;
65
-        }else{
66
-                $output = true;
67
-        }
68
-
69
-        return $output;
70
-    }
71
-
72
-    /**
73
-     *  create new cache file
74
-     *
75
-     * @param  string|bool   $file
76
-     * @param  array|string  $data
77
-     * @param  int           $time
78
-     * @return bool
79
-     */
80
-    public static function setNewCacheFile($file, $data, $time)
81
-    {
82
-        if($file) unlink(__DIR__ .'/cache/'.$file);
83
-
84
-        $current_time = time();
85
-        $new_time = $current_time + $time*60;
86
-
87
-        $file_name = $new_time.".txt";
88
-        file_put_contents(__DIR__ .'/cache/'.$file_name, $data);
89
-
90
-        return true;
91
-    }
92
-
93
-    /**
94
-     *  get cache data
95
-     *
96
-     * @return string
97
-     */
98
-    public static function getCache($file)
99
-    {
100
-        $data = file_get_contents(__DIR__ .'/cache/'.$file);
101
-
102
-        return $data;
103
-    }
7
+	/**
8
+	 * check if is cache dir
9
+	 *
10
+	 * @return bool
11
+	 */
12
+	public static function isCacheDir()
13
+	{
14
+		if(!is_dir(__DIR__ .'/cache/')) mkdir(__DIR__ ."/cache/", 0700);
15
+
16
+		return true;
17
+	}
18
+
19
+	/**
20
+	 * check if cache file exists
21
+	 *
22
+	 * @return bool
23
+	 */
24
+	public static function isFile()
25
+	{
26
+		$files = glob(__DIR__ .'/cache/*.txt');
27
+		$count = count($files);
28
+		if($count>0){
29
+			$output = true;
30
+		}else{
31
+			$output = false;
32
+		}
33
+
34
+		return $output;
35
+	}
36
+
37
+	/**
38
+	 *  get name of cache file
39
+	 *
40
+	 * @return string
41
+	 */
42
+	public static function getFileName()
43
+	{
44
+		$files = glob(__DIR__ .'/cache/*.txt');
45
+		$file = $files[0];
46
+		$fileName = explode("/cache/", $file);
47
+		$fileName = $fileName[1];
48
+
49
+		return $fileName;
50
+	}
51
+
52
+	/**
53
+	 *  check if cache file is needed to update
54
+	 *
55
+	 * @return bool
56
+	 */
57
+	public static function isCurrent($file)
58
+	{
59
+		$getSourceName = explode(".", $file);
60
+		$getSourceName = $getSourceName[0];
61
+
62
+		$current_time = time();
63
+		if($current_time>$getSourceName){
64
+				$output = false;
65
+		}else{
66
+				$output = true;
67
+		}
68
+
69
+		return $output;
70
+	}
71
+
72
+	/**
73
+	 *  create new cache file
74
+	 *
75
+	 * @param  string|bool   $file
76
+	 * @param  array|string  $data
77
+	 * @param  int           $time
78
+	 * @return bool
79
+	 */
80
+	public static function setNewCacheFile($file, $data, $time)
81
+	{
82
+		if($file) unlink(__DIR__ .'/cache/'.$file);
83
+
84
+		$current_time = time();
85
+		$new_time = $current_time + $time*60;
86
+
87
+		$file_name = $new_time.".txt";
88
+		file_put_contents(__DIR__ .'/cache/'.$file_name, $data);
89
+
90
+		return true;
91
+	}
92
+
93
+	/**
94
+	 *  get cache data
95
+	 *
96
+	 * @return string
97
+	 */
98
+	public static function getCache($file)
99
+	{
100
+		$data = file_get_contents(__DIR__ .'/cache/'.$file);
101
+
102
+		return $data;
103
+	}
104 104
 }
Please login to merge, or discard this patch.