forked from phpmyadmin/sql-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnionKeyword.php
More file actions
53 lines (45 loc) · 1.36 KB
/
UnionKeyword.php
File metadata and controls
53 lines (45 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
declare(strict_types=1);
namespace PhpMyAdmin\SqlParser\Components;
use PhpMyAdmin\SqlParser\Component;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\TokensList;
use PhpMyAdmin\SqlParser\Translator;
use RuntimeException;
use function implode;
/**
* `UNION` keyword builder.
*/
final class UnionKeyword implements Component
{
/**
* Parses the tokens contained in the given list in the context of the given parser.
*
* @param Parser $parser the parser that serves as context
* @param TokensList $list the list of tokens that are being parsed
* @param array<string, mixed> $options parameters for parsing
*
* @return mixed
*
* @throws RuntimeException not implemented yet.
*/
public static function parse(Parser $parser, TokensList $list, array $options = [])
{
throw new RuntimeException(Translator::gettext('Not implemented yet.'));
}
/**
* @param array<UnionKeyword[]> $component the component to be built
*/
public static function build($component): string
{
$tmp = [];
foreach ($component as $componentPart) {
$tmp[] = $componentPart[0] . ' ' . $componentPart[1];
}
return implode(' ', $tmp);
}
public function __toString(): string
{
return static::build($this);
}
}