Test Failed
Push — master ( cf589e...4e3804 )
by Grupo
02:17
created

Module::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: thales
5
 * Date: 24/11/2018
6
 * Time: 22:35
7
 */
8
9
namespace Saci\Console\Domain\Entity;
10
11
/**
12
 * Class Module
13
 * @package Saci\Domain\Entity
14
 * @covers \Test\Domain\Entity\ModuleTest
15
 */
16
class Module
17
{
18
19
    const DS = DIRECTORY_SEPARATOR;
20
    const ROOT = 'src';
21
    const APPLICATION = self::DS . 'Application';
22
    const USE_CASE = self::APPLICATION . self::DS . 'UseCase';
23
    const CONTROLLERS = self::USE_CASE . self::DS . 'Controllers';
24
    const COMMANDS = self::USE_CASE . self::DS . 'Commands';
25
    const DOMAIN = self::DS . 'Domain';
26
    const ENTITIES = self::DOMAIN . self::DS . 'Entities';
27
    const VO = self::DOMAIN . self::DS . 'ValueObjects';
28
    const EVENTS = self::DOMAIN . self::DS . 'Events';
29
    const REPOSITORIES = self::DOMAIN . self::DS . 'Repositories';
30
    const INFRASTRUCTURE =  self::DS . 'Infrastructure';
31
    const PERSISTENCE = self::INFRASTRUCTURE . self::DS . 'Persistence';
32
    const ORM = self::PERSISTENCE . self::DS . 'ORM';
33
    const DOCTRINE = self::ORM . self::DS . 'Doctrine';
34
    const MAPPING = self::DOCTRINE . self::DS . 'Mapping';
35
    const INFRASTRUCTURE_REPOSITORIES = self::DOCTRINE . self::DS . 'Repositories';
36
37
    private $name;
38
39
    private $paths = [
40
        self::CONTROLLERS,
41
        self::COMMANDS,
42
        self::ENTITIES,
43
        self::VO,
44
        self::EVENTS,
45
        self::REPOSITORIES,
46
        self::MAPPING,
47
        self::INFRASTRUCTURE_REPOSITORIES,
48
    ];
49
    /**
50
     * @var string
51
     */
52
    private $diretorio;
53
54
    public function __construct(string $name, string $diretorio)
55
    {
56
        $this->name = ucfirst(strtolower($name));
57
        $this->diretorio = $diretorio;
58
59
        foreach ($this->paths as &$path) {
60
            $path = $this->getDiretorio() . self::DS . self::ROOT . self::DS . $this->getName() . DIRECTORY_SEPARATOR . $path;
61
        }
62
63
    }
64
65
    /**
66
     * @return string
67
     */
68
    public function getName(): string
69
    {
70
        return $this->name;
71
    }
72
73
74
75
    public function getPaths(): array
76
    {
77
        return $this->paths;
78
    }
79
80
    public function getPathModule()
81
    {
82
        return $this->getDiretorio() . self::DS . self::ROOT . self::DS . $this->getName();
83
    }
84
85
    /**
86
     * @return string
87
     */
88
    public function getDiretorio(): string
89
    {
90
        return $this->diretorio;
91
    }
92
}