Completed
Push — master ( 65f66e...428edc )
by Michal
04:14
created

MaintenanceStatement   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 36
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A after() 0 17 1
1
<?php
2
3
/**
4
 * Maintenance statement.
5
 */
6
7
namespace PhpMyAdmin\SqlParser\Statements;
8
9
use PhpMyAdmin\SqlParser\Parser;
10
use PhpMyAdmin\SqlParser\Statement;
11
use PhpMyAdmin\SqlParser\Token;
12
use PhpMyAdmin\SqlParser\TokensList;
13
use PhpMyAdmin\SqlParser\Components\Expression;
14
use PhpMyAdmin\SqlParser\Components\OptionsArray;
15
16
/**
17
 * Maintenance statement.
18
 *
19
 * They follow the syntax:
20
 *     STMT [some options] tbl_name [, tbl_name] ... [some more options]
21
 *
22
 * @category   Statements
23
 *
24
 * @license    https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+
25
 */
26
class MaintenanceStatement extends Statement
27
{
28
    /**
29
     * Tables maintained.
30
     *
31
     * @var Expression[]
32
     */
33
    public $tables;
34
35
    /**
36
     * Function called after the token was processed.
37
     *
38
     * Parses the additional options from the end.
39
     *
40
     * @param Parser     $parser the instance that requests parsing
41
     * @param TokensList $list   the list of tokens to be parsed
42
     * @param Token      $token  the token that is being parsed
43
     */
44 4
    public function after(Parser $parser, TokensList $list, Token $token)
45
    {
46
        // [some options] is going to be parsed first.
47
        //
48
        // There is a parser specified in `Parser::$KEYWORD_PARSERS`
49
        // which parses the name of the tables.
50
        //
51
        // Finally, we parse here [some more options] and that's all.
52 4
        ++$list->idx;
53 4
        $this->options->merge(
54 4
            OptionsArray::parse(
55 4
                $parser,
56 4
                $list,
57
                static::$OPTIONS
58 4
            )
59 4
        );
60 4
    }
61
}
62