| Conditions | 2 |
| Paths | 2 |
| Total Lines | 53 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| 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 |
||
| 48 | public function getSyntax( $replacement = self::REPLACEMENT_NONE ) |
||
| 49 | { |
||
| 50 | |||
| 51 | $syntax = array(); |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Explain |
||
| 55 | */ |
||
| 56 | $syntax[] = $this->getExplainSyntax(); |
||
| 57 | |||
| 58 | /** |
||
| 59 | * UPDATE statement |
||
| 60 | */ |
||
| 61 | $syntax[] = $this->statement; |
||
| 62 | |||
| 63 | /** |
||
| 64 | * PRIORITY |
||
| 65 | */ |
||
| 66 | $syntax[] = $this->queryStructure->getElement( QueryStructure::PRIORITY ); |
||
| 67 | |||
| 68 | /** |
||
| 69 | * IGNORE clause |
||
| 70 | */ |
||
| 71 | $syntax[] = $this->queryStructure->getElement( QueryStructure::IGNORE ) ? 'IGNORE' : ''; |
||
| 72 | |||
| 73 | /** |
||
| 74 | * TABLE update |
||
| 75 | */ |
||
| 76 | $syntax[] = $this->queryStructure->getElement( QueryStructure::TABLE ); |
||
| 77 | |||
| 78 | /** |
||
| 79 | * FIELDS update |
||
| 80 | */ |
||
| 81 | $syntax[] = $this->getSettingFieldsSyntax(); |
||
| 82 | |||
| 83 | /** |
||
| 84 | * WHERE clause |
||
| 85 | */ |
||
| 86 | $syntax[] = $this->getWhereSyntax(); |
||
| 87 | |||
| 88 | /** |
||
| 89 | * ORDER BY clause |
||
| 90 | */ |
||
| 91 | $syntax[] = $this->getOrderBySyntax(); |
||
| 92 | |||
| 93 | /** |
||
| 94 | * LIMIT clause |
||
| 95 | */ |
||
| 96 | $syntax[] = $this->getLimitSyntax(); |
||
| 97 | |||
| 98 | $syntax = implode( ' ', $syntax ); |
||
| 99 | |||
| 100 | return $this->getSyntaxReplace( $syntax, $replacement ); |
||
| 101 | |||
| 115 | } |