Conditions | 10 |
Paths | 4 |
Total Lines | 24 |
Code Lines | 14 |
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 |
||
37 | public function parse(Parser $parser): void |
||
38 | { |
||
39 | $ormV2 = !\class_exists(TokenType::class); |
||
40 | |||
41 | $this->customiseFunction(); |
||
42 | |||
43 | $parser->match($ormV2 ? Lexer::T_IDENTIFIER : TokenType::T_IDENTIFIER); |
||
|
|||
44 | $parser->match($ormV2 ? Lexer::T_OPEN_PARENTHESIS : TokenType::T_OPEN_PARENTHESIS); |
||
45 | |||
46 | $lexer = $parser->getLexer(); |
||
47 | if ($lexer->isNextToken($ormV2 ? Lexer::T_DISTINCT : TokenType::T_DISTINCT)) { |
||
48 | $parser->match($ormV2 ? Lexer::T_DISTINCT : TokenType::T_DISTINCT); |
||
49 | $this->isDistinct = true; |
||
50 | } |
||
51 | |||
52 | $this->expression = $parser->StringPrimary(); |
||
53 | $parser->match($ormV2 ? Lexer::T_COMMA : TokenType::T_COMMA); |
||
54 | $this->delimiter = $parser->StringPrimary(); |
||
55 | |||
56 | if ($lexer->isNextToken($ormV2 ? Lexer::T_ORDER : TokenType::T_ORDER)) { |
||
57 | $this->orderByClause = $parser->OrderByClause(); |
||
58 | } |
||
59 | |||
60 | $parser->match($ormV2 ? Lexer::T_CLOSE_PARENTHESIS : TokenType::T_CLOSE_PARENTHESIS); |
||
61 | } |
||
75 |