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 | 149 | public function run($migration_file, MigrationContext $context) |
|
37 | { |
||
38 | 149 | $sqls = file_get_contents($migration_file); |
|
39 | 149 | $sqls = array_filter(preg_split('/;\s+/', $sqls)); |
|
40 | |||
41 | 149 | if ( !$sqls ) { |
|
42 | 1 | throw new \LogicException('The "' . basename($migration_file) . '" migration contains no SQL statements.'); |
|
43 | } |
||
44 | |||
45 | 148 | $db = $context->getDatabase(); |
|
46 | |||
47 | 148 | foreach ( $sqls as $sql ) { |
|
48 | 148 | $db->perform($sql); |
|
49 | 148 | } |
|
50 | 148 | } |
|
51 | |||
53 |