Passed
Branch master (cb823e)
by Wilmer
30:36 queued 19:42
created

ColumnSchemaBuilder   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

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\Oracle;
6
7
use Yiisoft\Db\Schema\AbstractColumnSchemaBuilder;
8
9
/**
10
 * ColumnSchemaBuilder is the schema builder for Oracle databases.
11
 */
12
final class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
13
{
14
    /**
15
     * Builds the unsigned string for column. Defaults to unsupported.
16
     *
17
     * @return string a string containing UNSIGNED keyword.
18
     */
19 7
    protected function buildUnsignedString(): string
20
    {
21 7
        return $this->isUnsigned() ? ' UNSIGNED' : '';
22
    }
23
24
    /**
25
     * Builds the full string for the column's schema.
26
     *
27
     * @return string
28
     */
29 7
    public function asString(): string
30
    {
31 7
        $format = match ($this->getTypeCategory()) {
32 7
            self::CATEGORY_PK => '{type}{length}{check}{append}',
33 7
            self::CATEGORY_NUMERIC => '{type}{length}{unsigned}{default}{notnull}{check}{append}',
34 7
            default => '{type}{length}{default}{notnull}{check}{append}',
35 7
        };
36
37 7
        return $this->buildCompleteString($format);
38
    }
39
}
40