Passed
Push — remove-unnecessary-stringable ( 073c0d )
by Wilmer
25:18 queued 15:07
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\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