Passed
Pull Request — main (#3)
by Chema
02:25
created

CallbackUrlCommand   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 18
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 4 1
A execute() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PhpLightning\Invoice\Infrastructure\Command;
6
7
use Gacela\Framework\DocBlockResolverAwareTrait;
8
use PhpLightning\Invoice\InvoiceFacade;
9
use Symfony\Component\Console\Command\Command;
10
use Symfony\Component\Console\Input\InputInterface;
11
use Symfony\Component\Console\Output\OutputInterface;
12
13
/**
14
 * @method InvoiceFacade getFacade()
15
 */
16
final class CallbackUrlCommand extends Command
17
{
18
    use DocBlockResolverAwareTrait;
19
20 1
    protected function configure(): void
21
    {
22 1
        $this->setName('callback-url')
23 1
            ->setDescription('Get a callback_url');
24
    }
25
26 1
    protected function execute(InputInterface $input, OutputInterface $output): int
27
    {
28 1
        $callbackUrl = $this->getFacade()->getCallbackUrl();
29
30 1
        $json = json_encode($callbackUrl, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT);
31 1
        $output->writeln($json);
32
33 1
        return self::SUCCESS;
34
    }
35
}
36