| Total Complexity | 5 |
| Total Lines | 55 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class MigrationConfig extends InjectableConfig |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @internal This is an internal config section name. Please, do not use |
||
| 20 | * this constant. |
||
| 21 | */ |
||
| 22 | public const CONFIG = 'migration'; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @param array{directory?: string|null, table?: string|null, safe?: bool|null} $config |
||
| 26 | */ |
||
| 27 | public function __construct(array $config = []) |
||
| 28 | { |
||
| 29 | parent::__construct($config); |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Migrations directory. |
||
| 34 | * |
||
| 35 | * @return string |
||
| 36 | */ |
||
| 37 | public function getDirectory(): string |
||
| 38 | { |
||
| 39 | return $this->config['directory'] ?? ''; |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * Table to store list of executed migrations. |
||
| 44 | * |
||
| 45 | * @return string |
||
| 46 | */ |
||
| 47 | public function getTable(): string |
||
| 48 | { |
||
| 49 | return $this->config['table'] ?? 'migrations'; |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Is it safe to run migration without user confirmation? Attention, this option does not |
||
| 54 | * used in component directly and left for component consumers. |
||
| 55 | * |
||
| 56 | * @return bool |
||
| 57 | */ |
||
| 58 | public function isSafe(): bool |
||
| 59 | { |
||
| 60 | return $this->config['safe'] ?? false; |
||
| 61 | } |
||
| 62 | |||
| 63 | /** |
||
| 64 | * Namespace for generated migration class |
||
| 65 | * |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | public function getNamespace(): string |
||
| 71 | } |
||
| 72 | } |
||
| 73 |