Completed
Branch feature/pre-split (d89158)
by Anton
04:43
created

SQLiteIndex::createInstance()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 6

Duplication

Lines 11
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
eloc 6
nc 4
nop 3
dl 11
loc 11
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Spiral Framework.
4
 *
5
 * @license   MIT
6
 * @author    Anton Titov (Wolfy-J)
7
 */
8
9
namespace Spiral\Database\Drivers\SQLite\Schemas;
10
11
use Spiral\Database\Schemas\Prototypes\AbstractIndex;
12
13
class SQLiteIndex extends AbstractIndex
14
{
15
    /**
16
     * @param string $table
17
     * @param array  $schema
18
     * @param array  $columns
19
     *
20
     * @return SQLiteIndex
21
     */
22 View Code Duplication
    public static function createInstance(string $table, array $schema, array $columns): self
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    {
24
        $index = new self($table, $schema['name']);
25
        $index->type = $schema['unique'] ? self::UNIQUE : self::NORMAL;
26
27
        foreach ($columns as $column) {
28
            $index->columns[] = $column['name'];
29
        }
30
31
        return $index;
32
    }
33
}
34