Connector::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 6
rs 10
cc 1
nc 1
nop 2
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\AConnector\Interfaces\Provider\Token\TokenProviderInterface;
18
19
/**
20
 * Class Instantiate
21
 * @package Ticaje\Connector\Command
22
 */
23
class Connector extends Command
24
{
25
    protected $tokenProvider;
26
27
    public function __construct(
28
        TokenProviderInterface $tokenProvider,
29
        string $name = null
30
    ) {
31
        $this->tokenProvider = $tokenProvider;
32
        parent::__construct($name);
33
    }
34
35
    protected function configure()
36
    {
37
        $this->setName("ticaje:test:connector");
38
        $this->setDescription("Test Connector Extension.");
39
        parent::configure();
40
    }
41
42
    protected function execute(InputInterface $input, OutputInterface $output)
43
    {
44
        $params = [
45
            'grant_type' => 'example',
46
            'scope' => 'example',
47
            'client_id' => 'example',
48
            'client_secret' => 'example',
49
            'username' => 'example'
50
        ];
51
        $token = $this->tokenProvider
52
            ->setParams($params)
53
            ->getAccessToken();
54
        $output->writeln($token);
55
    }
56
}
57