Completed
Push — master ( cfb1a5...baf1ef )
by Nikola
03:35
created
components/terms/BaseTerm.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 
36 36
     public function removeTerm($object_id, $params = [])
37 37
     {
38
-        if(empty($params)) {
38
+        if (empty($params)) {
39 39
             $params = $this->getTerms($object_id);
40 40
         }
41 41
 
42
-        foreach($params as $item) {
42
+        foreach ($params as $item) {
43 43
             $term = $this->getTaxonomyTerm($item);
44 44
             $data['term_id'] = $term->id;
45 45
             $data['object_id'] = $object_id;
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
                 $this->getDb()->createCommand()->delete($this->table, $data)->execute();
50 50
 
51 51
                 $term->updateCounters(['total_count' => -1]);
52
-                Taxonomydef::updateAllCounters(['total_count' => -1], [ 'id' => $this->id ]);
52
+                Taxonomydef::updateAllCounters(['total_count' => -1], ['id' => $this->id]);
53 53
             }
54 54
         }
55 55
     }
@@ -57,14 +57,14 @@  discard block
 block discarded – undo
57 57
     public function getTerms($object_id, $name = [])
58 58
     {
59 59
         $query = (new Query())
60
-            ->select(TaxonomyTerms::tableName() . '.term')
60
+            ->select(TaxonomyTerms::tableName().'.term')
61 61
             ->from(TaxonomyTerms::tableName())
62
-            ->innerJoin($this->table, $this->table . '.term_id = taxonomy_terms.id and ' . $this->table . '.object_id=:object_id',
62
+            ->innerJoin($this->table, $this->table.'.term_id = taxonomy_terms.id and '.$this->table.'.object_id=:object_id',
63 63
                 [':object_id' => $object_id])
64 64
             ->andFilterWhere(['taxonomy_terms.term' => $name]);
65 65
         
66 66
         $result = [];
67
-        foreach($query->all() as $v)
67
+        foreach ($query->all() as $v)
68 68
             $result[] = $v['term'];
69 69
         return $result;
70 70
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     }
111 111
 
112 112
     public function canInstall() {
113
-        if(!$this->getTable())
113
+        if (!$this->getTable())
114 114
             return 'Missing "table" property';
115 115
         return true;
116 116
     }
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
     public function getTaxonomyTerm($name, $create = true)
119 119
     {
120 120
         $term = TaxonomyTerms::findOne(['term'=>$name, 'taxonomy_id' => $this->id]);
121
-        if($create and !isset($term))
121
+        if ($create and !isset($term))
122 122
         {
123 123
             $term = new TaxonomyTerms();
124 124
             $term->taxonomy_id = $this->id;
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 
132 132
     public function getRefTableName()
133 133
     {
134
-        if(strpos($this->refTable, '\\') === FALSE) //not an AR class but a table name
134
+        if (strpos($this->refTable, '\\') === FALSE) //not an AR class but a table name
135 135
             return $this->refTable;
136 136
         else
137 137
             return call_user_func([$this->refTable, 'tableName']);
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
         if (!preg_match('/^\w+$/', $this->name)) {
153 153
             throw new Exception('The migration name should contain letters, digits and/or underscore characters only.');
154 154
         }
155
-        $name = 'm' . gmdate('ymd_His') . '_' . $this->name;
155
+        $name = 'm'.gmdate('ymd_His').'_'.$this->name;
156 156
         return $name;
157 157
     }
158 158
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
     {
161 161
 
162 162
         $name = $this->getMigrationFile();
163
-        $file = Yii::getAlias($this->migrationPath . DIRECTORY_SEPARATOR . $name . '.php');
163
+        $file = Yii::getAlias($this->migrationPath.DIRECTORY_SEPARATOR.$name.'.php');
164 164
 
165 165
         //$data = get_object_vars($this);
166 166
         $data = [];
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
         $data['migration'] = $name;
172 172
 
173 173
         $this->migration = $name;
174
-        $content = Yii::$app->getView()->renderFile(Yii::getAlias($this->templateFile), [ 'data' => $data ]);
174
+        $content = Yii::$app->getView()->renderFile(Yii::getAlias($this->templateFile), ['data' => $data]);
175 175
         file_put_contents($file, $content);
176 176
         return $name;
177 177
     }
Please login to merge, or discard this patch.