WebHookDispatchCommand::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 8
loc 8
rs 9.4285
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
/**
3
 * Created by Graham Owens ([email protected])
4
 * Company: PartFire Ltd (www.partfire.co.uk)
5
 * Console: Discovery
6
 *
7
 * User:    gra
8
 * Date:    20/01/17
9
 * Time:    16:04
10
 * Project: PartFire MangoPay Bundle
11
 * File:    WebHookDispatchCommand.php
12
 *
13
 **/
14
15
namespace PartFire\MangoPayBundle\Command;
16
17
use Fruitful\IdentityCheckBundle\Entity\IdentityCheck;
18
use Fruitful\IdentityCheckBundle\Entity\Repository\IdentityCheckFactoryRepository;
19
use Fruitful\IdentityCheckBundle\Event\IdentityCheckUpdateEvent;
20
use PartFire\CommonBundle\Services\Output\Cli\ConsoleOutput;
21
use PartFire\MangoPayBundle\Services\Hook;
22
use PartFire\MangoPayBundle\Services\HookHandleService;
23
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
24
use Symfony\Component\Console\Input\InputArgument;
25
use Symfony\Component\Console\Input\InputDefinition;
26
use Symfony\Component\Console\Input\InputInterface;
27
use Symfony\Component\Console\Input\InputOption;
28
use Symfony\Component\Console\Output\OutputInterface;
29
use Symfony\Component\EventDispatcher\EventDispatcher;
30
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
31
32 View Code Duplication
class WebHookDispatchCommand 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...
33
{
34
35
    private $output;
36
37
    protected function configure()
38
    {
39
        $this
40
            ->setName('partfire:mangopay:webhook-dispatch')
41
            ->setDescription('Checks for new hooks and dispatches them')
42
        ;
43
44
    }
45
46
    protected function execute(InputInterface $input, OutputInterface $output)
47
    {
48
        $this->output = $this->getConsoleOutPutter();
49
        $this->output->setOutputer($output);
50
51
        $this->output->info("Checking for new MangoPay Hooks");
52
        $this->getPartFireMangoPayService()->processNewWebhooks($this->output);
53
    }
54
55
    private function showTitle($title)
56
    {
57
        $this->output->info(str_pad(" " . $title . " ", 80, "-", STR_PAD_BOTH));
58
    }
59
60
    private function getConsoleOutPutter() : ConsoleOutput
61
    {
62
        return $this->getContainer()->get('partfire_common.output_console');
63
    }
64
65
    private function getPartFireMangoPayService() : HookHandleService
66
    {
67
        return $this->getContainer()->get('part_fire_mango_pay.services.webhook');
68
    }
69
70
}