| Conditions | 13 | 
| Paths | 13 | 
| Total Lines | 27 | 
| Code Lines | 20 | 
| 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  | 
            ||
| 86 | protected function getSearchQueryWriter(SearchCriterion $searchCriterion)  | 
            ||
| 87 |     { | 
            ||
| 88 |         if ($searchCriterion->getSearchQueryWriter() instanceof AbstractSearchQueryWriter) { | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 89 | // The user has defined their own SearchQueryWriter, so we should just return it.  | 
            ||
| 90 | return $searchCriterion->getSearchQueryWriter();  | 
            ||
| 91 | }  | 
            ||
| 92 | |||
| 93 |         switch ($searchCriterion->getComparison()) { | 
            ||
| 94 | case SearchCriterion::EQUAL:  | 
            ||
| 95 | case SearchCriterion::NOT_EQUAL:  | 
            ||
| 96 | return SolrSearchQueryWriterBasic::create();  | 
            ||
| 97 | case SearchCriterion::IN:  | 
            ||
| 98 | case SearchCriterion::NOT_IN:  | 
            ||
| 99 | return SolrSearchQueryWriterIn::create();  | 
            ||
| 100 | case SearchCriterion::GREATER_EQUAL:  | 
            ||
| 101 | case SearchCriterion::GREATER_THAN:  | 
            ||
| 102 | case SearchCriterion::LESS_EQUAL:  | 
            ||
| 103 | case SearchCriterion::LESS_THAN:  | 
            ||
| 104 | case SearchCriterion::ISNULL:  | 
            ||
| 105 | case SearchCriterion::ISNOTNULL:  | 
            ||
| 106 | return SolrSearchQueryWriterRange::create();  | 
            ||
| 107 | case SearchCriterion::CUSTOM:  | 
            ||
| 108 | // CUSTOM requires a SearchQueryWriter be provided. One can't have been provided, or it would have been  | 
            ||
| 109 | // picked up at the top of the method.  | 
            ||
| 110 |                 throw new InvalidArgumentException('SearchQueryWriter undefined or unsupported in SearchCriterion'); | 
            ||
| 111 | default:  | 
            ||
| 112 |                 throw new InvalidArgumentException('Unsupported comparison type in SolrSearchAdapter'); | 
            ||
| 113 | }  | 
            ||
| 116 |