1 | <?php |
||
6 | class CFastTrackCache |
||
|
|||
7 | { |
||
8 | /** |
||
9 | * Cache is disabled to start with. |
||
10 | */ |
||
11 | private $enabled = false; |
||
12 | |||
13 | |||
14 | |||
15 | /** |
||
16 | * Path to the cache directory. |
||
17 | */ |
||
18 | private $path; |
||
19 | |||
20 | |||
21 | |||
22 | /** |
||
23 | * Filename of current cache item. |
||
24 | */ |
||
25 | private $filename; |
||
26 | |||
27 | |||
28 | |||
29 | /** |
||
30 | * Container with items to store as cached item. |
||
31 | */ |
||
32 | private $container; |
||
33 | |||
34 | |||
35 | |||
36 | /** |
||
37 | * Enable or disable cache. |
||
38 | * |
||
39 | * @param boolean $enable set to true to enable, false to disable |
||
40 | * |
||
41 | * @return $this |
||
42 | */ |
||
43 | public function enable($enabled) |
||
48 | |||
49 | |||
50 | |||
51 | /** |
||
52 | * Set the path to the cache dir which must exist. |
||
53 | * |
||
54 | * @param string $path to the cache dir. |
||
55 | * |
||
56 | * @throws Exception when $path is not a directory. |
||
57 | * |
||
58 | * @return $this |
||
59 | */ |
||
60 | public function setCacheDir($path) |
||
70 | |||
71 | |||
72 | |||
73 | /** |
||
74 | * Set the filename to store in cache, use the querystring to create that |
||
75 | * filename. |
||
76 | * |
||
77 | * @param array $clear items to clear in $_GET when creating the filename. |
||
78 | * |
||
79 | * @return string as filename created. |
||
80 | */ |
||
81 | public function setFilename($clear) |
||
98 | |||
99 | |||
100 | |||
101 | /** |
||
102 | * Add header items. |
||
103 | * |
||
104 | * @param string $header add this as header. |
||
105 | * |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function addHeader($header) |
||
113 | |||
114 | |||
115 | |||
116 | /** |
||
117 | * Add header items on output, these are not output when 304. |
||
118 | * |
||
119 | * @param string $header add this as header. |
||
120 | * |
||
121 | * @return $this |
||
122 | */ |
||
123 | public function addHeaderOnOutput($header) |
||
128 | |||
129 | |||
130 | |||
131 | /** |
||
132 | * Set path to source image to. |
||
133 | * |
||
134 | * @param string $source path to source image file. |
||
135 | * |
||
136 | * @return $this |
||
137 | */ |
||
138 | public function setSource($source) |
||
143 | |||
144 | |||
145 | |||
146 | /** |
||
147 | * Set last modified of source image, use to check for 304. |
||
148 | * |
||
149 | * @param string $lastModified |
||
150 | * |
||
151 | * @return $this |
||
152 | */ |
||
153 | public function setLastModified($lastModified) |
||
158 | |||
159 | |||
160 | |||
161 | /** |
||
162 | * Get filename of cached item. |
||
163 | * |
||
164 | * @return string as filename. |
||
165 | */ |
||
166 | public function getFilename() |
||
170 | |||
171 | |||
172 | |||
173 | /** |
||
174 | * Write current item to cache. |
||
175 | * |
||
176 | * @return boolean if cache file was written. |
||
177 | */ |
||
178 | public function writeToCache() |
||
191 | |||
192 | |||
193 | |||
194 | /** |
||
195 | * Output current item from cache, if available. |
||
196 | * |
||
197 | * @return void |
||
198 | */ |
||
199 | public function output() |
||
231 | } |
||
232 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.