Completed
Push — master ( 578d3a...04a929 )
by Maurício
34s queued 14s
created

RenameOperation::parse()   C

Complexity

Conditions 17
Paths 16

Size

Total Lines 96
Code Lines 44

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 51
CRAP Score 17

Importance

Changes 0
Metric Value
cc 17
eloc 44
c 0
b 0
f 0
nc 16
nop 3
dl 0
loc 96
ccs 51
cts 51
cp 1
crap 17
rs 5.2166

How to fix   Long Method    Complexity   

Long Method

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:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpMyAdmin\SqlParser\Components;
6
7
use PhpMyAdmin\SqlParser\Component;
8
9
/**
10
 * `RENAME TABLE` keyword parser.
11
 */
12
final class RenameOperation implements Component
13
{
14
    /**
15
     * The old table name.
16
     *
17
     * @var Expression
18
     */
19
    public $old;
20
21
    /**
22
     * The new table name.
23
     *
24
     * @var Expression
25
     */
26
    public $new;
27
28
    /**
29
     * @param Expression $old old expression
30
     * @param Expression $new new expression containing new name
31
     */
32 18
    public function __construct(Expression|null $old = null, Expression|null $new = null)
33
    {
34 18
        $this->old = $old;
35 18
        $this->new = $new;
36
    }
37
38 4
    public function build(): string
39
    {
40 4
        return $this->old . ' TO ' . $this->new;
41
    }
42
43 4
    public function __toString(): string
44
    {
45 4
        return $this->build();
46
    }
47
}
48