Test Failed
Pull Request — master (#185)
by Wilmer
17:16
created

ColumnSchemaBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 7
c 1
b 0
f 0
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildUnsignedString() 0 3 2
A asString() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Sqlite;
6
7
use Yiisoft\Db\Schema\AbstractColumnSchemaBuilder;
8
9
final class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
10
{
11
    /**
12
     * Builds the unsigned string for column. Defaults to unsupported.
13
     *
14
     * @return string a string containing UNSIGNED keyword.
15
     */
16 7
    protected function buildUnsignedString(): string
17
    {
18 7
        return $this->isUnsigned() ? ' UNSIGNED' : '';
19
    }
20
21 7
    public function asString(): string
22
    {
23 7
        $format = match ($this->getTypeCategory()) {
24 7
            self::CATEGORY_PK => '{type}{check}{append}',
25 7
            self::CATEGORY_NUMERIC => '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}',
26 7
            default => '{type}{length}{notnull}{unique}{check}{default}{append}',
27 7
        };
28
29 7
        return $this->buildCompleteString($format);
30
    }
31
}
32