Completed
Push — master ( 55b06d...9f2a87 )
by Alexander
35:57
created

ColumnSchema::phpTypecast()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 10
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
     * {@inheritdoc}
19
     */
20
    public function phpTypecast($value)
21
    {
22
        if ($value !== null) {
23
            // convert from MSSQL column_default format, e.g. ('1') -> 1, ('string') -> string
24
            $value = trim($value, "'()");
25
        }
26
27
        return parent::phpTypecast($value);
28
    }
29
}
30