| Conditions | 3 | 
| Paths | 2 | 
| Total Lines | 71 | 
| Code Lines | 57 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 170 | public function search($params)  | 
            ||
| 171 |     { | 
            ||
| 172 | $query = $this->query;  | 
            ||
| 173 | $dataProvider = new ActiveDataProvider([  | 
            ||
| 174 | 'query' => $query,  | 
            ||
| 175 | 'pagination' => [  | 
            ||
| 176 | 'pageParam' => 'member-page',  | 
            ||
| 177 | 'defaultPageSize' => 20,  | 
            ||
| 178 | 'pageSizeParam' => 'member-per-page',  | 
            ||
| 179 | ],  | 
            ||
| 180 | 'sort' => [  | 
            ||
| 181 | 'sortParam' => 'member-sort',  | 
            ||
| 182 | 'attributes' => [  | 
            ||
| 183 | 'id' => [  | 
            ||
| 184 | 'asc' => [$this->memberUserAlias . '.id' => SORT_ASC],  | 
            ||
| 185 | 'desc' => [$this->memberUserAlias . '.id' => SORT_DESC],  | 
            ||
| 186 | 'default' => SORT_ASC,  | 
            ||
| 187 |                         'label' => Yii::t('user', 'User ID'), | 
            ||
| 188 | ],  | 
            ||
| 189 | 'name' => [  | 
            ||
| 190 | 'asc' => [$this->profileAlias . '.first_name' => SORT_ASC, $this->profileAlias . '.last_name' => SORT_ASC],  | 
            ||
| 191 | 'desc' => [$this->profileAlias . '.first_name' => SORT_DESC, $this->profileAlias . '.last_name' => SORT_DESC],  | 
            ||
| 192 | 'default' => SORT_DESC,  | 
            ||
| 193 |                         'label' => Yii::t('user', 'Name'), | 
            ||
| 194 | ],  | 
            ||
| 195 | 'position',  | 
            ||
| 196 | 'role',  | 
            ||
| 197 | 'created_at' => [  | 
            ||
| 198 | 'asc' => [$this->memberAlias . '.created_at' => SORT_ASC],  | 
            ||
| 199 | 'desc' => [$this->memberAlias . '.created_at' => SORT_DESC],  | 
            ||
| 200 | 'default' => SORT_ASC,  | 
            ||
| 201 |                         'label' => Yii::t('user', 'Creation Time'), | 
            ||
| 202 | ],  | 
            ||
| 203 | 'updated_at' => [  | 
            ||
| 204 | 'asc' => [$this->memberAlias . '.updated_at' => SORT_ASC],  | 
            ||
| 205 | 'desc' => [$this->memberAlias . '.updated_at' => SORT_DESC],  | 
            ||
| 206 | 'default' => SORT_ASC,  | 
            ||
| 207 |                         'label' => Yii::t('user', 'Last Updated Time'), | 
            ||
| 208 | ],  | 
            ||
| 209 | ],  | 
            ||
| 210 | ],  | 
            ||
| 211 | ]);  | 
            ||
| 212 | |||
| 213 |         if (!($this->load($params) && $this->validate())) { | 
            ||
| 214 | return $dataProvider;  | 
            ||
| 215 | }  | 
            ||
| 216 | |||
| 217 | $query = $query->andFilterWhere([  | 
            ||
| 218 | 'LIKE', $this->memberUserAlias . '.id', $this->id,  | 
            ||
| 219 | ])->andFilterWhere([  | 
            ||
| 220 | 'LIKE', $this->profileAlias . '.nickname', $this->nickname,  | 
            ||
| 221 | ])->andFilterWhere([  | 
            ||
| 222 | 'LIKE', $this->profileAlias . '.first_name', $this->first_name,  | 
            ||
| 223 | ])->andFilterWhere([  | 
            ||
| 224 | 'LIKE', $this->profileAlias . '.last_name', $this->last_name,  | 
            ||
| 225 | ])->andFilterWhere([  | 
            ||
| 226 | $this->profileAlias . '.gender' => $this->gender,  | 
            ||
| 227 | ])->andFilterWhere([  | 
            ||
| 228 | 'LIKE', $this->memberAlias . '.position', $this->position,  | 
            ||
| 229 | ])->andFilterWhere([  | 
            ||
| 230 | 'LIKE', $this->memberAlias . '.description', $this->description,  | 
            ||
| 231 | ])->andFilterWhere([  | 
            ||
| 232 | $this->memberAlias . '.role' => $this->roleInDb,  | 
            ||
| 233 | ])->andFilterWhere([  | 
            ||
| 234 | '>=', $this->memberAlias . '.created_at', $this->createdFromInUtc,  | 
            ||
| 235 | ])->andFilterWhere([  | 
            ||
| 236 | '<=', $this->memberAlias . '.created_at', $this->createdToInUtc,  | 
            ||
| 237 | ]);  | 
            ||
| 238 | $dataProvider->query = $query;  | 
            ||
| 239 | return $dataProvider;  | 
            ||
| 240 | }  | 
            ||
| 241 | |||
| 261 | 
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.