| Conditions | 15 | 
| Paths | 80 | 
| Total Lines | 39 | 
| Code Lines | 24 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 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  | 
            ||
| 114 | protected function buildQuery()  | 
            ||
| 115 |     { | 
            ||
| 116 | $query = [];  | 
            ||
| 117 |         if (!empty($this->query)) { | 
            ||
| 118 | $query = $this->query;  | 
            ||
| 119 | }  | 
            ||
| 120 |         if ($this->limit || $this->offset) { | 
            ||
| 121 | $query['page'] = [];  | 
            ||
| 122 |             if ($this->limit) { | 
            ||
| 123 | $query['page']['limit'] = $this->limit;  | 
            ||
| 124 | }  | 
            ||
| 125 |             if ($this->offset) { | 
            ||
| 126 | $query['page']['offset'] = $this->offset;  | 
            ||
| 127 | }  | 
            ||
| 128 | }  | 
            ||
| 129 | |||
| 130 |         if (!empty($this->filters)) { | 
            ||
| 131 |             foreach ($this->filters as $resource => $columns) { | 
            ||
| 132 |                 if (is_array($columns)) { | 
            ||
| 133 |                     foreach ($columns as $column => $operands) { | 
            ||
| 134 |                         foreach ($operands as $operand => $value) { | 
            ||
| 135 |                             $query['filter'][$resource][$column][$operand] = is_array($value) ? implode(',', | 
            ||
| 136 | $value) : $value;  | 
            ||
| 137 | }  | 
            ||
| 138 | }  | 
            ||
| 139 |                 } else{ | 
            ||
| 140 | $query['filter'][$resource] = $columns;  | 
            ||
| 141 | }  | 
            ||
| 142 | }  | 
            ||
| 143 | }  | 
            ||
| 144 |         if (!empty($this->fields)) { | 
            ||
| 145 |             foreach ($this->fields as $resource => $fieldList) { | 
            ||
| 146 |                 $query['fields'][$resource] = implode(',', $fieldList); | 
            ||
| 147 | }  | 
            ||
| 148 | }  | 
            ||
| 149 |         if (!empty($this->includes)) { | 
            ||
| 150 |             $query['include'] = implode(',', $this->includes); | 
            ||
| 151 | }  | 
            ||
| 152 | return $query;  | 
            ||
| 153 | }  | 
            ||
| 242 |