PdoTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A getAdapter() 0 16 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace StefanoTreeTest\Integration\Adapter;
6
7
use StefanoTree\NestedSet\Adapter\AdapterInterface;
8
use StefanoTree\NestedSet\Adapter\Pdo;
9
use StefanoTree\NestedSet\Options;
10
use StefanoTreeTest\TestUtil;
11
12
/**
13
 * @internal
14
 */
15
class PdoTest extends AdapterAbstract
16
{
17
    protected $adapterCanQuoteIdentifier = false;
18
19
    /**
20
     * @return AdapterInterface
21
     */
22
    protected function getAdapter(): AdapterInterface
23
    {
24
        if (null === $this->adapter) {
25
            $options = new Options(array(
26
                'tableName' => 'tree_traversal',
27
                'idColumnName' => 'tree_traversal_id',
28
            ));
29
30
            if ('pgsql' == TEST_STEFANO_DB_VENDOR) {
0 ignored issues
show
introduced by
The condition 'pgsql' == StefanoTreeTe...\TEST_STEFANO_DB_VENDOR is always false.
Loading history...
31
                $options->setSequenceName('tree_traversal_tree_traversal_id_seq');
32
            }
33
34
            $this->adapter = new Pdo($options, TestUtil::getPDOConnection());
35
        }
36
37
        return $this->adapter;
38
    }
39
}
40