Completed
Push — master ( 538c9f...f6ad35 )
by Andrey
03:04 queued 53s
created
MinifyHTML.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -5,6 +5,9 @@
 block discarded – undo
5 5
 
6 6
     private $source;
7 7
 
8
+    /**
9
+     * @param string $source
10
+     */
8 11
     public function __construct($source){
9 12
         $this->source = $source;
10 13
     }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@
 block discarded – undo
5 5
 
6 6
     private $source;
7 7
 
8
-    public function __construct($source){
8
+    public function __construct($source) {
9 9
         $this->source = $source;
10 10
     }
11 11
 
12
-    public function compress(){
12
+    public function compress() {
13 13
         $minify = $this->source;
14
-        $minify = preg_replace('/>[\s]*</Ui','><',$minify);
14
+        $minify = preg_replace('/>[\s]*</Ui', '><', $minify);
15 15
         return $minify;
16 16
     }
17 17
 
Please login to merge, or discard this patch.
Js.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@
 block discarded – undo
7 7
     private static $host;
8 8
     private static $config;   
9 9
 
10
-    public function __construct(){
10
+    public function __construct() {
11 11
         # Config
12 12
         self::$config = (new Config)->get();
13 13
         # Host
14 14
         self::$host = parse_url('http://'.$_SERVER['HTTP_HOST']);
15
-        if(isset(self::$host['host'])) self::$host = self::$host['host'];
15
+        if (isset(self::$host['host'])) self::$host = self::$host['host'];
16 16
         else self::$host = '/';
17 17
     }
18 18
 
19
-    public function add($js){
20
-        if(!is_array($js)) $js = [$js];
21
-        self::$list = array_merge(self::$list,$js);
19
+    public function add($js) {
20
+        if (!is_array($js)) $js = [$js];
21
+        self::$list = array_merge(self::$list, $js);
22 22
     }
23 23
 
24
-    public function get(){
24
+    public function get() {
25 25
         $js = array_unique(self::$list);
26
-        if(!empty($js)) $jsQuery = '?'.implode(':',$js);
26
+        if (!empty($js)) $jsQuery = '?'.implode(':', $js);
27 27
         else $jsQuery = '';
28 28
         return '<script async src="http://'.self::$host.'/javascript.js'.$jsQuery.'"></script>';
29 29
     }
30 30
 
31
-    public function compile($query){
31
+    public function compile($query) {
32 32
         $js = $query;
33 33
         $code = '';
34
-        foreach($js as $name){
34
+        foreach ($js as $name) {
35 35
             $file = self::$config['core']['js'].'/'.$name.'.js';
36
-            if(is_file($file)) $code .= file_get_contents($file);
36
+            if (is_file($file)) $code .= file_get_contents($file);
37 37
         }
38 38
         $minifier = new \MatthiasMullie\Minify\JS();
39 39
         $minifier->add($code);
Please login to merge, or discard this patch.
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,19 +12,27 @@  discard block
 block discarded – undo
12 12
         self::$config = (new Config)->get();
13 13
         # Host
14 14
         self::$host = parse_url('http://'.$_SERVER['HTTP_HOST']);
15
-        if(isset(self::$host['host'])) self::$host = self::$host['host'];
16
-        else self::$host = '/';
15
+        if(isset(self::$host['host'])) {
16
+            self::$host = self::$host['host'];
17
+        } else {
18
+            self::$host = '/';
19
+        }
17 20
     }
18 21
 
19 22
     public function add($js){
20
-        if(!is_array($js)) $js = [$js];
23
+        if(!is_array($js)) {
24
+            $js = [$js];
25
+        }
21 26
         self::$list = array_merge(self::$list,$js);
22 27
     }
23 28
 
24 29
     public function get(){
25 30
         $js = array_unique(self::$list);
26
-        if(!empty($js)) $jsQuery = '?'.implode(':',$js);
27
-        else $jsQuery = '';
31
+        if(!empty($js)) {
32
+            $jsQuery = '?'.implode(':',$js);
33
+        } else {
34
+            $jsQuery = '';
35
+        }
28 36
         return '<script async src="http://'.self::$host.'/javascript.js'.$jsQuery.'"></script>';
29 37
     }
30 38
 
@@ -33,7 +41,9 @@  discard block
 block discarded – undo
33 41
         $code = '';
34 42
         foreach($js as $name){
35 43
             $file = self::$config['core']['js'].'/'.$name.'.js';
36
-            if(is_file($file)) $code .= file_get_contents($file);
44
+            if(is_file($file)) {
45
+                $code .= file_get_contents($file);
46
+            }
37 47
         }
38 48
         $minifier = new \MatthiasMullie\Minify\JS();
39 49
         $minifier->add($code);
Please login to merge, or discard this patch.