Passed
Push[email protected] ( 356814...3dff17 )
by Bruno
20:21 queued 18:30
created

CreateWebhook::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 7
rs 10
1
<?php
2
/**
3
 * Copyright © Wirecard Brasil. All rights reserved.
4
 *
5
 * @author    Bruno Elisei <[email protected]>
6
 * See COPYING.txt for license details.
7
 */
8
9
declare(strict_types=1);
10
11
namespace Moip\Magento2\Console\Command\Preference;
12
13
use Magento\Framework\App\State;
0 ignored issues
show
Bug introduced by
The type Magento\Framework\App\State 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
use Moip\Magento2\Model\Console\Command\Preference\Create;
15
use Symfony\Component\Console\Command\Command;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Command\Command 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...
16
use Symfony\Component\Console\Input\InputArgument;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Console\Input\InputArgument 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...
17
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...
18
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...
19
20
class CreateWebhook extends Command
21
{
22
    const WEBHOOK_LINK = 'link';
23
24
    /**
25
     * Create.
26
     *
27
     * @var Moip\Magento2\Model\Console\Command\Preference\Create
0 ignored issues
show
Bug introduced by
The type Moip\Magento2\Console\Co...mmand\Preference\Create was not found. Did you mean Moip\Magento2\Model\Cons...mmand\Preference\Create? If so, make sure to prefix the type with \.
Loading history...
28
     */
29
    protected $create;
30
31
    /**
32
     * State.
33
     *
34
     * @var \Magento\Framework\App\State
35
     */
36
    protected $state;
37
38
    /**
39
     * CreateWebhook constructor.
40
     *
41
     * @param Create $create
42
     */
43
    public function __construct(
44
        State $state,
45
        Create $create
46
    ) {
47
        $this->state = $state;
48
        $this->create = $create;
0 ignored issues
show
Documentation Bug introduced by
It seems like $create of type Moip\Magento2\Model\Cons...mmand\Preference\Create is incompatible with the declared type Moip\Magento2\Console\Co...mmand\Preference\Create of property $create.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
49
        parent::__construct();
50
    }
51
52
    /**
53
     * {@inheritdoc}
54
     */
55
    protected function execute(
56
        InputInterface $input,
57
        OutputInterface $output
58
    ) {
59
        $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
0 ignored issues
show
Bug introduced by
The type Magento\Framework\App\Area 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...
60
        $this->create->setOutput($output);
61
62
        $link = $input->getArgument(self::WEBHOOK_LINK);
63
        $this->create->preference($link);
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     */
69
    protected function configure()
70
    {
71
        $this->setName('moip:webhooks:set_preference');
72
        $this->setDescription('Manually set the preferred url for Webhooks');
73
        $this->setDefinition(
74
            [new InputArgument(self::WEBHOOK_LINK, InputArgument::REQUIRED, 'Domain')]
75
        );
76
        parent::configure();
77
    }
78
}
79