Completed
Push — master ( 969e0b...dd25b7 )
by Gilmar
21:18
created

Application   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
c 2
b 0
f 0
lcom 0
cbo 2
dl 0
loc 46
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getLogFilePath() 0 4 1
A factorySdk() 0 6 1
A appendCommand() 0 6 1
1
<?php
2
3
/*
4
 * This file is part of gpupo component
5
 * Created by Gilmar Pupo <[email protected]>
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 * For more information, see <http://www.g1mr.com/>.
9
 */
10
namespace Gpupo\NetshoesSdk\Console;
11
12
use Gpupo\CommonSdk\Console\AbstractApplication;
13
use Gpupo\NetshoesSdk\Factory;
14
15
class Application extends AbstractApplication
16
{
17
    protected $commonParameters = [
18
        [
19
            'key' => 'client_id',
20
        ],
21
        [
22
            'key' => 'access_token',
23
        ],
24
        [
25
            'key'     => 'env',
26
            'options' => ['sandbox', 'api'],
27
            'default' => 'sandbox',
28
            'name'    => 'Version',
29
        ],
30
        [
31
            'key'     => 'sslVersion',
32
            'options' => ['SecureTransport', 'TLS'],
33
            'default' => 'SecureTransport',
34
            'name'    => 'SSL Version',
35
        ],
36
        [
37
            'key'     => 'registerPath',
38
            'default' => false,
39
        ]
40
    ];
41
42
    protected function getLogFilePath()
43
    {
44
        return 'var/logs/console.log';
45
    }
46
47
    public function factorySdk(array $options)
48
    {
49
        $options['version'] = $options['env'];
50
51
        return  Factory::getInstance()->setup($options, $this->factoryLogger());
52
    }
53
54
    public function appendCommand($name, $description, array $definition = [])
55
    {
56
        return $this->register($name)
57
            ->setDescription($description)
58
            ->setDefinition($this->factoryDefinition($definition));
59
    }
60
}
61