| Conditions | 3 |
| Paths | 3 |
| Total Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | 1 | public function buildMigrationFile( |
|
| 21 | array $queriesByVersion, |
||
| 22 | string $direction, |
||
| 23 | ?DateTimeInterface $now = null |
||
| 24 | ) : string { |
||
| 25 | 1 | $now = $now ?? new DateTimeImmutable(); |
|
| 26 | 1 | $string = sprintf("-- Doctrine Migration File Generated on %s\n", $now->format('Y-m-d H:i:s')); |
|
| 27 | |||
| 28 | 1 | foreach ($queriesByVersion as $version => $queries) { |
|
| 29 | 1 | $string .= "\n-- Version " . $version . "\n"; |
|
| 30 | |||
| 31 | 1 | foreach ($queries as $query) { |
|
| 32 | 1 | $string .= $query->getStatement() . ";\n"; |
|
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | 1 | return $string; |
|
| 37 | } |
||
| 38 | } |
||
| 39 |