1 | <?php |
||
15 | class Minify |
||
16 | { |
||
17 | /** |
||
18 | * @var Environment |
||
19 | */ |
||
20 | protected $objEnvironment; |
||
21 | |||
22 | /** |
||
23 | * @var |
||
24 | */ |
||
25 | protected $objConfig; |
||
26 | |||
27 | /** |
||
28 | * @var Files |
||
29 | */ |
||
30 | protected $objFiles; |
||
31 | |||
32 | /** |
||
33 | * Cache bust file path |
||
34 | * |
||
35 | * @var string |
||
36 | */ |
||
37 | protected $strCacheBustFile; |
||
38 | |||
39 | /** |
||
40 | * Public folder path |
||
41 | * |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $strPublicFolderPath; |
||
45 | |||
46 | /** |
||
47 | * File types supported |
||
48 | * |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $arrFileTypes; |
||
52 | |||
53 | /** |
||
54 | * Destination file extension |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | protected $strDestinationExtension; |
||
59 | |||
60 | /** |
||
61 | * Destination folder |
||
62 | * |
||
63 | * @var |
||
64 | */ |
||
65 | protected $strDestinationFolder; |
||
66 | |||
67 | /** |
||
68 | * Destination file |
||
69 | * |
||
70 | * @var |
||
71 | */ |
||
72 | protected $strDestinationFile; |
||
73 | |||
74 | /** |
||
75 | * Set env to dev |
||
76 | * |
||
77 | * @var |
||
78 | */ |
||
79 | protected $blnIsDev; |
||
80 | |||
81 | /** |
||
82 | * Create a new Minifier Instance |
||
83 | * |
||
84 | * Minify constructor. |
||
85 | */ |
||
86 | 3 | public function __construct() |
|
97 | |||
98 | /** |
||
99 | * Set Class Variables |
||
100 | * |
||
101 | * @return null |
||
102 | */ |
||
103 | 3 | public function init() |
|
116 | |||
117 | /** |
||
118 | * Build minified file |
||
119 | * |
||
120 | * @var $strFolder string |
||
121 | * @var $strFile string |
||
122 | * @return string |
||
123 | */ |
||
124 | 3 | public function js($strFolder = '/js', $strFile = 'app.min.js') |
|
128 | |||
129 | /** |
||
130 | * Build CSS minified file |
||
131 | * |
||
132 | * @var $strFolder string |
||
133 | * @var $strFile string |
||
134 | * @return bool|null|string |
||
135 | */ |
||
136 | 3 | public function css($strFolder = '/css', $strFile = 'app.min.css') |
|
140 | |||
141 | /** |
||
142 | * Generate minified file |
||
143 | * |
||
144 | * @param string $strType |
||
145 | * @param string $strFolder |
||
146 | * @param string $strFile |
||
147 | * @return string |
||
148 | */ |
||
149 | 3 | public function getMinifiedFile($strType = 'css', $strFolder = '/css', $strFile = 'app.min.css') |
|
158 | |||
159 | /** |
||
160 | * Process Built |
||
161 | * |
||
162 | * @return bool|null|string |
||
163 | */ |
||
164 | 3 | public function process() |
|
180 | |||
181 | /** |
||
182 | * Build file |
||
183 | * |
||
184 | * @return string |
||
185 | */ |
||
186 | 3 | public function build() |
|
208 | |||
209 | /** |
||
210 | * @return array |
||
211 | */ |
||
212 | 3 | public function getFiles() |
|
222 | |||
223 | /** |
||
224 | * Get minified Content |
||
225 | * |
||
226 | * @param $strFileName |
||
227 | * @return bool|string |
||
228 | */ |
||
229 | 3 | public function getMinifiedContent($strFileName) |
|
247 | |||
248 | /** |
||
249 | * Determine if it's a valid file name |
||
250 | * |
||
251 | * @param $strFileName |
||
252 | * @return bool |
||
253 | */ |
||
254 | 3 | public function isValidFileName($strFileName) |
|
272 | |||
273 | /** |
||
274 | * Minify content |
||
275 | * |
||
276 | * @param $strFile |
||
277 | * @return bool|string |
||
278 | */ |
||
279 | public function minifyContent($strFile) |
||
291 | |||
292 | /** |
||
293 | * Load configuration |
||
294 | */ |
||
295 | 3 | public function loadConfig() |
|
303 | |||
304 | /** |
||
305 | * Set env to Dev |
||
306 | * |
||
307 | * @param bool $bln |
||
308 | * @return $this |
||
309 | */ |
||
310 | 3 | public function setDev($bln = true) |
|
316 | |||
317 | /** |
||
318 | * Set Cache bust file |
||
319 | * |
||
320 | * @return $this |
||
321 | */ |
||
322 | 3 | public function setCacheBustFile() |
|
327 | |||
328 | /** |
||
329 | * Set public folder |
||
330 | * |
||
331 | * @param string $strFolder |
||
332 | * @return $this |
||
333 | */ |
||
334 | 3 | public function setPublicFolder($strFolder = '/../../../../public') |
|
340 | |||
341 | /** |
||
342 | * Set test folder |
||
343 | * |
||
344 | * @return $this |
||
345 | */ |
||
346 | 3 | public function setTest() |
|
356 | |||
357 | /** |
||
358 | * Set destination folder |
||
359 | * |
||
360 | * @param $strFolder |
||
361 | * @return $this |
||
362 | */ |
||
363 | 3 | public function setDestinationFolder($strFolder) |
|
368 | |||
369 | /** |
||
370 | * Set destination file |
||
371 | * |
||
372 | * @param $strFile |
||
373 | * @return $this |
||
374 | */ |
||
375 | 3 | public function setDestinationFile($strFile) |
|
380 | |||
381 | |||
382 | /** |
||
383 | * Set destination file extension |
||
384 | * |
||
385 | * @param $strDestinationExtension |
||
386 | * @return $this |
||
387 | */ |
||
388 | 3 | public function setDestinationExtensionType($strDestinationExtension) |
|
393 | |||
394 | /** |
||
395 | * Get Public folder |
||
396 | * |
||
397 | * @return string |
||
398 | */ |
||
399 | 3 | public function getPublicFolder() |
|
403 | |||
404 | /** |
||
405 | * Get destination folder |
||
406 | * |
||
407 | * @return mixed |
||
408 | */ |
||
409 | 3 | public function getDestinationFolder() |
|
413 | |||
414 | /** |
||
415 | * Set destination file |
||
416 | * |
||
417 | * @return mixed |
||
418 | */ |
||
419 | 3 | public function getDestinationFile() |
|
423 | |||
424 | /** |
||
425 | * Get application file name |
||
426 | * |
||
427 | * @return string |
||
428 | */ |
||
429 | 3 | public function getAppFileName() |
|
433 | |||
434 | /** |
||
435 | * Get destination file type extension |
||
436 | * |
||
437 | * @return mixed |
||
438 | */ |
||
439 | 3 | public function getDestinationExtension() |
|
443 | |||
444 | /** |
||
445 | * Get files folder |
||
446 | * |
||
447 | * @return string |
||
448 | */ |
||
449 | 3 | public function getFilesFolder() |
|
453 | } |
||
454 |