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