1 | <?php namespace Codengine\CustomMigrations; |
||
11 | trait BatchMigrationTrait { |
||
12 | /** |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $migrationType = 'default'; |
||
16 | |||
17 | /** |
||
18 | * Extends the default options by type-option |
||
19 | * |
||
20 | * @return array |
||
21 | */ |
||
22 | protected function getOptions() |
||
23 | { |
||
24 | $optExtend = array( |
||
25 | array('type', null, InputOption::VALUE_OPTIONAL, 'The migration type to be executed.', 'default'), |
||
26 | ); |
||
27 | |||
28 | return array_merge(parent::getOptions(), $optExtend); |
||
29 | } |
||
30 | |||
31 | /** |
||
32 | * Filters the connections and only returns the ones that match the migration type |
||
33 | * |
||
34 | * @param array $connection The database connections |
||
35 | * @return bool Returns TRUE on a match, else FALSE |
||
36 | */ |
||
37 | protected function filterConnections($connection) |
||
47 | |||
48 | /** |
||
49 | * Returns the default DB connection |
||
50 | * |
||
51 | * @return array |
||
52 | */ |
||
53 | protected function getDefaultConnection() |
||
59 | |||
60 | /** |
||
61 | * Retrieves database connections by type |
||
62 | * |
||
63 | * @param null|string $filter When specified (--database option), only this connection will be checked |
||
64 | * @return array An array containing the matching connections |
||
65 | */ |
||
66 | protected function getConnectionsByType($filter = null) |
||
87 | |||
88 | /** |
||
89 | * Retrieves and sets the migration type |
||
90 | */ |
||
91 | protected function setMigrationType() |
||
95 | |||
96 | /** |
||
97 | * Run a batch migration on the specified connections |
||
98 | * |
||
99 | * @param array $connections |
||
100 | */ |
||
101 | protected function runMigrationsOnConnections($connections) |
||
113 | |||
114 | /** |
||
115 | * Default command override |
||
116 | */ |
||
117 | public function fire() |
||
128 | } |
The break statement is not necessary if it is preceded for example by a return statement:
If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.