Conditions | 2 |
Paths | 4 |
Total Lines | 23 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
29 | 39 | public function __construct( |
|
30 | array $connections, |
||
31 | public readonly array $options, |
||
32 | ) { |
||
33 | 39 | $opts = new Opts(); |
|
34 | |||
35 | try { |
||
36 | 39 | $key = $opts->get('--conn', 'default'); |
|
37 | assert(isset($connections[$key])); |
||
38 | 39 | $this->conn = $connections[$key]; |
|
1 ignored issue
–
show
|
|||
39 | 1 | } catch (Throwable) { |
|
40 | 1 | $key = $key ?? '<undefied>'; |
|
41 | |||
42 | 1 | throw new RuntimeException("Connection '{$key}' does not exist"); |
|
43 | } |
||
44 | |||
45 | 38 | $this->showStacktrace = $opts->has('--stacktrace'); |
|
1 ignored issue
–
show
|
|||
46 | 38 | $this->db = new Database($this->conn); |
|
1 ignored issue
–
show
|
|||
47 | 38 | $this->driver = $this->conn->driver; |
|
1 ignored issue
–
show
|
|||
48 | 38 | $this->convenience = in_array($this->driver, ['sqlite', 'mysql', 'pgsql']); |
|
1 ignored issue
–
show
|
|||
49 | 38 | $this->table = $this->conn->migrationsTable(); |
|
1 ignored issue
–
show
|
|||
50 | 38 | $this->columnMigration = $this->conn->migrationsColumnMigration(); |
|
1 ignored issue
–
show
|
|||
51 | 38 | $this->columnApplied = $this->conn->migrationsColumnApplied(); |
|
1 ignored issue
–
show
|
|||
52 | } |
||
167 |