1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Lagdo\DbAdmin\Driver; |
4
|
|
|
|
5
|
|
|
use Lagdo\DbAdmin\Driver\Entity\ConfigEntity; |
6
|
|
|
|
7
|
|
|
trait ConfigTrait |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var ConfigEntity |
11
|
|
|
*/ |
12
|
|
|
protected $config; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Get the server jush |
16
|
|
|
* |
17
|
|
|
* @return string |
18
|
|
|
*/ |
19
|
|
|
public function jush() |
20
|
|
|
{ |
21
|
|
|
return $this->config->jush; |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Get the Adminer version |
26
|
|
|
* |
27
|
|
|
* @return string |
28
|
|
|
*/ |
29
|
|
|
public function version() |
30
|
|
|
{ |
31
|
|
|
return $this->config->version; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @return array |
36
|
|
|
*/ |
37
|
|
|
public function unsigned() |
38
|
|
|
{ |
39
|
|
|
return $this->config->unsigned; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return array |
44
|
|
|
*/ |
45
|
|
|
public function functions() |
46
|
|
|
{ |
47
|
|
|
return $this->config->functions; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @return array |
52
|
|
|
*/ |
53
|
|
|
public function grouping() |
54
|
|
|
{ |
55
|
|
|
return $this->config->grouping; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return array |
60
|
|
|
*/ |
61
|
|
|
public function operators() |
62
|
|
|
{ |
63
|
|
|
return $this->config->operators; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @return array |
68
|
|
|
*/ |
69
|
|
|
public function editFunctions() |
70
|
|
|
{ |
71
|
|
|
return $this->config->editFunctions; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return array |
76
|
|
|
*/ |
77
|
|
|
public function types() |
78
|
|
|
{ |
79
|
|
|
return $this->config->types; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param string $type |
84
|
|
|
* |
85
|
|
|
* @return bool |
86
|
|
|
*/ |
87
|
|
|
public function typeExists(string $type) |
88
|
|
|
{ |
89
|
|
|
return isset($this->config->types[$type]); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param string $type |
94
|
|
|
* |
95
|
|
|
* @return mixed |
96
|
|
|
*/ |
97
|
|
|
public function type(string $type) |
98
|
|
|
{ |
99
|
|
|
return $this->config->types[$type]; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return array |
104
|
|
|
*/ |
105
|
|
|
public function structuredTypes() |
106
|
|
|
{ |
107
|
|
|
return $this->config->structuredTypes; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param string $key |
112
|
|
|
* @param mixed $value |
113
|
|
|
* |
114
|
|
|
* @return void |
115
|
|
|
*/ |
116
|
|
|
public function setStructuredType(string $key, $value) |
117
|
|
|
{ |
118
|
|
|
$this->config->structuredTypes[$key] = $value; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Get the driver options |
123
|
|
|
* |
124
|
|
|
* @param string $name The option name |
125
|
|
|
* @param mixed $default |
126
|
|
|
* |
127
|
|
|
* @return mixed |
128
|
|
|
*/ |
129
|
|
|
public function options(string $name = '', $default = '') |
130
|
|
|
{ |
131
|
|
|
return $this->config->options($name, $default); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* Get the selected database |
136
|
|
|
* |
137
|
|
|
* @return string |
138
|
|
|
*/ |
139
|
|
|
public function database() |
140
|
|
|
{ |
141
|
|
|
return $this->config->database; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* Get the selected schema |
146
|
|
|
* |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
|
|
public function schema() |
150
|
|
|
{ |
151
|
|
|
return $this->config->schema; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Get regular expression to match numeric types |
156
|
|
|
* |
157
|
|
|
* @return string |
158
|
|
|
*/ |
159
|
|
|
public function numberRegex() |
160
|
|
|
{ |
161
|
|
|
return $this->config->numberRegex; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return string |
166
|
|
|
*/ |
167
|
|
|
public function inout() |
168
|
|
|
{ |
169
|
|
|
return $this->config->inout; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* @return string |
174
|
|
|
*/ |
175
|
|
|
public function enumLength() |
176
|
|
|
{ |
177
|
|
|
return $this->config->enumLength; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* @return string |
182
|
|
|
*/ |
183
|
|
|
public function actions() |
184
|
|
|
{ |
185
|
|
|
return $this->config->actions; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* @return array |
190
|
|
|
*/ |
191
|
|
|
public function onActions() |
192
|
|
|
{ |
193
|
|
|
return $this->config->onActions(); |
194
|
|
|
} |
195
|
|
|
} |
196
|
|
|
|