Completed
Push — master ( 9988ef...c2eae6 )
by Alexander
20:29
created

ColumnSchema   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 16
ccs 4
cts 4
cp 1
rs 10
c 1
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
     * Prepares default value and converts it according to [[phpType]]
19
     * @param mixed $value default value
20
     * @return mixed converted value
21
     * @since 2.0.24
22
     */
23 231
    public function defaultPhpTypecast($value)
24
    {
25 231
        if ($value !== null) {
26
            // convert from MSSQL column_default format, e.g. ('1') -> 1, ('string') -> string
27 140
            $value = substr(substr($value, 2), 0, -2);
28
        }
29
30 231
        return parent::phpTypecast($value);
31
    }
32
}
33