1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Created by Graham Owens ([email protected]) |
5
|
|
|
* Company: PartFire Ltd (www.partfire.co.uk) |
6
|
|
|
* Console: Discovery |
7
|
|
|
* |
8
|
|
|
* User: gra |
9
|
|
|
* Date: 13/01/17 |
10
|
|
|
* Time: 16:23 |
11
|
|
|
* Project: PartFire MangoPay Bundle |
12
|
|
|
* File: HookListCommand.php |
13
|
|
|
* |
14
|
|
|
**/ |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
namespace PartFire\MangoPayBundle\Command; |
18
|
|
|
|
19
|
|
|
use Fruitful\IdentityCheckBundle\Entity\IdentityCheck; |
20
|
|
|
use Fruitful\IdentityCheckBundle\Entity\Repository\IdentityCheckFactoryRepository; |
21
|
|
|
use Fruitful\IdentityCheckBundle\Event\IdentityCheckUpdateEvent; |
22
|
|
|
use PartFire\CommonBundle\Services\Output\Cli\ConsoleOutput; |
23
|
|
|
use PartFire\MangoPayBundle\Services\Hook; |
24
|
|
|
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
25
|
|
|
use Symfony\Component\Console\Input\InputArgument; |
26
|
|
|
use Symfony\Component\Console\Input\InputDefinition; |
27
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
28
|
|
|
use Symfony\Component\Console\Input\InputOption; |
29
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
30
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcher; |
31
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
32
|
|
|
|
33
|
|
View Code Duplication |
class HookListCommand extends ContainerAwareCommand |
|
|
|
|
34
|
|
|
{ |
35
|
|
|
|
36
|
|
|
private $output; |
37
|
|
|
|
38
|
|
|
protected function configure() |
39
|
|
|
{ |
40
|
|
|
$this |
41
|
|
|
->setName('partfire:mangopay:hook-list') |
42
|
|
|
->setDescription('Shows all hooks registered in Mango') |
43
|
|
|
; |
44
|
|
|
|
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
48
|
|
|
{ |
49
|
|
|
$this->output = $this->getConsoleOutPutter(); |
50
|
|
|
$this->output->setOutputer($output); |
51
|
|
|
|
52
|
|
|
$this->output->info("Listing all hooks with MangoPay"); |
53
|
|
|
var_dump($this->getHookService()->list()); |
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
private function showTitle($title) |
57
|
|
|
{ |
58
|
|
|
$this->output->info(str_pad(" " . $title . " ", 80, "-", STR_PAD_BOTH)); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
private function getConsoleOutPutter() : ConsoleOutput |
62
|
|
|
{ |
63
|
|
|
return $this->getContainer()->get('partfire_common.output_console'); |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
private function getHookService() : Hook |
67
|
|
|
{ |
68
|
|
|
return $this->getContainer()->get('part_fire_mango_pay.services.hook'); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
} |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.