Conditions | 4 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 4.0218 |
Changes | 0 |
1 | <?php |
||
36 | 14 | public function chosen() : ?Connection |
|
37 | { |
||
38 | 14 | if ($this->filename === null) { |
|
39 | 13 | return null; |
|
40 | } |
||
41 | |||
42 | 14 | if (! file_exists($this->filename)) { |
|
43 | 13 | return null; |
|
44 | } |
||
45 | |||
46 | 1 | $params = include $this->filename; |
|
47 | |||
48 | 1 | if (! is_array($params)) { |
|
49 | throw InvalidConfiguration::invalidArrayConfiguration(); |
||
50 | } |
||
51 | |||
52 | 1 | return DriverManager::getConnection($params); |
|
53 | } |
||
55 |