| 1 | <?php |
||
| 5 | abstract class MigrationFieldAbstract implements FieldTypeInterface |
||
| 6 | { |
||
| 7 | private $name; |
||
| 8 | |||
| 9 | private $nullable = false; |
||
| 10 | |||
| 11 | private $unique = false; |
||
| 12 | |||
| 13 | private $default = null; |
||
| 14 | |||
| 15 | private $foreign = null; |
||
| 16 | |||
| 17 | public function __construct(string $name, array $options = []) |
||
| 25 | |||
| 26 | private function fillObject(string $param) |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @return string |
||
| 49 | */ |
||
| 50 | public function getName() |
||
| 54 | |||
| 55 | /** |
||
| 56 | * @return string |
||
| 57 | */ |
||
| 58 | public function getType() |
||
| 62 | |||
| 63 | /** |
||
| 64 | * @return mixed |
||
| 65 | */ |
||
| 66 | public function getDefault() |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @return bool |
||
| 73 | */ |
||
| 74 | public function isNullable() |
||
| 78 | |||
| 79 | /** |
||
| 80 | * @return bool |
||
| 81 | */ |
||
| 82 | public function isUnique(): bool |
||
| 86 | |||
| 87 | abstract public function getRule(): string; |
||
| 88 | |||
| 89 | abstract public function getColumn(): array; |
||
| 90 | |||
| 91 | abstract public function getField(): array; |
||
| 92 | } |
||
| 93 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: