| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 51 | 
| Code Lines | 36 | 
| 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 | ||
| 60 | public function getFilters() | ||
| 61 |     { | ||
| 62 | return array( | ||
| 63 | array(ChoiceType::TYPE_EQUAL, array( | ||
| 64 | 'where.constraint.operand_dynamic' => array( | ||
| 65 | 'getAlias' => 'a', | ||
| 66 | 'getField' => 'somefield', | ||
| 67 | ), | ||
| 68 | 'where.constraint.operand_static' => array( | ||
| 69 | 'getValue' => 'somevalue', | ||
| 70 | ), | ||
| 71 | )), | ||
| 72 | array(ChoiceType::TYPE_NOT_CONTAINS, array( | ||
| 73 | 'where.constraint' => array( | ||
| 74 | 'getField' => 'somefield', | ||
| 75 | 'getFullTextSearchExpression' => '* -somevalue', ), | ||
| 76 | )), | ||
| 77 | array(ChoiceType::TYPE_CONTAINS, array( | ||
| 78 | 'where.constraint.operand_dynamic' => array( | ||
| 79 | 'getAlias' => 'a', | ||
| 80 | 'getField' => 'somefield', | ||
| 81 | ), | ||
| 82 | 'where.constraint.operand_static' => array( | ||
| 83 | 'getValue' => '%somevalue%', | ||
| 84 | ), | ||
| 85 | )), | ||
| 86 | array(ChoiceType::TYPE_CONTAINS_WORDS, array( | ||
| 87 | 'where.constraint' => array( | ||
| 88 | 'getField' => 'somefield', | ||
| 89 | 'getFullTextSearchExpression' => 'somevalue', ), | ||
| 90 | )), | ||
| 91 | 'equalCaseInsensitiveComparision' => array(ChoiceType::TYPE_EQUAL, array( | ||
| 92 | 'where.constraint.operand_dynamic.operand_dynamic' => array( | ||
| 93 | 'getAlias' => 'a', | ||
| 94 | 'getField' => 'somefield', | ||
| 95 | ), | ||
| 96 | 'where.constraint.operand_static' => array( | ||
| 97 | 'getValue' => 'somevalue', | ||
| 98 | ), | ||
| 99 | ), true), | ||
| 100 | 'containsCaseInsensitiveComparision' => array(ChoiceType::TYPE_CONTAINS, array( | ||
| 101 | 'where.constraint.operand_dynamic.operand_dynamic' => array( | ||
| 102 | 'getAlias' => 'a', | ||
| 103 | 'getField' => 'somefield', | ||
| 104 | ), | ||
| 105 | 'where.constraint.operand_static' => array( | ||
| 106 | 'getValue' => '%somevalue%', | ||
| 107 | ), | ||
| 108 | ), true), | ||
| 109 | ); | ||
| 110 | } | ||
| 111 | |||
| 139 | 
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.