| Conditions | 4 |
| Paths | 5 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 25 | 6 | public function getMigrationDirectory(Configuration $configuration, string $dir) : string |
|
| 26 | { |
||
| 27 | 6 | $dir = rtrim($dir, '/'); |
|
| 28 | |||
| 29 | 6 | if (! file_exists($dir)) { |
|
| 30 | 1 | throw DirectoryDoesNotExist::new($dir); |
|
| 31 | } |
||
| 32 | |||
| 33 | 5 | if ($configuration->areMigrationsOrganizedByYear()) { |
|
| 34 | 2 | $dir .= $this->appendDir(date('Y')); |
|
| 35 | } |
||
| 36 | |||
| 37 | 5 | if ($configuration->areMigrationsOrganizedByYearAndMonth()) { |
|
| 38 | 1 | $dir .= $this->appendDir(date('m')); |
|
| 39 | } |
||
| 40 | |||
| 41 | 5 | $this->createDirIfNotExists($dir); |
|
| 42 | |||
| 43 | 5 | return $dir; |
|
| 44 | } |
||
| 45 | |||
| 60 |