| 1 | <?php |
||
| 11 | class Column |
||
| 12 | { |
||
| 13 | /** @var string */ |
||
| 14 | protected $name; |
||
| 15 | |||
| 16 | /** @var TypeInterface */ |
||
| 17 | protected $type; |
||
| 18 | |||
| 19 | /** @var bool */ |
||
| 20 | protected $hasDefault; |
||
| 21 | |||
| 22 | /** @var bool */ |
||
| 23 | protected $isNullable; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * Column constructor. |
||
| 27 | * |
||
| 28 | * @param string $name |
||
| 29 | * @param TypeInterface $type |
||
| 30 | * @param bool $hasDefault |
||
| 31 | * @param bool $isNullable |
||
| 32 | */ |
||
| 33 | 91 | public function __construct($name, TypeInterface $type, $hasDefault, $isNullable) |
|
| 40 | |||
| 41 | /** |
||
| 42 | * Returns a new column with params from $columnDefinition |
||
| 43 | * |
||
| 44 | * @param array $columnDefinition |
||
| 45 | * @param TypeInterface $type |
||
| 46 | * @return static |
||
| 47 | */ |
||
| 48 | 89 | public static function factory($columnDefinition, TypeInterface $type) |
|
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | 3 | public function getName() |
|
| 63 | |||
| 64 | /** |
||
| 65 | * @return Type |
||
| 66 | */ |
||
| 67 | 67 | public function getType() |
|
| 71 | |||
| 72 | /** |
||
| 73 | * @return bool |
||
| 74 | */ |
||
| 75 | 10 | public function hasDefault() |
|
| 79 | |||
| 80 | /** |
||
| 81 | * @return bool |
||
| 82 | */ |
||
| 83 | 6 | public function isNullable() |
|
| 87 | } |
||
| 88 |