Passed
Push — master ( 6e383e...474390 )
by Hector Luis
09:38
created

Connector   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 22
c 1
b 0
f 0
dl 0
loc 40
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A configure() 0 5 1
A execute() 0 17 1
A __construct() 0 8 1
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * Command Class
6
 * @category    Ticaje
7
 * @package     Ticaje_Dummy
8
 * @author      Hector Luis Barrientos <[email protected]>
9
 */
10
11
namespace Ticaje\Dummy\Console\Command;
12
13
use Symfony\Component\Console\Command\Command;
14
use Symfony\Component\Console\Input\InputInterface;
15
use Symfony\Component\Console\Output\OutputInterface;
16
17
use Ticaje\Connector\Gateway\Client\Rest as RestClient;
0 ignored issues
show
Bug introduced by
The type Ticaje\Connector\Gateway\Client\Rest 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 Ticaje\Connector\Interfaces\ClientInterface;
0 ignored issues
show
Bug introduced by
The type Ticaje\Connector\Interfaces\ClientInterface 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
use Ticaje\Connector\Interfaces\Provider\Token\TokenProviderInterface;
0 ignored issues
show
Bug introduced by
The type Ticaje\Connector\Interfa...\TokenProviderInterface 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...
20
21
/**
22
 * Class Instantiate
23
 * @package Ticaje\Connector\Command
24
 */
25
class Connector extends Command
26
{
27
    protected $client;
28
29
    protected $tokenProvider;
30
31
    public function __construct(
32
        RestClient $client,
33
        TokenProviderInterface $tokenProvider,
34
        string $name = null
35
    ) {
36
        $this->client = $client;
37
        $this->tokenProvider = $tokenProvider;
38
        parent::__construct($name);
39
    }
40
41
    protected function configure()
42
    {
43
        $this->setName("ticaje:test:connector");
44
        $this->setDescription("Test Connector Extension.");
45
        parent::configure();
46
    }
47
48
    protected function execute(InputInterface $input, OutputInterface $output)
49
    {
50
        $credentials = [
51
            ClientInterface::BASE_URI_KEY => 'https://apiuat.evobanco.com:8443/'
52
        ];
53
        $params = [
54
            'grant_type' => 'onboarding',
55
            'scope' => 'otp',
56
            'client_id' => '5cd3375d-f845-4375-ab86-7d59b2363d9a',
57
            'client_secret' => 'dcad6955-dccb-4127-b964-b7a69f8a4e97',
58
            'username' => 'new_client'
59
        ];
60
        $token = $this->tokenProvider
61
            ->initialize($credentials)
62
            ->setParams($params)
63
            ->getAccessToken();
64
        $output->writeln($token);
65
    }
66
}
67