Passed
Push — feature/eco-2295/eco-2344-crea... ( 6ac028...83a5ab )
by Aleksey
01:13
created

RefundCallConsole   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 4 1
A configure() 0 7 1
A createRequestTransfer() 0 5 1
1
<?php
2
3
/**
4
 * Copyright © 2016-present Spryker Systems GmbH. All rights reserved.
5
 * Use of this software requires acceptance of the Evaluation License Agreement. See LICENSE file.
6
 */
7
8
namespace SprykerEco\Zed\CrefoPayApi\Communication\Console;
9
10
use Generated\Shared\Transfer\CrefoPayApiRequestTransfer;
0 ignored issues
show
Bug introduced by
The type Generated\Shared\Transfe...foPayApiRequestTransfer was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Spryker\Zed\Kernel\Communication\Console\Console;
0 ignored issues
show
Bug introduced by
The type Spryker\Zed\Kernel\Communication\Console\Console was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use Symfony\Component\Console\Input\InputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Input\InputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use Symfony\Component\Console\Output\OutputInterface;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Output\OutputInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
15
/**
16
 * @method \SprykerEco\Zed\CrefoPayApi\Business\CrefoPayApiFacadeInterface getFacade()
17
 * @method \SprykerEco\Zed\CrefoPayApi\Communication\CrefoPayApiCommunicationFactory getFactory()
18
 */
19
class RefundCallConsole extends Console
20
{
21
    public const COMMAND_NAME = 'crefo-pay-api:refund';
22
    public const COMMAND_DESCRIPTION = 'Perform Refund API call to CrefoPay';
23
24
    /**
25
     * @return void
26
     */
27
    protected function configure()
28
    {
29
        parent::configure();
30
        $this
31
            ->setName(static::COMMAND_NAME)
32
            ->setDescription(static::COMMAND_DESCRIPTION)
33
            ->setHelp('<info>' . static::COMMAND_NAME . ' -h</info>');
34
    }
35
36
    /**
37
     * @param \Symfony\Component\Console\Input\InputInterface $input
38
     * @param \Symfony\Component\Console\Output\OutputInterface $output
39
     *
40
     * @return void
41
     */
42
    public function execute(InputInterface $input, OutputInterface $output)
43
    {
44
        $response = $this->getFacade()->performRefundApiCall($this->createRequestTransfer());
45
        echo json_encode($response->toArray(true, true), JSON_PRETTY_PRINT);
46
    }
47
48
    protected function createRequestTransfer(): CrefoPayApiRequestTransfer
49
    {
50
        $request = new CrefoPayApiRequestTransfer();
51
52
        return $request;
53
    }
54
}
55