the closing brace of a class is on a separate line.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /** |
||
4 | * This file is part of Zenify |
||
5 | * Copyright (c) 2014 Tomas Votruba (http://tomasvotruba.cz) |
||
6 | */ |
||
7 | |||
8 | namespace Zenify\DoctrineMigrations\EventSubscriber; |
||
9 | |||
10 | use Doctrine\DBAL\Migrations\Tools\Console\Command\AbstractCommand; |
||
11 | use Symfony\Component\Console\Command\Command; |
||
12 | use Symfony\Component\Console\ConsoleEvents; |
||
13 | use Symfony\Component\Console\Event\ConsoleCommandEvent; |
||
14 | use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
||
15 | use Zenify\DoctrineMigrations\OutputWriter; |
||
16 | |||
17 | |||
18 | View Code Duplication | final class SetConsoleOutputEventSubscriber implements EventSubscriberInterface |
|
19 | { |
||
20 | |||
21 | /** |
||
22 | * @var OutputWriter |
||
23 | */ |
||
24 | private $outputWriter; |
||
25 | |||
26 | |||
27 | 6 | public function __construct(OutputWriter $outputWriter) |
|
28 | { |
||
29 | 6 | $this->outputWriter = $outputWriter; |
|
30 | 6 | } |
|
31 | |||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | 6 | public static function getSubscribedEvents() |
|
37 | { |
||
38 | 6 | return [ConsoleEvents::COMMAND => 'setOutputWriter']; |
|
39 | } |
||
40 | |||
41 | |||
42 | 6 | public function setOutputWriter(ConsoleCommandEvent $event) |
|
43 | { |
||
44 | 6 | $command = $event->getCommand(); |
|
45 | 6 | if ( ! $this->isMigrationCommand($command)) { |
|
46 | return; |
||
47 | } |
||
48 | |||
49 | 6 | $this->outputWriter->setConsoleOutput($event->getOutput()); |
|
50 | 6 | } |
|
51 | |||
52 | |||
53 | /** |
||
54 | * @return bool |
||
55 | */ |
||
56 | 6 | private function isMigrationCommand(Command $command) |
|
57 | { |
||
58 | 6 | return $command instanceof AbstractCommand; |
|
59 | } |
||
60 | |||
61 | } |
||
1 ignored issue
–
show
|
|||
62 |
Below you find some examples: