Passed
Push — master ( f20f2e...004834 )
by Mihail
05:22
created
Widgets/Front/Contenttag/Contenttag.php 2 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.
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/Model/Admin/Contenttag/FormSettings.php 1 patch
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.