| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 10 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 36 | 2 | public function run($migration_file, MigrationContext $context) |
|
| 37 | { |
||
| 38 | 2 | $sqls = file_get_contents($migration_file); |
|
| 39 | 2 | $sqls = array_filter(preg_split('/;\s+/', $sqls)); |
|
| 40 | |||
| 41 | 2 | if ( !$sqls ) { |
|
| 42 | 1 | throw new \LogicException('The "' . basename($migration_file) . '" migration contains no SQL statements.'); |
|
| 43 | } |
||
| 44 | |||
| 45 | 1 | $db = $context->getDatabase(); |
|
| 46 | |||
| 47 | 1 | foreach ( $sqls as $sql ) { |
|
| 48 | 1 | $db->perform($sql); |
|
| 49 | 1 | } |
|
| 50 | 1 | } |
|
| 51 | |||
| 53 |