1 | <?php |
||
15 | class Minify |
||
16 | { |
||
17 | /** |
||
18 | * @var Environment |
||
19 | */ |
||
20 | protected $objEnvironment; |
||
21 | |||
22 | /** |
||
23 | * Cache bust file path |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $strCacheBustFile; |
||
28 | |||
29 | /** |
||
30 | * Public folder path |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $strPublicFolderPath; |
||
35 | |||
36 | /** |
||
37 | * File types supported |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $arrFileTypes; |
||
42 | |||
43 | /** |
||
44 | * Destination file extension |
||
45 | * |
||
46 | * @var string |
||
47 | */ |
||
48 | protected $strDestinationExtension; |
||
49 | |||
50 | /** |
||
51 | * Destination folder |
||
52 | * |
||
53 | * @var |
||
54 | */ |
||
55 | protected $strDestinationFolder; |
||
56 | |||
57 | /** |
||
58 | * Destination file |
||
59 | * |
||
60 | * @var |
||
61 | */ |
||
62 | protected $strDestinationFile; |
||
63 | |||
64 | /** |
||
65 | * Set env to dev |
||
66 | * |
||
67 | * @var |
||
68 | */ |
||
69 | protected $blnIsDev; |
||
70 | |||
71 | /** |
||
72 | * Create a new Minifier Instance |
||
73 | * |
||
74 | * Minify constructor. |
||
75 | */ |
||
76 | public function __construct() |
||
84 | |||
85 | |||
86 | /** |
||
87 | * Set Class Variables |
||
88 | * |
||
89 | * @return null |
||
90 | */ |
||
91 | public function init() |
||
104 | |||
105 | /** |
||
106 | * Build minified file |
||
107 | * |
||
108 | * @var $strFolder string |
||
109 | * @var $strFile string |
||
110 | * @return string |
||
111 | */ |
||
112 | public function js($strFolder = '/js', $strFile = 'app.min.js') |
||
116 | |||
117 | /** |
||
118 | * Build CSS minified file |
||
119 | * |
||
120 | * @var $strFolder string |
||
121 | * @var $strFile string |
||
122 | * @return bool|null|string |
||
123 | */ |
||
124 | public function css($strFolder = '/css', $strFile = 'app.min.css') |
||
128 | |||
129 | /** |
||
130 | * Generate minified file |
||
131 | * |
||
132 | * @param string $strType |
||
133 | * @param string $strFolder |
||
134 | * @param string $strFile |
||
135 | * @return string |
||
136 | */ |
||
137 | public function getMinifiedFile($strType = 'css', $strFolder = '/css', $strFile = 'app.min.css') |
||
145 | |||
146 | /** |
||
147 | * Process Built |
||
148 | * |
||
149 | * @return bool|null|string |
||
150 | */ |
||
151 | public function process() |
||
167 | |||
168 | /** |
||
169 | * Build file |
||
170 | * |
||
171 | * @return string |
||
172 | */ |
||
173 | public function build() |
||
204 | |||
205 | /** |
||
206 | * Get minified Content |
||
207 | * |
||
208 | * @param $strFileName |
||
209 | * @return bool|string |
||
210 | */ |
||
211 | public function getMinifiedContent($strFileName) |
||
238 | |||
239 | /** |
||
240 | * Minify content |
||
241 | * |
||
242 | * @param $strFile |
||
243 | * @return bool|string |
||
244 | */ |
||
245 | public function minifyContent($strFile) |
||
257 | |||
258 | /** |
||
259 | * Save Cache Bust |
||
260 | * |
||
261 | * @var string $strApplicationFileContents |
||
262 | * @return null |
||
263 | */ |
||
264 | public function saveCacheBust($strApplicationFileContents = '') |
||
283 | |||
284 | /** |
||
285 | * Get Cache Bust |
||
286 | * |
||
287 | * @return bool|string |
||
288 | */ |
||
289 | public function getCacheBust() |
||
299 | |||
300 | /** |
||
301 | * Set env to Dev |
||
302 | * |
||
303 | * @param bool $bln |
||
304 | * @return $this |
||
305 | */ |
||
306 | public function setDev($bln = true) |
||
312 | |||
313 | /** |
||
314 | * Set Cache bust file |
||
315 | * |
||
316 | * @param string $strFile |
||
317 | * @return $this |
||
318 | */ |
||
319 | public function setCacheBustFile($strFile = 'autominifier-cache-bust.txt') |
||
324 | |||
325 | /** |
||
326 | * Set public folder |
||
327 | * |
||
328 | * @param string $strFolder |
||
329 | * @return $this |
||
330 | */ |
||
331 | public function setPublicFolder($strFolder = '/../../../../public') |
||
337 | |||
338 | /** |
||
339 | * Set test folder |
||
340 | * |
||
341 | * @return $this |
||
342 | */ |
||
343 | public function setTest() |
||
353 | |||
354 | /** |
||
355 | * Set destination folder |
||
356 | * |
||
357 | * @param $strFolder |
||
358 | * @return $this |
||
359 | */ |
||
360 | public function setDestinationFolder($strFolder) |
||
365 | |||
366 | /** |
||
367 | * Set destination file |
||
368 | * |
||
369 | * @param $strFile |
||
370 | * @return $this |
||
371 | */ |
||
372 | public function setDestinationFile($strFile) |
||
377 | |||
378 | /** |
||
379 | * Set destination file extension |
||
380 | * |
||
381 | * @param $strDestinationExtension |
||
382 | */ |
||
383 | public function setDestinationExtensionType($strDestinationExtension) |
||
387 | |||
388 | /** |
||
389 | * Get Public folder |
||
390 | * |
||
391 | * @return string |
||
392 | */ |
||
393 | public function getPublicFolder() |
||
397 | |||
398 | /** |
||
399 | * Get destination folder |
||
400 | * |
||
401 | * @return mixed |
||
402 | */ |
||
403 | public function getDestinationFolder() |
||
407 | |||
408 | /** |
||
409 | * Set destination file |
||
410 | * |
||
411 | * @return mixed |
||
412 | */ |
||
413 | public function getDestinationFile() |
||
417 | |||
418 | /** |
||
419 | * Get application file name |
||
420 | * |
||
421 | * @return string |
||
422 | */ |
||
423 | public function getAppFileName() |
||
427 | |||
428 | /** |
||
429 | * Get destination file type extension |
||
430 | * |
||
431 | * @return mixed |
||
432 | */ |
||
433 | public function getDestinationExtension() |
||
437 | |||
438 | /** |
||
439 | * Get files folder |
||
440 | * |
||
441 | * @return string |
||
442 | */ |
||
443 | public function getFilesFolder() |
||
447 | } |
||
448 |