@@ -647,7 +647,7 @@ |
||
647 | 647 | } |
648 | 648 | |
649 | 649 | return ($action === 'encrypt') ? base64_encode($return) : $return; |
650 | - // On renvoie la chaine encrypter ou decrypter |
|
650 | + // On renvoie la chaine encrypter ou decrypter |
|
651 | 651 | } |
652 | 652 | |
653 | 653 | /** |
@@ -82,9 +82,9 @@ |
||
82 | 82 | */ |
83 | 83 | public function setMethods(?array $methods): self |
84 | 84 | { |
85 | - if (is_array($methods)) { |
|
86 | - $this->methods = $methods; |
|
87 | - } |
|
85 | + if (is_array($methods)) { |
|
86 | + $this->methods = $methods; |
|
87 | + } |
|
88 | 88 | |
89 | 89 | return $this; |
90 | 90 | } |
@@ -25,49 +25,49 @@ discard block |
||
25 | 25 | */ |
26 | 26 | private static array $loaded = []; |
27 | 27 | |
28 | - /** |
|
29 | - * Drapeau permettant de savoir si la config a deja ete initialiser |
|
30 | - */ |
|
31 | - private static bool $initialized = false; |
|
28 | + /** |
|
29 | + * Drapeau permettant de savoir si la config a deja ete initialiser |
|
30 | + */ |
|
31 | + private static bool $initialized = false; |
|
32 | 32 | |
33 | - private Configurator $configurator; |
|
33 | + private Configurator $configurator; |
|
34 | 34 | |
35 | 35 | public function __construct() |
36 | 36 | { |
37 | - $this->configurator = new Configurator(); |
|
38 | - $this->initialize(); |
|
37 | + $this->configurator = new Configurator(); |
|
38 | + $this->initialize(); |
|
39 | 39 | } |
40 | 40 | |
41 | - /** |
|
41 | + /** |
|
42 | 42 | * Détermine si une clé de configuration existe. |
43 | 43 | */ |
44 | - public function exists(string $key): bool |
|
45 | - { |
|
46 | - if (! $this->configurator->exists($key)) { |
|
47 | - $config = explode('.', $key); |
|
48 | - $this->load($config[0]); |
|
44 | + public function exists(string $key): bool |
|
45 | + { |
|
46 | + if (! $this->configurator->exists($key)) { |
|
47 | + $config = explode('.', $key); |
|
48 | + $this->load($config[0]); |
|
49 | 49 | |
50 | - return $this->configurator->exists(implode('.', $config)); |
|
51 | - } |
|
50 | + return $this->configurator->exists(implode('.', $config)); |
|
51 | + } |
|
52 | 52 | |
53 | - return true; |
|
54 | - } |
|
53 | + return true; |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
56 | + /** |
|
57 | 57 | * Détermine s'il y'a une clé de configuration. |
58 | 58 | */ |
59 | - public function has(string $key): bool |
|
60 | - { |
|
61 | - return $this->exists($key); |
|
62 | - } |
|
59 | + public function has(string $key): bool |
|
60 | + { |
|
61 | + return $this->exists($key); |
|
62 | + } |
|
63 | 63 | |
64 | - /** |
|
64 | + /** |
|
65 | 65 | * Détermine s'il manque une clé de configuration. |
66 | 66 | */ |
67 | - public function missing(string $key): bool |
|
68 | - { |
|
69 | - return ! $this->exists($key); |
|
70 | - } |
|
67 | + public function missing(string $key): bool |
|
68 | + { |
|
69 | + return ! $this->exists($key); |
|
70 | + } |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Renvoyer une configuration de l'application |
@@ -80,21 +80,21 @@ discard block |
||
80 | 80 | return $this->configurator->get($key); |
81 | 81 | } |
82 | 82 | |
83 | - if (func_num_args() > 1) { |
|
84 | - return $default; |
|
85 | - } |
|
83 | + if (func_num_args() > 1) { |
|
84 | + return $default; |
|
85 | + } |
|
86 | 86 | |
87 | - $path = explode('.', $key); |
|
87 | + $path = explode('.', $key); |
|
88 | 88 | |
89 | - throw ConfigException::notFound(implode(' » ', $path)); |
|
90 | - } |
|
89 | + throw ConfigException::notFound(implode(' » ', $path)); |
|
90 | + } |
|
91 | 91 | |
92 | 92 | /** |
93 | 93 | * Définir une configuration de l'application |
94 | 94 | */ |
95 | 95 | public function set(string $key, $value) |
96 | 96 | { |
97 | - $this->configurator->set($key, $value); |
|
97 | + $this->configurator->set($key, $value); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | $schema = self::schema($config); |
133 | 133 | } |
134 | 134 | |
135 | - $this->configurator->addSchema($config, $schema, false); |
|
136 | - $this->configurator->merge([$config => (array) $configurations]); |
|
135 | + $this->configurator->addSchema($config, $schema, false); |
|
136 | + $this->configurator->merge([$config => (array) $configurations]); |
|
137 | 137 | |
138 | 138 | self::$loaded[$config] = $file; |
139 | 139 | } |
@@ -163,17 +163,17 @@ discard block |
||
163 | 163 | { |
164 | 164 | $path = preg_replace('#\.php$#', '', $path); |
165 | 165 | |
166 | - if (file_exists($file = CONFIG_PATH . $path . '.php')) { |
|
167 | - return $file; |
|
168 | - } |
|
166 | + if (file_exists($file = CONFIG_PATH . $path . '.php')) { |
|
167 | + return $file; |
|
168 | + } |
|
169 | 169 | |
170 | - $paths = Services::locator()->search('Config/' . $path); |
|
170 | + $paths = Services::locator()->search('Config/' . $path); |
|
171 | 171 | |
172 | - if (isset($paths[0]) && file_exists($path[0])) { |
|
173 | - return $paths[0]; |
|
174 | - } |
|
172 | + if (isset($paths[0]) && file_exists($path[0])) { |
|
173 | + return $paths[0]; |
|
174 | + } |
|
175 | 175 | |
176 | - return ''; |
|
176 | + return ''; |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | */ |
204 | 204 | private function initialize() |
205 | 205 | { |
206 | - if (self::$initialized) { |
|
207 | - return; |
|
208 | - } |
|
206 | + if (self::$initialized) { |
|
207 | + return; |
|
208 | + } |
|
209 | 209 | |
210 | - $this->load(['app']); |
|
210 | + $this->load(['app']); |
|
211 | 211 | |
212 | 212 | ini_set('log_errors', 1); |
213 | 213 | ini_set('error_log', LOG_PATH . 'blitz-logs'); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $this->initializeEnvironment(); |
217 | 217 | $this->initializeDebugbar(); |
218 | 218 | |
219 | - self::$initialized = true; |
|
219 | + self::$initialized = true; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | /** |
@@ -115,18 +115,18 @@ |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | if (! function_exists('config')) { |
118 | - /** |
|
118 | + /** |
|
119 | 119 | * GET/SET App config |
120 | 120 | * |
121 | 121 | * @return Config|mixed|void |
122 | 122 | */ |
123 | 123 | function config(array|string|null $key = null, $default = null) |
124 | 124 | { |
125 | - $config = Services::config(); |
|
125 | + $config = Services::config(); |
|
126 | 126 | |
127 | - if (null === $key) { |
|
128 | - return $config; |
|
129 | - } |
|
127 | + if (null === $key) { |
|
128 | + return $config; |
|
129 | + } |
|
130 | 130 | |
131 | 131 | if (is_string($key)) { |
132 | 132 | return $config->get($key, $default); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - /** |
|
108 | + /** |
|
109 | 109 | * Charge un fichier d'aide en mémoire. |
110 | 110 | * Prend en charge les helpers d'espace de noms, à la fois dans et hors du répertoire 'helpers' d'un répertoire d'espace de noms. |
111 | 111 | */ |
@@ -115,53 +115,53 @@ discard block |
||
115 | 115 | |
116 | 116 | $loader = Services::locator(); |
117 | 117 | |
118 | - // Stockez nos versions de schame système et d'application afin que nous puissions contrôler l'ordre de chargement. |
|
119 | - $systemSchema = null; |
|
120 | - $appSchema = null; |
|
121 | - $vendorSchema = null; |
|
118 | + // Stockez nos versions de schame système et d'application afin que nous puissions contrôler l'ordre de chargement. |
|
119 | + $systemSchema = null; |
|
120 | + $appSchema = null; |
|
121 | + $vendorSchema = null; |
|
122 | 122 | |
123 | - // Le fichier de schema qui sera finalement utiliser |
|
124 | - $file = null; |
|
123 | + // Le fichier de schema qui sera finalement utiliser |
|
124 | + $file = null; |
|
125 | 125 | |
126 | - // Vérifiez si ce schama a déjà été chargé |
|
127 | - if (in_array($name, $loadedSchema, true)) { |
|
126 | + // Vérifiez si ce schama a déjà été chargé |
|
127 | + if (in_array($name, $loadedSchema, true)) { |
|
128 | 128 | return $loadedSchema[$name]; |
129 | - } |
|
130 | - |
|
131 | - // Si le fichier est dans un espace de noms, nous allons simplement saisir ce fichier et ne pas en rechercher d'autres |
|
132 | - if (strpos($name, '\\') !== false) { |
|
133 | - if (!empty($path = $loader->locateFile($name, 'schemas'))) { |
|
134 | - $file = $path; |
|
135 | - } |
|
136 | - } else { |
|
137 | - // Pas d'espaces de noms, donc recherchez dans tous les emplacements disponibles |
|
138 | - $paths = $loader->search('schemas/' . $name); |
|
139 | - |
|
140 | - foreach ($paths as $path) { |
|
141 | - if (strpos($path, CONFIG_PATH . 'schemas' . DS) === 0) { |
|
142 | - $appSchema = $path; |
|
143 | - } elseif (strpos($path, SYST_PATH . 'Constants' . DS . 'schemas' . DS) === 0) { |
|
144 | - $systemSchema = $path; |
|
145 | - } else { |
|
146 | - $vendorSchema = $path; |
|
147 | - } |
|
148 | - } |
|
149 | - |
|
150 | - // Les schema des vendor sont prioritaire, ensuite vienne ceux de l'application |
|
151 | - if (!empty($vendorSchema)) { |
|
152 | - $file = $vendorSchema; |
|
153 | - } else if (!empty($appSchema)) { |
|
154 | - $file = $appSchema; |
|
155 | - } else if (!empty($systemSchema)) { |
|
156 | - $file = $systemSchema; |
|
157 | - } |
|
158 | 129 | } |
159 | 130 | |
160 | - if (!empty($file)) { |
|
161 | - $schema = require($file); |
|
162 | - } else { |
|
163 | - $schema = null; |
|
164 | - } |
|
131 | + // Si le fichier est dans un espace de noms, nous allons simplement saisir ce fichier et ne pas en rechercher d'autres |
|
132 | + if (strpos($name, '\\') !== false) { |
|
133 | + if (!empty($path = $loader->locateFile($name, 'schemas'))) { |
|
134 | + $file = $path; |
|
135 | + } |
|
136 | + } else { |
|
137 | + // Pas d'espaces de noms, donc recherchez dans tous les emplacements disponibles |
|
138 | + $paths = $loader->search('schemas/' . $name); |
|
139 | + |
|
140 | + foreach ($paths as $path) { |
|
141 | + if (strpos($path, CONFIG_PATH . 'schemas' . DS) === 0) { |
|
142 | + $appSchema = $path; |
|
143 | + } elseif (strpos($path, SYST_PATH . 'Constants' . DS . 'schemas' . DS) === 0) { |
|
144 | + $systemSchema = $path; |
|
145 | + } else { |
|
146 | + $vendorSchema = $path; |
|
147 | + } |
|
148 | + } |
|
149 | + |
|
150 | + // Les schema des vendor sont prioritaire, ensuite vienne ceux de l'application |
|
151 | + if (!empty($vendorSchema)) { |
|
152 | + $file = $vendorSchema; |
|
153 | + } else if (!empty($appSchema)) { |
|
154 | + $file = $appSchema; |
|
155 | + } else if (!empty($systemSchema)) { |
|
156 | + $file = $systemSchema; |
|
157 | + } |
|
158 | + } |
|
159 | + |
|
160 | + if (!empty($file)) { |
|
161 | + $schema = require($file); |
|
162 | + } else { |
|
163 | + $schema = null; |
|
164 | + } |
|
165 | 165 | |
166 | 166 | if (empty($schema) || ! ($schema instanceof Schema)) { |
167 | 167 | $schema = Expect::mixed(); |
@@ -159,10 +159,10 @@ |
||
159 | 159 | */ |
160 | 160 | private array $_options = []; |
161 | 161 | |
162 | - /** |
|
163 | - * @param Console $app Application Console |
|
164 | - * @param LoggerInterface $logger Le Logger à utiliser |
|
165 | - */ |
|
162 | + /** |
|
163 | + * @param Console $app Application Console |
|
164 | + * @param LoggerInterface $logger Le Logger à utiliser |
|
165 | + */ |
|
166 | 166 | public function __construct(protected Console $app, protected LoggerInterface $logger) |
167 | 167 | { |
168 | 168 | $this->initProps(); |
@@ -159,10 +159,10 @@ |
||
159 | 159 | public function setEncryption(?string $encryption): self |
160 | 160 | { |
161 | 161 | if ($encryption === static::ENCRYPTION_NONE) { |
162 | - $encryption = null; |
|
163 | - } |
|
162 | + $encryption = null; |
|
163 | + } |
|
164 | 164 | |
165 | - if (in_array($encryption, [null, static::ENCRYPTION_SSL, static::ENCRYPTION_TLS], true)) { |
|
165 | + if (in_array($encryption, [null, static::ENCRYPTION_SSL, static::ENCRYPTION_TLS], true)) { |
|
166 | 166 | $this->encryption = $encryption; |
167 | 167 | } |
168 | 168 |
@@ -164,9 +164,9 @@ |
||
164 | 164 | */ |
165 | 165 | public function setEncryption(?string $encryption): self |
166 | 166 | { |
167 | - if ($encryption === static::ENCRYPTION_NONE) { |
|
168 | - $encryption = null; |
|
169 | - } |
|
167 | + if ($encryption === static::ENCRYPTION_NONE) { |
|
168 | + $encryption = null; |
|
169 | + } |
|
170 | 170 | |
171 | 171 | if (in_array($encryption, [null, static::ENCRYPTION_SSL, static::ENCRYPTION_TLS], true)) { |
172 | 172 | $this->mailer->SMTPSecure = $encryption; |
@@ -233,7 +233,7 @@ |
||
233 | 233 | $file = $this->locator->locateFile($view, 'Views', empty($ext) ? 'php' : $ext); |
234 | 234 | } |
235 | 235 | |
236 | - $file = realpath($file); |
|
236 | + $file = realpath($file); |
|
237 | 237 | |
238 | 238 | // locateFile renverra une chaîne vide si le fichier est introuvable. |
239 | 239 | if (! is_file($file)) { |