| Conditions | 4 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | protected function getConnection(InputInterface $input) : Connection |
||
| 30 | { |
||
| 31 | /** @var string|null $connectionName */ |
||
| 32 | $connectionName = $input->getOption('connection'); |
||
| 33 | |||
| 34 | if ($this->connectionProvider === null) { |
||
| 35 | if ($connectionName !== null) { |
||
| 36 | throw new Exception('Specifying a connection is only supported when a ConnectionProvider is used.'); |
||
| 37 | } |
||
| 38 | |||
| 39 | return $this->getHelper('db')->getConnection(); |
||
| 40 | } |
||
| 41 | |||
| 42 | if ($connectionName !== null) { |
||
| 43 | return $this->connectionProvider->getConnection($connectionName); |
||
| 44 | } |
||
| 45 | |||
| 46 | return $this->connectionProvider->getDefaultConnection(); |
||
| 47 | } |
||
| 49 |