Completed
Push — master ( a10e7d...7e29e1 )
by Pascal
02:58
created

Application::modelPath()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
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
    public function __construct($name = "Atog.Simple-Api-Client", $version = "v1.0")
29
    {
30
        parent::__construct($name, $version);
31
32
        // set paths
33
        $sep = DIRECTORY_SEPARATOR;
34
        $this->basePath = __DIR__ . "$sep..$sep..$sep";
35
        $this->dirs['endpoint'] = "src{$sep}Endpoints";
36
        $this->dirs['model'] = "src{$sep}Models";
37
38
        // add commands
39
        $this->add(new EndpointCommand());
40
        $this->add(new ModelCommand());
41
    }
42
43
    /**
44
     * @param string $path
45
     * @return string
46
     */
47
    public function endpointPath($path = "")
48
    {
49
        return $this->basePath . $this->dirs['endpoint'] . DIRECTORY_SEPARATOR . $path;
50
    }
51
52
    /**
53
     * @param string $path
54
     * @return string
55
     */
56
    public function modelPath($path = "")
57
    {
58
        return $this->basePath . $this->dirs['model'] . DIRECTORY_SEPARATOR . $path;
59
    }
60
}
61