| Conditions | 3 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 42 | 91 | protected function loadMigrations(array $files, ?string $namespace) : array |
|
| 43 | { |
||
| 44 | 91 | $migrations = []; |
|
| 45 | |||
| 46 | 91 | uasort($files, $this->getFileSortCallback()); |
|
| 47 | |||
| 48 | 91 | foreach ($files as $file) { |
|
| 49 | 35 | static::requireOnce($file); |
|
| 50 | 35 | $className = basename($file, '.php'); |
|
| 51 | 35 | $version = (string) substr($className, 7); |
|
| 52 | |||
| 53 | 35 | if ($version === '0') { |
|
| 54 | 1 | throw new InvalidArgumentException(sprintf( |
|
| 55 | 'Cannot load a migrations with the name "%s" because it is a reserved number by doctrine migrations' . PHP_EOL . |
||
| 56 | 1 | 'It\'s used to revert all migrations including the first one.', |
|
| 57 | 1 | $version |
|
| 58 | )); |
||
| 59 | } |
||
| 60 | |||
| 61 | 34 | $migrations[$version] = sprintf('%s\\%s', $namespace, $className); |
|
| 62 | } |
||
| 63 | |||
| 64 | 90 | return $migrations; |
|
| 65 | } |
||
| 74 |