Completed
Push — master ( 9a42bb...2c0ba3 )
by José
04:17 queued 02:39
created

AdapterWrapper::quoteColumnName()   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 2
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;
32
use Phinx\Db\Table\Column;
33
use Phinx\Db\Table\Index;
34
use Phinx\Db\Table\ForeignKey;
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 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
        return $this;
69
    }
70
71
    /**
72
     * {@inheritdoc}
73
     */
74 24
    public function getAdapter()
75
    {
76 24
        return $this->adapter;
77
    }
78
79
    /**
80
     * {@inheritdoc}
81
     */
82
    public function setOptions(array $options)
83
    {
84
        $this->adapter->setOptions($options);
85
        return $this;
86
    }
87
88
    /**
89
     * {@inheritdoc}
90
     */
91 2
    public function getOptions()
92
    {
93 2
        return $this->adapter->getOptions();
94
    }
95
96
    /**
97
     * {@inheritdoc}
98
     */
99 8
    public function hasOption($name)
100
    {
101 8
        return $this->adapter->hasOption($name);
102
    }
103
104
    /**
105
     * {@inheritdoc}
106
     */
107 19
    public function getOption($name)
108
    {
109 19
        return $this->adapter->getOption($name);
110
    }
111
112
    /**
113
     * {@inheritdoc}
114
     */
115 5
    public function setInput(InputInterface $input)
116
    {
117 5
        $this->adapter->setInput($input);
118 5
        return $this;
119
    }
120
121
    /**
122
     * {@inheritdoc}
123
     */
124
    public function getInput()
125
    {
126
        return $this->adapter->getInput();
127
    }
128
129
    /**
130
     * {@inheritdoc}
131
     */
132 5
    public function setOutput(OutputInterface $output)
133
    {
134 5
        $this->adapter->setOutput($output);
135 5
        return $this;
136
    }
137
138
    /**
139
     * {@inheritdoc}
140
     */
141 5
    public function getOutput()
142
    {
143 5
        return $this->adapter->getOutput();
144
    }
145
146
    /**
147
     * {@inheritdoc}
148
     */
149
    public function connect()
150
    {
151
        $this->getAdapter()->connect();
152
    }
153
154
    /**
155
     * {@inheritdoc}
156
     */
157 5
    public function disconnect()
158
    {
159 5
        $this->getAdapter()->disconnect();
160 5
    }
161
162
    /**
163
     * {@inheritdoc}
164
     */
165 2
    public function execute($sql)
166
    {
167 2
        return $this->getAdapter()->execute($sql);
168
    }
169
170
    /**
171
     * {@inheritdoc}
172
     */
173
    public function query($sql)
174
    {
175
        return $this->getAdapter()->query($sql);
176
    }
177
178
    /**
179
     * {@inheritdoc}
180
     */
181
    public function insert(Table $table, $row)
182
    {
183
        $this->getAdapter()->insert($table, $row);
184
    }
185
186
    /**
187
     * {@inheritdoc}
188
     */
189 3
    public function bulkinsert(Table $table, $rows)
190
    {
191 3
        $this->getAdapter()->bulkinsert($table, $rows);
192 3
    }
193
194
    /**
195
     * {@inheritdoc}
196
     */
197
    public function fetchRow($sql)
198
    {
199
        return $this->getAdapter()->fetchRow($sql);
200
    }
201
202
    /**
203
     * {@inheritdoc}
204
     */
205 1
    public function fetchAll($sql)
206
    {
207 1
        return $this->getAdapter()->fetchAll($sql);
208
    }
209
210
    /**
211
     * {@inheritdoc}
212
     */
213 5
    public function getVersions()
214
    {
215 5
        return $this->getAdapter()->getVersions();
216
    }
217
218
    /**
219
     * {@inheritdoc}
220
     */
221 5
    public function getVersionLog()
222
    {
223 5
        return $this->getAdapter()->getVersionLog();
224
    }
225
226
    /**
227
     * {@inheritdoc}
228
     */
229 5
    public function migrated(MigrationInterface $migration, $direction, $startTime, $endTime)
230
    {
231 5
        $this->getAdapter()->migrated($migration, $direction, $startTime, $endTime);
232 5
        return $this;
233
    }
234
235
    /**
236
     * @inheritDoc
237
     */
238 1
    public function toggleBreakpoint(MigrationInterface $migration)
239
    {
240 1
        $this->getAdapter()->toggleBreakpoint($migration);
241 1
        return $this;
242
    }
243
244
    /**
245
     * @inheritDoc
246
     */
247 1
    public function resetAllBreakpoints()
248
    {
249 1
        return $this->getAdapter()->resetAllBreakpoints();
250
    }
251
252
    /**
253
     * {@inheritdoc}
254
     */
255
    public function hasSchemaTable()
256
    {
257
        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...
258
    }
259
260
    /**
261
     * {@inheritdoc}
262
     */
263
    public function createSchemaTable()
264
    {
265
        $this->getAdapter()->createSchemaTable();
266
    }
267
268
    /**
269
     * {@inheritdoc}
270
     */
271
    public function getColumnTypes()
272
    {
273
        return $this->getAdapter()->getColumnTypes();
274
    }
275
276
    /**
277
     * {@inheritdoc}
278
     */
279 4
    public function isValidColumnType(Column $column)
280
    {
281 4
        return $this->getAdapter()->isValidColumnType($column);
282
    }
283
284
    /**
285
     * {@inheritdoc}
286
     */
287 5
    public function hasTransactions()
288
    {
289 5
        return $this->getAdapter()->hasTransactions();
290
    }
291
292
    /**
293
     * {@inheritdoc}
294
     */
295 5
    public function beginTransaction()
296
    {
297 5
        $this->getAdapter()->beginTransaction();
298 5
    }
299
300
    /**
301
     * {@inheritdoc}
302
     */
303 5
    public function commitTransaction()
304
    {
305 5
        $this->getAdapter()->commitTransaction();
306 5
    }
307
308
    /**
309
     * {@inheritdoc}
310
     */
311
    public function rollbackTransaction()
312
    {
313
        $this->getAdapter()->rollbackTransaction();
314
    }
315
316
    /**
317
     * {@inheritdoc}
318
     */
319
    public function quoteTableName($tableName)
320
    {
321
        return $this->getAdapter()->quoteTableName($tableName);
322
    }
323
324
    /**
325
     * {@inheritdoc}
326
     */
327
    public function quoteColumnName($columnName)
328
    {
329
        return $this->getAdapter()->quoteColumnName($columnName);
330
    }
331
332
    /**
333
     * {@inheritdoc}
334
     */
335 5
    public function hasTable($tableName)
336
    {
337 5
        return $this->getAdapter()->hasTable($tableName);
338
    }
339
340
    /**
341
     * {@inheritdoc}
342
     */
343 6
    public function createTable(Table $table)
344
    {
345 6
        $this->getAdapter()->createTable($table);
346 6
    }
347
348
    /**
349
     * {@inheritdoc}
350
     */
351 4
    public function renameTable($tableName, $newTableName)
352
    {
353 4
        $this->getAdapter()->renameTable($tableName, $newTableName);
354 4
    }
355
356
    /**
357
     * {@inheritdoc}
358
     */
359 4
    public function dropTable($tableName)
360
    {
361 4
        $this->getAdapter()->dropTable($tableName);
362 4
    }
363
364
    /**
365
     * {@inheritdoc}
366
     */
367
    public function truncateTable($tableName)
368
    {
369
        $this->getAdapter()->truncateTable($tableName);
370
    }
371
372
    /**
373
     * {@inheritdoc}
374
     */
375 1
    public function getColumns($tableName)
376
    {
377 1
        return $this->getAdapter()->getColumns($tableName);
378
    }
379
380
    /**
381
     * {@inheritdoc}
382
     */
383 4
    public function hasColumn($tableName, $columnName)
384
    {
385 4
        return $this->getAdapter()->hasColumn($tableName, $columnName);
386
    }
387
388
    /**
389
     * {@inheritdoc}
390
     */
391 4
    public function addColumn(Table $table, Column $column)
392
    {
393 4
        $this->getAdapter()->addColumn($table, $column);
394 4
    }
395
396
    /**
397
     * {@inheritdoc}
398
     */
399 4
    public function renameColumn($tableName, $columnName, $newColumnName)
400
    {
401 4
        $this->getAdapter()->renameColumn($tableName, $columnName, $newColumnName);
402 4
    }
403
404
    /**
405
     * {@inheritdoc}
406
     */
407 1
    public function changeColumn($tableName, $columnName, Column $newColumn)
408
    {
409 1
        return $this->getAdapter()->changeColumn($tableName, $columnName, $newColumn);
410
    }
411
412
    /**
413
     * {@inheritdoc}
414
     */
415 4
    public function dropColumn($tableName, $columnName)
416
    {
417 4
        $this->getAdapter()->dropColumn($tableName, $columnName);
418 4
    }
419
420
    /**
421
     * {@inheritdoc}
422
     */
423 1
    public function hasIndex($tableName, $columns)
424
    {
425 1
        return $this->getAdapter()->hasIndex($tableName, $columns);
426
    }
427
428
    /**
429
     * {@inheritdoc}
430
     */
431
    public function hasIndexByName($tableName, $indexName)
432
    {
433
        return $this->getAdapter()->hasIndexByName($tableName, $indexName);
434
    }
435
436
    /**
437
     * {@inheritdoc}
438
     */
439
    public function addIndex(Table $table, Index $index)
440
    {
441
        $this->getAdapter()->addIndex($table, $index);
442
    }
443
444
    /**
445
     * {@inheritdoc}
446
     */
447 1
    public function dropIndex($tableName, $columns)
448
    {
449 1
        $this->getAdapter()->dropIndex($tableName, $columns);
450 1
    }
451
452
    /**
453
     * {@inheritdoc}
454
     */
455 1
    public function dropIndexByName($tableName, $indexName)
456
    {
457 1
        $this->getAdapter()->dropIndexByName($tableName, $indexName);
458 1
    }
459
460
    /**
461
     * {@inheritdoc}
462
     */
463 4
    public function hasForeignKey($tableName, $columns, $constraint = null)
464
    {
465 4
        return $this->getAdapter()->hasForeignKey($tableName, $columns, $constraint);
466
    }
467
468
    /**
469
     * {@inheritdoc}
470
     */
471 4
    public function addForeignKey(Table $table, ForeignKey $foreignKey)
472
    {
473 4
        $this->getAdapter()->addForeignKey($table, $foreignKey);
474 4
    }
475
476
    /**
477
     * {@inheritdoc}
478
     */
479 4
    public function dropForeignKey($tableName, $columns, $constraint = null)
480
    {
481 4
        $this->getAdapter()->dropForeignKey($tableName, $columns, $constraint);
482 4
    }
483
484
    /**
485
     * {@inheritdoc}
486
     */
487
    public function getSqlType($type, $limit = null)
488
    {
489
        return $this->getAdapter()->getSqlType($type, $limit);
490
    }
491
492
    /**
493
     * {@inheritdoc}
494
     */
495 5
    public function createDatabase($name, $options = [])
496
    {
497 5
        $this->getAdapter()->createDatabase($name, $options);
498 5
    }
499
500
    /**
501
     * {@inheritdoc}
502
     */
503
    public function hasDatabase($name)
504
    {
505
        $this->getAdapter()->hasDatabase($name);
506
    }
507
508
    /**
509
     * {@inheritdoc}
510
     */
511 5
    public function dropDatabase($name)
512
    {
513 5
        $this->getAdapter()->dropDatabase($name);
514 5
    }
515
516
    /**
517
     * {@inheritdoc}
518
     */
519
    public function createSchema($schemaName = 'public')
520
    {
521
        $this->getAdapter()->createSchema($schemaName);
522
    }
523
524
    /**
525
     * {@inheritdoc}
526
     */
527
    public function dropSchema($schemaName)
528
    {
529
        $this->getAdapter()->dropSchema($schemaName);
530
    }
531
532
    /**
533
     * {@inheritdoc}
534
     */
535
    public function castToBool($value)
536
    {
537
        return $this->getAdapter()->castToBool($value);
538
    }
539
540
    /**
541
     * {@inheritdoc}
542
     */
543
    public function getConnection()
544
    {
545
        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...
546
    }
547
}
548