HookListCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
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
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
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());
0 ignored issues
show
Security Debugging Code introduced by
var_dump($this->getHookService()->list()); looks like debug code. Are you sure you do not want to remove it? This might expose sensitive data.
Loading history...
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
}