| Conditions | 15 | 
| Paths | 240 | 
| Total Lines | 60 | 
| 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  | 
            ||
| 115 | public function buildModelCriteria()  | 
            ||
| 116 |     { | 
            ||
| 117 | $query = DealerShedulesQuery::create();  | 
            ||
| 118 | |||
| 119 |         if ($id = $this->getId()) { | 
            ||
| 120 | $query->filterById($id);  | 
            ||
| 121 | }  | 
            ||
| 122 | |||
| 123 |         if ($day = $this->getDay()) { | 
            ||
| 124 | $query->filterByDay($day);  | 
            ||
| 125 | }  | 
            ||
| 126 | |||
| 127 |         if ($dealer_id = $this->getDealerId()) { | 
            ||
| 128 | $query->filterByDealerId($dealer_id);  | 
            ||
| 129 | }  | 
            ||
| 130 | |||
| 131 |         if ($this->getDefaultPeriod()) { | 
            ||
| 132 | $query->filterByPeriodNull();  | 
            ||
| 133 |         } else { | 
            ||
| 134 | $query->filterByPeriodNotNull();  | 
            ||
| 135 |             if ($this->getHidePast()) { | 
            ||
| 136 | $query->filterByPeriodEnd(new \DateTime(), Criteria::GREATER_THAN);  | 
            ||
| 137 | }  | 
            ||
| 138 | }  | 
            ||
| 139 | |||
| 140 | $query->filterByClosed($this->getClosed());  | 
            ||
| 141 | |||
| 142 |         foreach ($this->getOrder() as $order) { | 
            ||
| 143 |             switch ($order) { | 
            ||
| 144 | case 'id':  | 
            ||
| 145 | $query->orderById();  | 
            ||
| 146 | break;  | 
            ||
| 147 | case 'id-reverse':  | 
            ||
| 148 | $query->orderById(Criteria::DESC);  | 
            ||
| 149 | break;  | 
            ||
| 150 | case 'day':  | 
            ||
| 151 | $query->orderByDay();  | 
            ||
| 152 | break;  | 
            ||
| 153 | case 'day-reverse':  | 
            ||
| 154 | $query->orderByDay(Criteria::DESC);  | 
            ||
| 155 | break;  | 
            ||
| 156 | case 'begin':  | 
            ||
| 157 | $query->orderByBegin();  | 
            ||
| 158 | break;  | 
            ||
| 159 | case 'begin-reverse':  | 
            ||
| 160 | $query->orderByBegin(Criteria::DESC);  | 
            ||
| 161 | break;  | 
            ||
| 162 | case 'period-begin':  | 
            ||
| 163 | $query->orderByPeriodBegin();  | 
            ||
| 164 | break;  | 
            ||
| 165 | case 'period-begin-reverse':  | 
            ||
| 166 | $query->orderByPeriodBegin(Criteria::DESC);  | 
            ||
| 167 | break;  | 
            ||
| 168 | default:  | 
            ||
| 169 | break;  | 
            ||
| 170 | }  | 
            ||
| 171 | }  | 
            ||
| 172 | |||
| 173 | return $query;  | 
            ||
| 174 | }  | 
            ||
| 175 | |||
| 189 |