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

Application::modelPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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