Conditions | 10 |
Paths | 4 |
Total Lines | 24 |
Code Lines | 14 |
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 |
||
38 | $parser->match($shouldUseLexer ? Lexer::T_DISTINCT : TokenType::T_DISTINCT); |
||
39 | $this->isDistinct = true; |
||
40 | } |
||
41 | |||
42 | $this->expression = $parser->StringPrimary(); |
||
43 | |||
44 | $parser->match($shouldUseLexer ? Lexer::T_COMMA : TokenType::T_COMMA); |
||
45 | |||
46 | $this->delimiter = $parser->StringPrimary(); |
||
47 | } |
||
48 | |||
49 | public function getSql(SqlWalker $sqlWalker): string |
||
50 | { |
||
51 | $dispatched = [ |
||
52 | $this->isDistinct ? 'distinct ' : '', |
||
53 | $this->expression->dispatch($sqlWalker), |
||
54 | $this->delimiter->dispatch($sqlWalker), |
||
55 | $this->getOptionalOrderByClause($sqlWalker), |
||
56 | ]; |
||
57 | |||
58 | return \vsprintf($this->functionPrototype, $dispatched); |
||
59 | } |
||
60 | } |
||
61 |