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