Skip to content

Commit 1f88dff

Browse files
committed
code clean - empty lines
1 parent 18360a3 commit 1f88dff

23 files changed

+1034
-1035
lines changed

src/Connection.php

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
class Connection extends BaseConnection
1616
{
17-
17+
1818
protected $client;
1919
protected $index;
2020
protected $maxSize;
@@ -25,23 +25,23 @@ class Connection extends BaseConnection
2525
protected $portInHeaders = null;
2626
protected $rebuild = false;
2727
protected $allowIdSort = true;
28-
28+
2929
public function __construct(array $config)
3030
{
3131
$this->config = $config;
32-
32+
3333
$this->setOptions($config);
34-
34+
3535
$this->client = $this->buildConnection();
36-
36+
3737
$this->useDefaultPostProcessor();
38-
38+
3939
$this->useDefaultSchemaGrammar();
40-
40+
4141
$this->useDefaultQueryGrammar();
42-
42+
4343
}
44-
44+
4545
public function setOptions($config)
4646
{
4747
if (!empty($config['index_prefix'])) {
@@ -60,23 +60,23 @@ public function setOptions($config)
6060
$this->portInHeaders = $config['options']['port_in_host_header'];
6161
}
6262
}
63-
63+
6464
public function getIndexPrefix(): string|null
6565
{
6666
return $this->indexPrefix;
6767
}
68-
68+
6969
public function setIndexPrefix($newPrefix): void
7070
{
7171
$this->indexPrefix = $newPrefix;
7272
}
73-
74-
73+
74+
7575
public function getTablePrefix(): string|null
7676
{
7777
return $this->getIndexPrefix();
7878
}
79-
79+
8080
public function setIndex($index): string
8181
{
8282
$this->index = $index;
@@ -85,134 +85,134 @@ public function setIndex($index): string
8585
$this->index = $this->indexPrefix.'_'.$index;
8686
}
8787
}
88-
88+
8989
return $this->getIndex();
9090
}
91-
91+
9292
public function getSchemaGrammar()
9393
{
9494
return new Schema\Grammar($this);
9595
}
96-
96+
9797
public function getIndex(): string
9898
{
9999
return $this->index;
100100
}
101-
101+
102102
public function setMaxSize($value)
103103
{
104104
$this->maxSize = $value;
105105
}
106-
107-
106+
107+
108108
public function table($table, $as = null)
109109
{
110110
$query = new Query\Builder($this, new Query\Processor());
111-
111+
112112
return $query->from($table);
113113
}
114-
114+
115115
/**
116116
* @inheritdoc
117117
*/
118118
public function getSchemaBuilder()
119119
{
120120
return new Schema\Builder($this);
121121
}
122-
123-
122+
123+
124124
/**
125125
* @inheritdoc
126126
*/
127127
public function disconnect()
128128
{
129129
unset($this->connection);
130130
}
131-
132-
131+
132+
133133
/**
134134
* @inheritdoc
135135
*/
136136
public function getDriverName(): string
137137
{
138138
return 'opensearch';
139139
}
140-
140+
141141
/**
142142
* @inheritdoc
143143
*/
144144
protected function getDefaultPostProcessor()
145145
{
146146
return new Query\Processor();
147147
}
148-
148+
149149
/**
150150
* @inheritdoc
151151
*/
152152
protected function getDefaultQueryGrammar()
153153
{
154154
return new Query\Grammar();
155155
}
156-
156+
157157
/**
158158
* @inheritdoc
159159
*/
160160
protected function getDefaultSchemaGrammar()
161161
{
162162
return new Schema\Grammar();
163163
}
164-
164+
165165
public function rebuildConnection()
166166
{
167167
$this->rebuild = true;
168168
}
169-
169+
170170
public function getClient()
171171
{
172172
return $this->client;
173173
}
174-
174+
175175
public function getMaxSize()
176176
{
177177
return $this->maxSize;
178178
}
179-
179+
180180
public function getAllowIdSort()
181181
{
182182
return $this->allowIdSort;
183183
}
184-
185-
184+
185+
186186
//----------------------------------------------------------------------
187187
// Connection Builder
188188
//----------------------------------------------------------------------
189-
189+
190190
protected function buildConnection(): Client
191191
{
192192
$hosts = config('database.connections.opensearch.hosts') ?? null;
193-
193+
194194
$builder = ClientBuilder::create()->setHosts($hosts);
195195
$builder = $this->_buildOptions($builder);
196196
$builder = $this->_buildAuth($builder);
197197
$builder = $this->_buildSigV4($builder);
198198
$builder = $this->_buildSSL($builder);
199-
199+
200200
return $builder->build();
201-
201+
202202
}
203-
203+
204204
protected function _buildAuth(ClientBuilder $builder): ClientBuilder
205205
{
206-
206+
207207
$username = config('database.connections.opensearch.basic_auth.username') ?? null;
208208
$pass = config('database.connections.opensearch.basic_auth.password') ?? null;
209209
if ($username && $pass) {
210210
$builder->setBasicAuthentication($username, $pass);
211211
}
212-
212+
213213
return $builder;
214214
}
215-
215+
216216
protected function _buildSigV4(ClientBuilder $builder): ClientBuilder
217217
{
218218
$provider = config('database.connections.opensearch.sig_v4.provider') ?? null;
@@ -227,10 +227,10 @@ protected function _buildSigV4(ClientBuilder $builder): ClientBuilder
227227
if ($service) {
228228
$builder->setSigV4Service($service);
229229
}
230-
230+
231231
return $builder;
232232
}
233-
233+
234234
protected function _buildSSL(ClientBuilder $builder): ClientBuilder
235235
{
236236
$sslCert = config('database.connections.opensearch.ssl.cert') ?? null;
@@ -243,10 +243,10 @@ protected function _buildSSL(ClientBuilder $builder): ClientBuilder
243243
if ($sslKey) {
244244
$builder->setSSLKey($sslKey, $sslKeyPassword);
245245
}
246-
246+
247247
return $builder;
248248
}
249-
249+
250250
protected function _buildOptions(ClientBuilder $builder): ClientBuilder
251251
{
252252
$builder->setSSLVerification($this->sslVerification);
@@ -259,17 +259,17 @@ protected function _buildOptions(ClientBuilder $builder): ClientBuilder
259259
if (!empty($this->portInHeaders)) {
260260
$builder->includePortInHostHeader($this->portInHeaders);
261261
}
262-
262+
263263
return $builder;
264264
}
265-
266-
267-
268-
265+
266+
267+
268+
269269
//----------------------------------------------------------------------
270270
// Dynamic call routing to DSL bridge
271271
//----------------------------------------------------------------------
272-
272+
273273
public function __call($method, $parameters)
274274
{
275275
if (!$this->index) {
@@ -280,7 +280,7 @@ public function __call($method, $parameters)
280280
$this->rebuild = false;
281281
}
282282
$bridge = new Bridge($this);
283-
283+
284284
return $bridge->{'process'.Str::studly($method)}(...$parameters);
285285
}
286286
}

0 commit comments

Comments
 (0)