| Conditions | 5 |
| Paths | 8 |
| Total Lines | 23 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 28 | 3 | public function create(OutputInterface $output = null) |
|
| 29 | { |
||
| 30 | 3 | $error = false; |
|
| 31 | 3 | $outputTmp = new NullOutput(); |
|
| 32 | |||
| 33 | // SF 2.3 does not have BufferedOutput |
||
| 34 | 3 | if (class_exists('Symfony\Component\Console\Output\BufferedOutput')) { |
|
| 35 | 3 | $outputTmp = new BufferedOutput(OutputInterface::VERBOSITY_NORMAL, true); |
|
| 36 | } |
||
| 37 | |||
| 38 | try { |
||
| 39 | 3 | $this->executor->execute('doctrine:database:drop --force', $outputTmp); |
|
| 40 | 1 | } catch (\RuntimeException $e) { |
|
| 41 | // catches an error if database does not exist |
||
| 42 | 1 | $error = true; |
|
| 43 | } |
||
| 44 | |||
| 45 | 3 | if (! $error && method_exists($outputTmp, 'fetch')) { |
|
| 46 | 2 | $output->write($outputTmp->fetch()); |
|
| 47 | } |
||
| 48 | |||
| 49 | 3 | $this->executor->execute('doctrine:database:create', $output); |
|
| 50 | 3 | } |
|
| 51 | } |
||
| 52 |