Passed
Pull Request — master (#19371)
by Wilmer
19:12
created

ColumnSchema   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 23
ccs 0
cts 6
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A defaultPhpTypecast() 0 8 2
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\mssql;
9
10
/**
11
 * Class ColumnSchema for MSSQL database
12
 *
13
 * @since 2.0.23
14
 */
15
class ColumnSchema extends \yii\db\ColumnSchema
16
{
17
    /**
18
     * @var bool whether this column is a computed column
19
     * @since 2.0.39
20
     */
21
    public $isComputed;
22
23
24
    /**
25
     * Prepares default value and converts it according to [[phpType]]
26
     * @param mixed $value default value
27
     * @return mixed converted value
28
     * @since 2.0.24
29
     */
30
    public function defaultPhpTypecast($value)
31
    {
32
        if ($value !== null) {
33
            // convert from MSSQL column_default format, e.g. ('1') -> 1, ('string') -> string
34
            $value = substr(substr($value, 2), 0, -2);
35
        }
36
37
        return parent::phpTypecast($value);
38
    }
39
}
40