Passed
Push — master ( ed297f...604ea4 )
by Giuliano
04:39
created

Foundation   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 156
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 29
c 0
b 0
f 0
dl 0
loc 156
rs 10
wmc 14

7 Methods

Rating   Name   Duplication   Size   Complexity  
A env() 0 7 2
A nominator() 0 7 2
A dir() 0 7 2
A valid() 0 7 2
A parser() 0 7 2
A file() 0 7 2
A config() 0 7 2
1
<?php
2
3
namespace Maestriam\Samurai\Entities;
4
5
use Maestriam\Samurai\Foundation\ConfigKeeper;
6
use Maestriam\Samurai\Foundation\EnvHandler;
7
use Maestriam\Samurai\Foundation\FileSystem;
8
use Maestriam\Samurai\Foundation\FileNominator;
9
use Maestriam\Samurai\Foundation\FilenameParser;
10
use Maestriam\Samurai\Foundation\SyntaxValidator;
11
use Maestriam\Samurai\Foundation\DirectoryStructure;
12
13
class Foundation
14
{
15
    /**
16
     * Classe auxiliar para gerenciamento de estrutura de diretórios
17
     * dentor do projeto
18
     *
19
     * @var DirectoryStructure
20
     */
21
    private $dir;
22
23
    /**
24
     * Classe auxiliar para criação de arquivos/diretórios
25
     * dentro do projeto
26
     *
27
     * @var FileSystem
28
     */
29
    private $file;
30
31
    /**
32
     * Classe auxiliar para validação de nome de diretivas/temas
33
     * e verificações de tipos
34
     *
35
     * @var SyntaxValidator
36
     */
37
    private $valid;
38
39
    /**
40
     * Classe auxiliar para nomeação de diretivas/namespaces
41
     * de acordo com as regras negócios do Blade
42
     *
43
     * @var FileNominator
44
     */
45
    private $nominator;
46
47
    /**
48
     * Instância do helper para atualizar arquivos .env
49
     *
50
     * @var EnvHandler
51
     */
52
    private $env;
53
54
    /**
55
     * Instância do helper para
56
     *
57
     * @var ConfigKeeper
58
     */
59
    private $config;
60
    
61
    /**
62
     * Instância do parser de filepath para objeto
63
     *
64
     * @var FilenameParser
65
     */
66
    private $parser;
67
68
    /**
69
     * Retorna uma instância auxiliar para 
70
     * tarefas de sistema de arquivos
71
     *
72
     * @return void
73
     */
74
    protected function file() : FileSystem
75
    {
76
        if ($this->file == null) {
77
            $this->file = new FileSystem();
78
        }
79
80
        return $this->file;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->file returns the type Maestriam\Samurai\Foundation\FileSystem which is incompatible with the documented return type void.
Loading history...
81
    }
82
83
    /**
84
     * Classe auxiliar para validar a sintaxe das informações preenchidas 
85
     * sobre o tema
86
     *
87
     * @return SyntaxValidator
88
     */
89
    protected function valid() : SyntaxValidator
90
    {
91
        if ($this->valid == null) {
92
            $this->valid = new SyntaxValidator();
93
        }
94
95
        return $this->valid;
96
    }
97
98
    /**
99
     * Classe auxiliar para  instância de RN sobre 
100
     * estrutura de pasta do tema
101
     *
102
     * @return DirectoryStructure
103
     */
104
    protected function dir() : DirectoryStructure
105
    {
106
        if ($this->dir == null) {
107
            $this->dir = new DirectoryStructure();
108
        }
109
110
        return $this->dir;
111
    }
112
113
    /**
114
     * Classe auxiliar para retorno das informações de configurações do pacote
115
     *
116
     * @return void
117
     */
118
    protected function config() : ConfigKeeper
119
    {
120
        if (! $this->config) {
121
            $this->config = new ConfigKeeper();
122
        }
123
124
        return $this->config;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->config returns the type Maestriam\Samurai\Foundation\ConfigKeeper which is incompatible with the documented return type void.
Loading history...
125
    }
126
127
    /**
128
     * Classe auxiliar para identificar o nome e o tipo da diretiva, 
129
     * através de seu caminho absoluto
130
     *
131
     * @param  string $file
132
     * @return object|null
133
     */
134
    protected function parser() : FilenameParser
135
    {
136
        if ($this->parser == null) {
137
            $this->parser = new FilenameParser();
138
        }
139
140
        return $this->parser;
141
    }
142
    
143
    /**
144
     * Classe auxiliar para modificar o arquivo .env do projeto Laravel
145
     *
146
     * @return EnvHandler
147
     */
148
    protected function env() : EnvHandler
149
    {
150
        if (! $this->env) {
151
            $this->env = new EnvHandler();
152
        }
153
154
        return $this->env;
155
    }
156
157
    /**
158
     * Classe auxiliar para interação sobre
159
     *
160
     * @return FileNominator
161
     */
162
    protected function nominator() : FileNominator
163
    {
164
        if ($this->nominator == null) {
165
            $this->nominator = new FileNominator();
166
        }
167
168
        return $this->nominator;
169
    }
170
}
171