Issues (114)

src/Entities/Foundation.php (2 issues)

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\Concerns\WithFileNominator;
9
use Maestriam\Samurai\Foundation\FilenameParser;
10
use Maestriam\Samurai\Foundation\SyntaxValidator;
11
use Maestriam\Samurai\Foundation\DirectoryStructure;
12
13
class Foundation
14
{
15
    use WithFileNominator;
16
17
    /**
18
     * Classe auxiliar para gerenciamento de estrutura de diretórios
19
     * dentor do projeto
20
     *
21
     * @var DirectoryStructure
22
     */
23
    private $dir;
24
25
    /**
26
     * Classe auxiliar para criação de arquivos/diretórios
27
     * dentro do projeto
28
     *
29
     * @var FileSystem
30
     */
31
    private $file;
32
33
    /**
34
     * Classe auxiliar para validação de nome de diretivas/temas
35
     * e verificações de tipos
36
     *
37
     * @var SyntaxValidator
38
     */
39
    private $valid;
40
41
    /**
42
     * Instância do helper para atualizar arquivos .env
43
     *
44
     * @var EnvHandler
45
     */
46
    private $env;
47
48
    /**
49
     * Instância do helper para
50
     *
51
     * @var ConfigKeeper
52
     */
53
    private $config;
54
    
55
    /**
56
     * Instância do parser de filepath para objeto
57
     *
58
     * @var FilenameParser
59
     */
60
    private $parser;
61
62
    /**
63
     * Retorna uma instância auxiliar para 
64
     * tarefas de sistema de arquivos
65
     *
66
     * @return void
67
     */
68
    protected function file() : FileSystem
69
    {
70
        if ($this->file == null) {
71
            $this->file = new FileSystem();
72
        }
73
74
        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...
75
    }
76
77
    /**
78
     * Classe auxiliar para validar a sintaxe das informações preenchidas 
79
     * sobre o tema
80
     *
81
     * @return SyntaxValidator
82
     */
83
    protected function valid() : SyntaxValidator
84
    {
85
        if ($this->valid == null) {
86
            $this->valid = new SyntaxValidator();
87
        }
88
89
        return $this->valid;
90
    }
91
92
    /**
93
     * Classe auxiliar para  instância de RN sobre 
94
     * estrutura de pasta do tema
95
     *
96
     * @return DirectoryStructure
97
     */
98
    protected function dir() : DirectoryStructure
99
    {
100
        if ($this->dir == null) {
101
            $this->dir = new DirectoryStructure();
102
        }
103
104
        return $this->dir;
105
    }
106
107
    /**
108
     * Classe auxiliar para retorno das informações de configurações do pacote
109
     *
110
     * @return void
111
     */
112
    protected function config() : ConfigKeeper
113
    {
114
        if (! $this->config) {
115
            $this->config = new ConfigKeeper();
116
        }
117
118
        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...
119
    }
120
121
    /**
122
     * Classe auxiliar para identificar o nome e o tipo da diretiva, 
123
     * através de seu caminho absoluto
124
     *
125
     * @param  string $file
126
     * @return object|null
127
     */
128
    protected function parser() : FilenameParser
129
    {
130
        if ($this->parser == null) {
131
            $this->parser = new FilenameParser();
132
        }
133
134
        return $this->parser;
135
    }
136
    
137
    /**
138
     * Classe auxiliar para modificar o arquivo .env do projeto Laravel
139
     *
140
     * @return EnvHandler
141
     */
142
    protected function env() : EnvHandler
143
    {
144
        if (! $this->env) {
145
            $this->env = new EnvHandler();
146
        }
147
148
        return $this->env;
149
    }
150
}
151