Passed
Push — master ( 88983b...1e7624 )
by Wilmer
02:43
created

TestCase::loadFixture()   B

Complexity

Conditions 10
Paths 72

Size

Total Lines 43
Code Lines 33

Duplication

Lines 0
Ratio 0 %

Importance

Changes 4
Bugs 0 Features 0
Metric Value
cc 10
eloc 33
nc 72
nop 1
dl 0
loc 43
rs 7.6666
c 4
b 0
f 0

How to fix   Complexity   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\ActiveRecord\Tests;
6
7
use Yiisoft\ActiveRecord\Tests\Support\DbHelper;
8
use Yiisoft\Db\Connection\ConnectionInterface;
9
10
class TestCase extends \PHPUnit\Framework\TestCase
11
{
12
    protected ConnectionInterface $db;
13
14
    protected function checkFixture(ConnectionInterface $db, string $tablename, bool $reset = false): void
15
    {
16
        $schema = $db->getSchema();
17
        $tableSchema = $schema->getTableSchema($tablename, true);
18
19
        if ($tableSchema === null || $reset) {
20
            DbHelper::loadFixture($db);
21
22
            $schema->refresh();
23
        }
24
    }
25
}
26