Passed
Push — master ( f89ee0...ab76f6 )
by Patryk
01:15
created
src/Cache/CacheFile.php 3 patches
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.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public static function isCacheDir()
13 13
     {
14
-        if(!is_dir(__DIR__ .'/cache/')) mkdir(__DIR__ ."/cache/", 0700);
14
+        if (!is_dir(__DIR__.'/cache/')) mkdir(__DIR__."/cache/", 0700);
15 15
 
16 16
         return true;
17 17
     }
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public static function isFile()
25 25
     {
26
-        $files = glob(__DIR__ .'/cache/*.txt');
26
+        $files = glob(__DIR__.'/cache/*.txt');
27 27
         $count = count($files);
28
-        if($count>0){
28
+        if ($count>0) {
29 29
             $output = true;
30
-        }else{
30
+        }else {
31 31
             $output = false;
32 32
         }
33 33
 
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public static function getFileName()
43 43
     {
44
-        $files = glob(__DIR__ .'/cache/*.txt');
44
+        $files = glob(__DIR__.'/cache/*.txt');
45 45
         $file = $files[0];
46 46
         $fileName = explode("/cache/", $file);
47 47
         $fileName = $fileName[1];
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
         $getSourceName = $getSourceName[0];
61 61
 
62 62
         $current_time = time();
63
-        if($current_time>$getSourceName){
63
+        if ($current_time>$getSourceName) {
64 64
                 $output = false;
65
-        }else{
65
+        }else {
66 66
                 $output = true;
67 67
         }
68 68
 
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
      */
80 80
     public static function setNewCacheFile($file, $data, $time)
81 81
     {
82
-        if($file) unlink(__DIR__ .'/cache/'.$file);
82
+        if ($file) unlink(__DIR__.'/cache/'.$file);
83 83
 
84 84
         $current_time = time();
85 85
         $new_time = $current_time + $time*60;
86 86
 
87 87
         $file_name = $new_time.".txt";
88
-        file_put_contents(__DIR__ .'/cache/'.$file_name, $data);
88
+        file_put_contents(__DIR__.'/cache/'.$file_name, $data);
89 89
 
90 90
         return true;
91 91
     }
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      */
98 98
     public static function getCache($file)
99 99
     {
100
-        $data = file_get_contents(__DIR__ .'/cache/'.$file);
100
+        $data = file_get_contents(__DIR__.'/cache/'.$file);
101 101
 
102 102
         return $data;
103 103
     }
Please login to merge, or discard this patch.
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
      */
12 12
     public static function isCacheDir()
13 13
     {
14
-        if(!is_dir(__DIR__ .'/cache/')) mkdir(__DIR__ ."/cache/", 0700);
14
+        if(!is_dir(__DIR__ .'/cache/')) {
15
+        	mkdir(__DIR__ ."/cache/", 0700);
16
+        }
15 17
 
16 18
         return true;
17 19
     }
@@ -27,7 +29,7 @@  discard block
 block discarded – undo
27 29
         $count = count($files);
28 30
         if($count>0){
29 31
             $output = true;
30
-        }else{
32
+        } else{
31 33
             $output = false;
32 34
         }
33 35
 
@@ -62,7 +64,7 @@  discard block
 block discarded – undo
62 64
         $current_time = time();
63 65
         if($current_time>$getSourceName){
64 66
                 $output = false;
65
-        }else{
67
+        } else{
66 68
                 $output = true;
67 69
         }
68 70
 
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
      */
80 82
     public static function setNewCacheFile($file, $data, $time)
81 83
     {
82
-        if($file) unlink(__DIR__ .'/cache/'.$file);
84
+        if($file) {
85
+        	unlink(__DIR__ .'/cache/'.$file);
86
+        }
83 87
 
84 88
         $current_time = time();
85 89
         $new_time = $current_time + $time*60;
Please login to merge, or discard this patch.