| Conditions | 8 |
| Paths | 12 |
| Total Lines | 36 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 3 | ||
| Bugs | 1 | Features | 2 |
| 1 | <?php |
||
| 30 | public function __construct($appConfig, Filesystem $filesystem) |
||
| 31 | { |
||
| 32 | if (!isset($appConfig['migrations'])) { |
||
| 33 | throw new RuntimeException("Missing migrations configuration"); |
||
| 34 | } |
||
| 35 | |||
| 36 | $options = $appConfig['migrations']; |
||
| 37 | |||
| 38 | if (!isset($options['dir'])) { |
||
| 39 | throw new RuntimeException("`dir` has not be specified in migrations configuration"); |
||
| 40 | } |
||
| 41 | |||
| 42 | $this->dir = $options['dir']; |
||
| 43 | |||
| 44 | if (!isset($options['namespace'])) { |
||
| 45 | throw new RuntimeException("`namespace` has not be specified in migrations configuration"); |
||
| 46 | } |
||
| 47 | |||
| 48 | $this->namespace = $options['namespace']; |
||
| 49 | |||
| 50 | if (!$filesystem->isDir($this->dir)) { |
||
| 51 | $filesystem->mkdir($this->dir, 0775); |
||
| 52 | } elseif (!$filesystem->isWritable($this->dir)) { |
||
| 53 | throw new RuntimeException(sprintf('Migrations directory is not writable %s', $this->dir)); |
||
| 54 | } |
||
| 55 | |||
| 56 | if (!isset($options['adapter'])) { |
||
| 57 | $options['adapter'] = 'Zend\Db\Adapter\Adapter'; |
||
| 58 | } |
||
| 59 | |||
| 60 | $this->adapter = $options['adapter']; |
||
| 61 | |||
| 62 | if (isset($options['show_log'])) { |
||
| 63 | $this->showLog = $options['show_log']; |
||
| 64 | } |
||
| 65 | } |
||
| 66 | |||
| 99 |