Completed
Push — master ( 6077fa...f4e20a )
by Pascal
02:40
created

Application   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 53
ccs 13
cts 13
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 14 1
A endpointPath() 0 4 1
A modelPath() 0 4 1
1
<?php
2
namespace Atog\Api\Console;
3
4
/**
5
 * Class EndpointCommand
6
 * @package Atog\Console
7
 */
8
class Application extends \Symfony\Component\Console\Application
9
{
10
    /**
11
     * @var string
12
     */
13
    protected $basePath;
14
15
    /**
16
     * @var array
17
     */
18
    protected $dirs = [
19
        'endpoint'  => '',
20
        'model'     => ''
21
    ];
22
23
    /**
24
     * Application constructor.
25
     * @param string $name
26
     * @param string $version
27
     */
28 4
    public function __construct($name = "Atog.Simple-Api-Client", $version = "v1.0")
29
    {
30 4
        parent::__construct($name, $version);
31
32
        // set paths
33 4
        $sep = DIRECTORY_SEPARATOR;
34 4
        $this->basePath = __DIR__ . "$sep..$sep..$sep";
35 4
        $this->dirs['endpoint'] = "src{$sep}Endpoints";
36 4
        $this->dirs['model'] = "src{$sep}Models";
37
38
        // add commands
39 4
        $this->add(new EndpointCommand());
40 4
        $this->add(new ModelCommand());
41 4
    }
42
43
    /**
44
     * @param string $path
45
     * @return string
46
     */
47 2
    public function endpointPath($path = "")
48
    {
49 2
        return $this->basePath . $this->dirs['endpoint'] . DIRECTORY_SEPARATOR . $path;
50
    }
51
52
    /**
53
     * @param string $path
54
     * @return string
55
     */
56 2
    public function modelPath($path = "")
57
    {
58 2
        return $this->basePath . $this->dirs['model'] . DIRECTORY_SEPARATOR . $path;
59
    }
60
}
61