Passed
Pull Request — master (#20362)
by Wilmer
05:37
created

ColumnSchemaBuilder   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 27
ccs 0
cts 12
cp 0
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 14 3
A buildUnsignedString() 0 3 2
1
<?php
2
/**
3
 * @link https://www.yiiframework.com/
4
 * @copyright Copyright (c) 2008 Yii Software LLC
5
 * @license https://www.yiiframework.com/license/
6
 */
7
8
namespace yii\db\sqlite;
9
10
use yii\db\ColumnSchemaBuilder as AbstractColumnSchemaBuilder;
11
12
/**
13
 * ColumnSchemaBuilder is the schema builder for Sqlite databases.
14
 *
15
 * @author Chris Harris <[email protected]>
16
 * @since 2.0.8
17
 */
18
class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    protected function buildUnsignedString()
24
    {
25
        return $this->isUnsigned ? ' UNSIGNED' : '';
26
    }
27
28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function __toString()
32
    {
33
        switch ($this->getTypeCategory()) {
34
            case self::CATEGORY_PK:
35
                $format = '{type}{check}{append}';
36
                break;
37
            case self::CATEGORY_NUMERIC:
38
                $format = '{type}{length}{unsigned}{notnull}{unique}{check}{default}{append}';
39
                break;
40
            default:
41
                $format = '{type}{length}{notnull}{unique}{check}{default}{append}';
42
        }
43
44
        return $this->buildCompleteString($format);
45
    }
46
}
47