Conditions | 4 |
Paths | 5 |
Total Lines | 21 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php |
||
29 | 17 | public function getMigrationDirectory() : string |
|
30 | { |
||
31 | 17 | $dir = $this->configuration->getMigrationsDirectory(); |
|
32 | 17 | $dir = $dir ?? getcwd(); |
|
33 | 17 | $dir = rtrim($dir, '/'); |
|
34 | |||
35 | 17 | if (! file_exists($dir)) { |
|
36 | 1 | throw new InvalidArgumentException(sprintf('Migrations directory "%s" does not exist.', $dir)); |
|
37 | } |
||
38 | |||
39 | 16 | if ($this->configuration->areMigrationsOrganizedByYear()) { |
|
40 | 3 | $dir .= $this->appendDir(date('Y')); |
|
41 | } |
||
42 | |||
43 | 16 | if ($this->configuration->areMigrationsOrganizedByYearAndMonth()) { |
|
44 | 2 | $dir .= $this->appendDir(date('m')); |
|
45 | } |
||
46 | |||
47 | 16 | $this->createDirIfNotExists($dir); |
|
48 | |||
49 | 16 | return $dir; |
|
50 | } |
||
71 |