Passed
Push — master ( f20f2e...004834 )
by Mihail
05:22
created
Widgets/Front/Contenttag/Contenttag.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -58,6 +58,9 @@
 block discarded – undo
58 58
     	]);
59 59
     }
60 60
     
61
+    /**
62
+     * @return string
63
+     */
61 64
     private function makeQuery()
62 65
     {
63 66
         return TagRecord::select([
Please login to merge, or discard this patch.
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 
11 11
 class Contenttag extends AbstractWidget
12 12
 {
13
-	use OopTools;
13
+    use OopTools;
14 14
     
15
-	public $count;
16
-	public $cache;
15
+    public $count;
16
+    public $cache;
17 17
 	
18
-	public $tpl = 'widgets/contenttag/default';
18
+    public $tpl = 'widgets/contenttag/default';
19 19
 
20 20
     public function init()
21 21
     {
@@ -33,39 +33,39 @@  discard block
 block discarded – undo
33 33
     public function display()
34 34
     {
35 35
         // get special properties hash
36
-    	$classHash = $this->createStringClassSnapshotHash();
36
+        $classHash = $this->createStringClassSnapshotHash();
37 37
     	
38
-    	// get records rows from cache or directly from db
39
-    	$records = null;
40
-    	if ($this->cache === 0) {
41
-    	    $records = $this->makeQuery();
42
-    	} else {
43
-    	    $records === App::$Cache->get('widget.contenttag.' . $classHash);
44
-    	    if ($records === null) {
45
-    	        $records = $this->makeQuery();
46
-    	        App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache);
47
-    	    }
48
-    	}
38
+        // get records rows from cache or directly from db
39
+        $records = null;
40
+        if ($this->cache === 0) {
41
+            $records = $this->makeQuery();
42
+        } else {
43
+            $records === App::$Cache->get('widget.contenttag.' . $classHash);
44
+            if ($records === null) {
45
+                $records = $this->makeQuery();
46
+                App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache);
47
+            }
48
+        }
49 49
     	
50
-    	// check if result is not empty
50
+        // check if result is not empty
51 51
         if ($records === null || $records->count() < 1) {
52 52
             return __('Content tags is not found');
53 53
         }
54 54
     	
55 55
         // render view
56
-    	return App::$View->render($this->tpl, [
57
-    	    'records' => $records
58
-    	]);
56
+        return App::$View->render($this->tpl, [
57
+            'records' => $records
58
+        ]);
59 59
     }
60 60
     
61 61
     private function makeQuery()
62 62
     {
63 63
         return TagRecord::select([
64
-    	    App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), 
65
-    	    App::$Database->getConnection()->raw('COUNT(*) AS count')
66
-    	])->groupBy('tag')
67
-        	->orderBy('count', 'DESC')
68
-        	->take($this->count)
69
-        	->get();
64
+            App::$Database->getConnection()->raw('SQL_CALC_FOUND_ROWS tag'), 
65
+            App::$Database->getConnection()->raw('COUNT(*) AS count')
66
+        ])->groupBy('tag')
67
+            ->orderBy('count', 'DESC')
68
+            ->take($this->count)
69
+            ->get();
70 70
     }
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
         $cfg = $this->getConfigs();
23 23
         // check cache is defined
24 24
         if ($this->cache === null || !Obj::isLikeInt($this->cache)) {
25
-            $this->cache = (int)$cfg['cache'];
25
+            $this->cache = (int) $cfg['cache'];
26 26
         }
27 27
         // check tag count is defined
28 28
         if ($this->count === null || !Obj::isLikeInt($this->count)) {
29
-            $this->count = (int)$cfg['count'];
29
+            $this->count = (int) $cfg['count'];
30 30
         }
31 31
     }
32 32
     
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
     	if ($this->cache === 0) {
41 41
     	    $records = $this->makeQuery();
42 42
     	} else {
43
-    	    $records === App::$Cache->get('widget.contenttag.' . $classHash);
43
+    	    $records === App::$Cache->get('widget.contenttag.'.$classHash);
44 44
     	    if ($records === null) {
45 45
     	        $records = $this->makeQuery();
46
-    	        App::$Cache->set('widget.contenttag' . $classHash, $records, $this->cache);
46
+    	        App::$Cache->set('widget.contenttag'.$classHash, $records, $this->cache);
47 47
     	    }
48 48
     	}
49 49
     	
Please login to merge, or discard this patch.
Apps/Controller/Admin/Contenttag.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
         
30 30
         // render view output
31 31
         return App::$View->render('index', [
32
-           'model' => $model 
32
+            'model' => $model 
33 33
         ]);
34 34
     }
35 35
 }
36 36
\ No newline at end of file
Please login to merge, or discard this patch.
Apps/View/Front/default/widgets/contenttag/default.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,5 +5,5 @@
 block discarded – undo
5 5
 ?>
6 6
 
7 7
 <?php foreach ($records as $row) {
8
-    echo Url::link(['content/tag', $row['tag']], $row['tag'], ['class' => 'label label-default']) . ' ';
8
+    echo Url::link(['content/tag', $row['tag']], $row['tag'], ['class' => 'label label-default']).' ';
9 9
 }
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
Apps/Model/Admin/Contenttag/FormSettings.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
     }
23 23
 
24 24
     /**
25
-    * Set default model properties from global configuration
26
-    */
25
+     * Set default model properties from global configuration
26
+     */
27 27
     public function before()
28 28
     {
29 29
         $this->count = (int)$this->_configs['count'];
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
     }
32 32
 
33 33
     /**
34
-    * Form display labels 
35
-    */
34
+     * Form display labels 
35
+     */
36 36
     public function labels()
37 37
     {
38 38
         return [
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
     }
43 43
 
44 44
     /**
45
-    * Validation rules
46
-    */
45
+     * Validation rules
46
+     */
47 47
     public function rules()
48 48
     {
49 49
         return [
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -26,8 +26,8 @@
 block discarded – undo
26 26
     */
27 27
     public function before()
28 28
     {
29
-        $this->count = (int)$this->_configs['count'];
30
-        $this->cache = (int)$this->_configs['cache'];
29
+        $this->count = (int) $this->_configs['count'];
30
+        $this->cache = (int) $this->_configs['cache'];
31 31
     }
32 32
 
33 33
     /**
Please login to merge, or discard this patch.