Total Complexity | 7 |
Total Lines | 57 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
25 | class FileMinifier |
||
26 | { |
||
27 | /** |
||
28 | * Read the file content |
||
29 | * |
||
30 | * @param string $sPath |
||
31 | * |
||
32 | * @return string|false |
||
33 | */ |
||
34 | private function readFile(string $sPath) |
||
35 | { |
||
36 | try |
||
37 | { |
||
38 | return file_get_contents($sPath); |
||
39 | } |
||
40 | catch(Exception $e) |
||
41 | { |
||
42 | return false; |
||
43 | } |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Read the file content |
||
48 | * |
||
49 | * @param string $sCode |
||
50 | * |
||
51 | * @return string|false |
||
52 | */ |
||
53 | private function minifyCode(string $sCode) |
||
54 | { |
||
55 | try |
||
56 | { |
||
57 | return Minifier::minify($sCode); |
||
|
|||
58 | } |
||
59 | catch(Exception $e) |
||
60 | { |
||
61 | return false; |
||
62 | } |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Minify javascript code |
||
67 | * |
||
68 | * @param string $sJsFile The javascript file to be minified |
||
69 | * @param string $sMinFile The minified javascript file |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | public function minify(string $sJsFile, string $sMinFile): bool |
||
82 | } |
||
83 | } |
||
84 |