Passed
Push — master ( 4e8d12...2d631b )
by Ron
02:08
created

Select::__toString()   A

Complexity

Conditions 4
Paths 8

Size

Total Lines 24
Code Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 24
c 0
b 0
f 0
rs 9.6
cc 4
nc 8
nop 0
1
<?php
2
3
namespace Kir\MySQL\Builder;
4
5
use Kir\MySQL\Builder;
6
use Kir\MySQL\Builder\Expr\OptionalExpression;
7
use Kir\MySQL\Builder\Expr\OrderBySpecification;
8
use Kir\MySQL\Tools\VirtualTable;
9
10
/**
11
 */
12
interface Select {
13
	/**
14
	 * @param bool $preserveTypes
15
	 * @return $this
16
	 */
17
	public function setPreserveTypes(bool $preserveTypes = true);
18
19
	/**
20
	 * @param bool $enabled
21
	 * @return $this
22
	 */
23
	public function forUpdate(bool $enabled = true);
24
25
	/**
26
	 * @param bool $distinct
27
	 * @return $this
28
	 */
29
	public function distinct(bool $distinct = true);
30
31
	/**
32
	 * @return array<int|string, string>
33
	 */
34
	public function getFields(): array;
35
36
	/**
37
	 * @param string|Select $expression
38
	 * @param string|null $alias
39
	 * @return $this
40
	 */
41
	public function field($expression, $alias = null);
42
43
	/**
44
	 * @param array<string, string>|array<int, string> $fields
45
	 * @return $this
46
	 */
47
	public function fields(array $fields);
48
49
	/**
50
	 * @param null|string $alias
51
	 * @param null|string|Select|VirtualTable|array<int, null|int|float|string|array<string, mixed>> $table
52
	 * @return $this
53
	 */
54
	public function from(?string $alias, $table = null);
55
56
	/**
57
	 * @param string $alias
58
	 * @param string|array<int, array<string, mixed>>|Select|VirtualTable $table
59
	 * @param string|null $expression
60
	 * @param null|int|float|string|array<int, string>|Builder\DBExpr|Select ...$args
61
	 * @return $this
62
	 */
63
	public function joinInner(string $alias, $table, ?string $expression = null, ...$args);
64
65
	/**
66
	 * @param string $alias
67
	 * @param string|array<int, array<string, mixed>>|Select|VirtualTable $table
68
	 * @param string $expression
69
	 * @param string|int|float|array<int, string>|Builder\DBExpr|Select ...$args
70
	 * @return $this
71
	 */
72
	public function joinLeft(string $alias, $table, string $expression, ...$args);
73
74
	/**
75
	 * @param string $alias
76
	 * @param string|array<int, array<string, mixed>>|Select|VirtualTable $table
77
	 * @param string $expression
78
	 * @param string|int|float|array<int, string>|Builder\DBExpr|Select ...$args
79
	 * @return $this
80
	 */
81
	public function joinRight(string $alias, $table, string $expression, ...$args);
82
83
	/**
84
	 * @param string|Select ...$queries
85
	 * @return $this
86
	 */
87
	public function union(...$queries);
88
89
	/**
90
	 * @param string|Select ...$queries
91
	 * @return $this
92
	 */
93
	public function unionAll(...$queries);
94
95
	/**
96
	 * @param string|array<string, mixed>|object|OptionalExpression $expression
97
	 * @param null|scalar|array<int, string>|DBExpr|Select ...$args
98
	 * @return $this
99
	 */
100
	public function where($expression, ...$args);
101
102
	/**
103
	 * @param string|array<string, mixed>|object|OptionalExpression $expression
104
	 * @param null|scalar|array<int, string>|DBExpr|Select ...$args
105
	 * @return $this
106
	 */
107
	public function having($expression, ...$args);
108
109
	/**
110
	 * @param mixed ...$args
111
	 * @return $this
112
	 */
113
	public function groupBy(...$args);
114
115
	/**
116
	 * @param string|OrderBySpecification $expression
117
	 * @param string&('ASC'|'DESC') $direction
0 ignored issues
show
Documentation Bug introduced by
The doc comment string&('ASC'|'DESC') at position 3 could not be parsed: Unknown type name ''ASC'' at position 3 in string&('ASC'|'DESC').
Loading history...
118
	 * @return $this
119
	 */
120
	public function orderBy($expression, string $direction = 'ASC');
121
122
	/**
123
	 * @param string $fieldName
124
	 * @param array<int, int|float|string> $values
125
	 * @return $this
126
	 */
127
	public function orderByValues(string $fieldName, array $values);
128
129
	/**
130
	 * @param int|null $limit
131
	 * @return $this
132
	 */
133
	public function limit(?int $limit);
134
135
	/**
136
	 * @param int|null $offset
137
	 * @return $this
138
	 */
139
	public function offset(?int $offset = 0);
140
141
	/**
142
	 * @return bool
143
	 */
144
	public function getCalcFoundRows(): bool;
145
146
	/**
147
	 * @param bool $calcFoundRows
148
	 * @return $this
149
	 */
150
	public function setCalcFoundRows($calcFoundRows = true);
151
152
	/**
153
	 * @return string
154
	 */
155
	public function __toString(): string;
156
}
157