Passed
Push — master ( 50d08e...d7dc61 )
by
unknown
02:43
created

HookCreateAllCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
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:    16/01/17
9
 * Time:    16:11
10
 * Project: PartFire MangoPay Bundle
11
 * File:    HookCreateAllCommand.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\MangoPayConstants;
22
use PartFire\MangoPayBundle\Services\Hook;
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
class HookCreateAllCommand extends ContainerAwareCommand
33
{
34
35
    private $output;
36
37
    protected function configure()
38
    {
39
        $this
40
            ->setName('partfire:mangopay:hook-create-all')
41
            ->setDescription('Points all known hooks to a single endpoint')
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("Create all hooks to point to a single end point");
52
53
        foreach (MangoPayConstants::getAllEventTypes() as $eventType) {
54
            $this->output->infoid("Creating end point for " . $eventType);
55
        }
56
    }
57
58
    private function showTitle($title)
59
    {
60
        $this->output->info(str_pad(" " . $title . " ", 80, "-", STR_PAD_BOTH));
61
    }
62
63
    private function getConsoleOutPutter() : ConsoleOutput
64
    {
65
        return $this->getContainer()->get('partfire_common.output_console');
66
    }
67
68
    private function getHookService() : Hook
69
    {
70
        return $this->getContainer()->get('part_fire_mango_pay.services.hook');
71
    }
72
73
}