Completed
Push — refactor-db-tests ( 8ba032 )
by Carsten
09:18
created

ColumnSchemaBuilder::buildUnsignedString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 2
eloc 2
nc 2
nop 0
crap 6
1
<?php
2
/**
3
 * @link http://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license http://www.yiiframework.com/license/
6
 */
7
8
namespace yii\db\oci;
9
10
use yii\db\ColumnSchemaBuilder as AbstractColumnSchemaBuilder;
11
12
/**
13
 * ColumnSchemaBuilder is the schema builder for Oracle databases.
14
 *
15
 * @author Vasenin Matvey <[email protected]>
16
 * @author Chris Harris <[email protected]>
17
 * @since 2.0.6
18
 */
19
class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
20
{
21
    /**
22
     * @inheritdoc
23
     */
24
    protected function buildUnsignedString()
25
    {
26
        return $this->isUnsigned ? ' UNSIGNED' : '';
27
    }
28
29
    /**
30
     * @inheritdoc
31
     */
32
    protected function buildAfterString()
33
    {
34
        return $this->after !== null ?
35
            ' AFTER ' . $this->db->quoteColumnName($this->after) :
36
            '';
37
    }
38
39
    /**
40
     * @inheritdoc
41
     */
42
    protected function buildFirstString()
43
    {
44
        return $this->isFirst ? ' FIRST' : '';
45
    }
46
47
    /**
48
     * @inheritdoc
49
     */
50
    public function __toString()
51
    {
52
        switch ($this->getTypeCategory()) {
53
            case self::CATEGORY_PK:
54
                $format = '{type}{length}{check}{pos}{append}';
55
                break;
56
            case self::CATEGORY_NUMERIC:
57
                $format = '{type}{length}{unsigned}{default}{notnull}{check}{pos}{append}';
58
                break;
59
            default:
60
                $format = '{type}{length}{default}{notnull}{check}{pos}{append}';
61
        }
62
        return $this->buildCompleteString($format);
63
    }
64
}
65