Completed
Push — master ( bd02ec...4ff445 )
by Dmytro
04:14
created

LoadTestDataCommand::execute()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Webhook\Bundle\Command;
5
6
7
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
8
use Symfony\Component\Console\Input\InputInterface;
9
use Symfony\Component\Console\Output\OutputInterface;
10
use Webhook\Bundle\Repository\WebhookRepository;
11
use Webhook\Domain\Model\Webhook;
12
13
/**
14
 * Class LoadTestData
15
 *
16
 * @package Webhook\Bundle\Command
17
 */
18
class LoadTestDataCommand extends ContainerAwareCommand
19
{
20
    protected function configure()
21
    {
22
        $this->setName('webhooks:load:data');
23
    }
24
25
    /**
26
     * @param InputInterface $input
27
     * @param OutputInterface $output
28
     * @return int|null|void
29
     */
30
    protected function execute(InputInterface $input, OutputInterface $output)
31
    {
32
        /** @var WebhookRepository $repository */
33
        $repository = $this->getContainer()->get('webhook.repository');
34
35
        for ($i = 1; $i <= 100; $i++) {
36
            $webhook = new Webhook('http://httpbin.org/status/200', 'body');
37
            $repository->save($webhook);
38
        }
39
    }
40
}