Total Complexity | 8 |
Total Lines | 55 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | class ColumnSchemaBuilder extends AbstractColumnSchemaBuilder |
||
20 | { |
||
21 | protected $format = '{type}{length}{notnull}{unique}{default}{check}{append}'; |
||
22 | |||
23 | /** |
||
24 | * Builds the full string for the column's schema. |
||
25 | * @return string |
||
26 | */ |
||
27 | public function __toString() |
||
28 | { |
||
29 | if ($this->getTypeCategory() === self::CATEGORY_PK) { |
||
30 | $format = '{type}{check}{comment}{append}'; |
||
31 | } else { |
||
32 | $format = $this->format; |
||
33 | } |
||
34 | |||
35 | return $this->buildCompleteString($format); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Changes default format string to MSSQL ALTER COMMAND |
||
40 | */ |
||
41 | public function setAlterColumnFormat() |
||
42 | { |
||
43 | $this->format = '{type}{length}{notnull}{append}'; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Getting the `Default` value for constraint |
||
48 | * @return string|Expression|null |
||
49 | */ |
||
50 | public function getDefaultValue() |
||
51 | { |
||
52 | if ($this->default instanceof Expression) { |
||
53 | return $this->default; |
||
54 | } |
||
55 | |||
56 | return $this->buildDefaultValue(); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Get the `Check` value for constraint |
||
61 | * @return string|null |
||
62 | */ |
||
63 | public function getCheckValue() |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * @return bool |
||
70 | */ |
||
71 | public function isUnique() |
||
74 | } |
||
75 | } |
||
76 |