Completed
Pull Request — master (#1357)
by José
11:07
created

AdapterWrapper::query()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
/**
3
 * Phinx
4
 *
5
 * (The MIT license)
6
 * Copyright (c) 2015 Rob Morgan
7
 *
8
 * Permission is hereby granted, free of charge, to any person obtaining a copy
9
 * of this software and associated * documentation files (the "Software"), to
10
 * deal in the Software without restriction, including without limitation the
11
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12
 * sell copies of the Software, and to permit persons to whom the Software is
13
 * furnished to do so, subject to the following conditions:
14
 *
15
 * The above copyright notice and this permission notice shall be included in
16
 * all copies or substantial portions of the Software.
17
 *
18
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
 * IN THE SOFTWARE.
25
 *
26
 * @package    Phinx
27
 * @subpackage Phinx\Db\Adapter
28
 */
29
namespace Phinx\Db\Adapter;
30
31
use Phinx\Db\Table\Column;
32
use Phinx\Db\Table\ForeignKey;
33
use Phinx\Db\Table\Index;
34
use Phinx\Db\Table\Table;
35
use Phinx\Migration\MigrationInterface;
36
use Symfony\Component\Console\Input\InputInterface;
37
use Symfony\Component\Console\Output\OutputInterface;
38
39
/**
40
 * Adapter Wrapper.
41
 *
42
 * Proxy commands through to another adapter, allowing modification of
43
 * parameters during calls.
44
 *
45
 * @author Woody Gilk <[email protected]>
46
 */
47
abstract class AdapterWrapper implements AdapterInterface, WrapperInterface
48
{
49
    /**
50
     * @var \Phinx\Db\Adapter\AdapterInterface
51
     */
52
    protected $adapter;
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 36
    public function __construct(AdapterInterface $adapter)
58
    {
59 36
        $this->setAdapter($adapter);
60 36
    }
61
62
    /**
63
     * {@inheritdoc}
64
     */
65 36
    public function setAdapter(AdapterInterface $adapter)
66
    {
67 36
        $this->adapter = $adapter;
68 36
69
        return $this;
70
    }
71
72
    /**
73
     * {@inheritdoc}
74 24
     */
75
    public function getAdapter()
76 24
    {
77
        return $this->adapter;
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     */
83
    public function setOptions(array $options)
84
    {
85
        $this->adapter->setOptions($options);
86
87
        return $this;
88
    }
89
90
    /**
91 2
     * {@inheritdoc}
92
     */
93 2
    public function getOptions()
94
    {
95
        return $this->adapter->getOptions();
96
    }
97
98
    /**
99 8
     * {@inheritdoc}
100
     */
101 8
    public function hasOption($name)
102
    {
103
        return $this->adapter->hasOption($name);
104
    }
105
106
    /**
107 19
     * {@inheritdoc}
108
     */
109 19
    public function getOption($name)
110
    {
111
        return $this->adapter->getOption($name);
112
    }
113
114
    /**
115 5
     * {@inheritdoc}
116
     */
117 5
    public function setInput(InputInterface $input)
118 5
    {
119
        $this->adapter->setInput($input);
120
121
        return $this;
122
    }
123
124
    /**
125
     * {@inheritdoc}
126
     */
127
    public function getInput()
128
    {
129
        return $this->adapter->getInput();
130
    }
131
132 5
    /**
133
     * {@inheritdoc}
134 5
     */
135 5
    public function setOutput(OutputInterface $output)
136
    {
137
        $this->adapter->setOutput($output);
138
139
        return $this;
140
    }
141 5
142
    /**
143 5
     * {@inheritdoc}
144
     */
145
    public function getOutput()
146
    {
147
        return $this->adapter->getOutput();
148
    }
149
150
    /**
151
     * {@inheritdoc}
152
     */
153
    public function connect()
154
    {
155
        $this->getAdapter()->connect();
156
    }
157 5
158
    /**
159 5
     * {@inheritdoc}
160 5
     */
161
    public function disconnect()
162
    {
163
        $this->getAdapter()->disconnect();
164
    }
165 2
166
    /**
167 2
     * {@inheritdoc}
168
     */
169
    public function execute($sql)
170
    {
171
        return $this->getAdapter()->execute($sql);
172
    }
173
174
    /**
175
     * {@inheritdoc}
176
     */
177
    public function query($sql)
178
    {
179
        return $this->getAdapter()->query($sql);
180
    }
181
182
    /**
183
     * {@inheritdoc}
184
     */
185
    public function insert(Table $table, $row)
186
    {
187
        $this->getAdapter()->insert($table, $row);
188
    }
189 3
190
    /**
191 3
     * {@inheritdoc}
192 3
     */
193
    public function bulkinsert(Table $table, $rows)
194
    {
195
        $this->getAdapter()->bulkinsert($table, $rows);
196
    }
197
198
    /**
199
     * {@inheritdoc}
200
     */
201
    public function fetchRow($sql)
202
    {
203
        return $this->getAdapter()->fetchRow($sql);
204
    }
205 1
206
    /**
207 1
     * {@inheritdoc}
208
     */
209
    public function fetchAll($sql)
210
    {
211
        return $this->getAdapter()->fetchAll($sql);
212
    }
213 5
214
    /**
215 5
     * {@inheritdoc}
216
     */
217
    public function getVersions()
218
    {
219
        return $this->getAdapter()->getVersions();
220
    }
221 5
222
    /**
223 5
     * {@inheritdoc}
224
     */
225
    public function getVersionLog()
226
    {
227
        return $this->getAdapter()->getVersionLog();
228
    }
229 5
230
    /**
231 5
     * {@inheritdoc}
232 5
     */
233
    public function migrated(MigrationInterface $migration, $direction, $startTime, $endTime)
234
    {
235
        $this->getAdapter()->migrated($migration, $direction, $startTime, $endTime);
236
237
        return $this;
238 1
    }
239
240 1
    /**
241 1
     * @inheritDoc
242
     */
243
    public function toggleBreakpoint(MigrationInterface $migration)
244
    {
245
        $this->getAdapter()->toggleBreakpoint($migration);
246
247 1
        return $this;
248
    }
249 1
250
    /**
251
     * @inheritDoc
252
     */
253
    public function resetAllBreakpoints()
254
    {
255
        return $this->getAdapter()->resetAllBreakpoints();
256
    }
257
258
    /**
259
     * {@inheritdoc}
260
     */
261
    public function hasSchemaTable()
262
    {
263
        return $this->getAdapter()->hasSchemaTable();
0 ignored issues
show
Deprecated Code introduced by
The method Phinx\Db\Adapter\Adapter...rface::hasSchemaTable() has been deprecated with message: use hasTable instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
264
    }
265
266
    /**
267
     * {@inheritdoc}
268
     */
269
    public function createSchemaTable()
270
    {
271
        $this->getAdapter()->createSchemaTable();
272
    }
273
274
    /**
275
     * {@inheritdoc}
276
     */
277
    public function getColumnTypes()
278
    {
279 4
        return $this->getAdapter()->getColumnTypes();
280
    }
281 4
282
    /**
283
     * {@inheritdoc}
284
     */
285
    public function isValidColumnType(Column $column)
286
    {
287 5
        return $this->getAdapter()->isValidColumnType($column);
288
    }
289 5
290
    /**
291
     * {@inheritdoc}
292
     */
293
    public function hasTransactions()
294
    {
295 5
        return $this->getAdapter()->hasTransactions();
296
    }
297 5
298 5
    /**
299
     * {@inheritdoc}
300
     */
301
    public function beginTransaction()
302
    {
303 5
        $this->getAdapter()->beginTransaction();
304
    }
305 5
306 5
    /**
307
     * {@inheritdoc}
308
     */
309
    public function commitTransaction()
310
    {
311
        $this->getAdapter()->commitTransaction();
312
    }
313
314
    /**
315
     * {@inheritdoc}
316
     */
317
    public function rollbackTransaction()
318
    {
319
        $this->getAdapter()->rollbackTransaction();
320
    }
321
322
    /**
323
     * {@inheritdoc}
324
     */
325
    public function quoteTableName($tableName)
326
    {
327
        return $this->getAdapter()->quoteTableName($tableName);
328
    }
329
330
    /**
331
     * {@inheritdoc}
332
     */
333
    public function quoteColumnName($columnName)
334
    {
335 5
        return $this->getAdapter()->quoteColumnName($columnName);
336
    }
337 5
338
    /**
339
     * {@inheritdoc}
340
     */
341
    public function hasTable($tableName)
342
    {
343 6
        return $this->getAdapter()->hasTable($tableName);
344
    }
345 6
346 6
    /**
347
     * {@inheritdoc}
348
     */
349
    public function createTable(Table $table, array $columns = [], array $indexes = [])
350
    {
351 4
        $this->getAdapter()->createTable($table, $columns, $indexes);
352
    }
353 4
354 4
    /**
355
     * {@inheritdoc}
356
     */
357
    public function getColumns($tableName)
358
    {
359 4
        return $this->getAdapter()->getColumns($tableName);
360
    }
361 4
362 4
    /**
363
     * {@inheritdoc}
364
     */
365
    public function hasColumn($tableName, $columnName)
366
    {
367
        return $this->getAdapter()->hasColumn($tableName, $columnName);
368
    }
369
370
    /**
371
     * {@inheritdoc}
372
     */
373
    public function hasIndex($tableName, $columns)
374
    {
375 1
        return $this->getAdapter()->hasIndex($tableName, $columns);
376
    }
377 1
378
    /**
379
     * {@inheritdoc}
380
     */
381
    public function hasIndexByName($tableName, $indexName)
382
    {
383 4
        return $this->getAdapter()->hasIndexByName($tableName, $indexName);
384
    }
385 4
386
    /**
387
     * {@inheritdoc}
388
     */
389
    public function hasForeignKey($tableName, $columns, $constraint = null)
390
    {
391 4
        return $this->getAdapter()->hasForeignKey($tableName, $columns, $constraint);
392
    }
393 4
394 4
    /**
395
     * {@inheritdoc}
396
     */
397
    public function getSqlType($type, $limit = null)
398
    {
399 4
        return $this->getAdapter()->getSqlType($type, $limit);
400
    }
401 4
402 4
    /**
403
     * {@inheritdoc}
404
     */
405
    public function createDatabase($name, $options = [])
406
    {
407 1
        $this->getAdapter()->createDatabase($name, $options);
408
    }
409 1
410
    /**
411
     * {@inheritdoc}
412
     */
413
    public function hasDatabase($name)
414
    {
415 4
        $this->getAdapter()->hasDatabase($name);
416
    }
417 4
418 4
    /**
419
     * {@inheritdoc}
420
     */
421
    public function dropDatabase($name)
422
    {
423 1
        $this->getAdapter()->dropDatabase($name);
424
    }
425 1
426
    /**
427
     * {@inheritdoc}
428
     */
429
    public function createSchema($schemaName = 'public')
430
    {
431
        $this->getAdapter()->createSchema($schemaName);
432
    }
433
434
    /**
435
     * {@inheritdoc}
436
     */
437
    public function dropSchema($schemaName)
438
    {
439
        $this->getAdapter()->dropSchema($schemaName);
440
    }
441
442
    /**
443
     * {@inheritdoc}
444
     */
445
    public function truncateTable($tableName)
446
    {
447 1
        $this->getAdapter()->truncateTable($tableName);
448
    }
449 1
450 1
    /**
451
     * {@inheritdoc}
452
     */
453
    public function castToBool($value)
454
    {
455 1
        return $this->getAdapter()->castToBool($value);
456
    }
457 1
458 1
    /**
459
     * {@inheritdoc}
460
     */
461
    public function getConnection()
462
    {
463 4
        return $this->getAdapter()->getConnection();
0 ignored issues
show
Bug introduced by
The method getConnection() does not exist on Phinx\Db\Adapter\AdapterInterface. Did you maybe mean connect()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
464
    }
465 4
466
    /**
467
     * {@inheritdoc}
468
     */
469
    public function executeActions(Table $table, array $actions)
470
    {
471 4
        $this->getAdapter()->executeActions($table, $actions);
472
    }
473 4
474 4
    /**
475
     * {@inheritdoc}
476
     */
477
    public function getQueryBuilder()
478
    {
479 4
        return $this->getAdapter()->getQueryBuilder();
480
    }
481
}
482