| Conditions | 2 |
| Paths | 1 |
| Total Lines | 55 |
| 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 |
||
| 23 | public function handle( |
||
| 24 | CriteriaConverter $converter, |
||
| 25 | SelectQuery $query, |
||
| 26 | Criterion $criterion, |
||
| 27 | array $languageSettings |
||
| 28 | ) { |
||
| 29 | $matchStateIdentifier = $query->expr->in( |
||
| 30 | $this->dbHandler->quoteColumn('identifier', 't2'), |
||
| 31 | $criterion->value |
||
| 32 | ); |
||
| 33 | |||
| 34 | $subSelect = $query->subSelect(); |
||
| 35 | $subSelect |
||
| 36 | ->select( |
||
| 37 | $this->dbHandler->quoteColumn('contentobject_id', 't1') |
||
| 38 | )->from( |
||
| 39 | $query->alias( |
||
| 40 | $this->dbHandler->quoteTable('ezcobj_state_link'), |
||
| 41 | 't1' |
||
| 42 | ) |
||
| 43 | )->leftJoin( |
||
| 44 | $query->alias( |
||
| 45 | $this->dbHandler->quoteTable('ezcobj_state'), |
||
| 46 | 't2' |
||
| 47 | ), |
||
| 48 | $query->expr->eq( |
||
| 49 | $this->dbHandler->quoteColumn('contentobject_state_id', 't1'), |
||
| 50 | $this->dbHandler->quoteColumn('id', 't2') |
||
| 51 | ) |
||
| 52 | )->leftJoin( |
||
| 53 | $query->alias( |
||
| 54 | $this->dbHandler->quoteTable('ezcobj_state_group'), |
||
| 55 | 't3' |
||
| 56 | ), |
||
| 57 | $query->expr->eq( |
||
| 58 | $this->dbHandler->quoteColumn('group_id', 't2'), |
||
| 59 | $this->dbHandler->quoteColumn('id', 't3') |
||
| 60 | ) |
||
| 61 | )->where( |
||
| 62 | null !== $criterion->target |
||
| 63 | ? $query->expr->lAnd( |
||
| 64 | $query->expr->in( |
||
| 65 | $this->dbHandler->quoteColumn('identifier', 't3'), |
||
| 66 | $criterion->target |
||
| 67 | ), |
||
| 68 | $matchStateIdentifier |
||
| 69 | ) |
||
| 70 | : $matchStateIdentifier |
||
| 71 | ); |
||
| 72 | |||
| 73 | return $query->expr->in( |
||
| 74 | $this->dbHandler->quoteColumn('id', 'ezcontentobject'), |
||
| 75 | $subSelect |
||
| 76 | ); |
||
| 77 | } |
||
| 78 | } |
||
| 79 |