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

ColumnSchemaBuilder::asString()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 0
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 1
rs 10
c 0
b 0
f 0
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