@@ -221,16 +221,17 @@ public function __construct(
221
221
222
222
/** The specified vendor directory doesn't exist or isn't readable. */
223
223
if (!is_dir ($ VendorPath ) || !is_readable ($ VendorPath )) {
224
- if (isset ($ _SERVER ['DOCUMENT_ROOT ' ], $ _SERVER ['SCRIPT_NAME ' ])) {
225
- /** Safeguard for symlinked installations. */
226
- $ VendorPath = $ this ->buildPath (dirname ($ _SERVER ['DOCUMENT_ROOT ' ] . $ _SERVER ['SCRIPT_NAME ' ]) . DIRECTORY_SEPARATOR . 'vendor ' , false );
227
-
228
- /** Eep.. Still not working. Generate exception. */
229
- if ($ VendorPath === '' || !is_dir ($ VendorPath ) || !is_readable ($ VendorPath )) {
230
- throw new \Exception ('Vendor directory is undefined or unreadable. ' );
231
- }
232
- } else {
224
+ if (!isset ($ _SERVER ['DOCUMENT_ROOT ' ], $ _SERVER ['SCRIPT_NAME ' ])) {
233
225
/** Further safeguards not possible. Generate exception. */
226
+ throw new \Exception ('Vendor directory is undefined or unreadable. ' );
227
+ }
228
+
229
+
230
+ /** Safeguard for symlinked installations. */
231
+ $ VendorPath = $ this ->buildPath (dirname ($ _SERVER ['DOCUMENT_ROOT ' ] . $ _SERVER ['SCRIPT_NAME ' ]) . DIRECTORY_SEPARATOR . 'vendor ' , false );
232
+
233
+ /** Eep.. Still not working. Generate exception. */
234
+ if ($ VendorPath === '' || !is_dir ($ VendorPath ) || !is_readable ($ VendorPath )) {
234
235
throw new \Exception ('Vendor directory is undefined or unreadable. ' );
235
236
}
236
237
}
@@ -288,23 +289,8 @@ public function __construct(
288
289
$ this ->Configuration = parse_ini_file ($ this ->ConfigurationPath , true );
289
290
290
291
/** Multiline support. */
291
- if (is_array ($ this ->Configuration )) {
292
- foreach ($ this ->Configuration as $ CatKey => &$ CatVal ) {
293
- if (is_array ($ CatVal )) {
294
- foreach ($ CatVal as $ DirKey => &$ DirVal ) {
295
- if (!is_string ($ DirVal )) {
296
- continue ;
297
- }
298
- $ DirVal = str_replace (
299
- ["\\\\" , '\0 ' , '\a ' , '\b ' , '\t ' , '\n ' , '\v ' , '\f ' , '\r ' , '\e ' ],
300
- ["\\" , "\0" , "\7" , "\8 " , "\t" , "\n" , "\x0B" , "\x0C" , "\r" , "\x1B" ],
301
- $ DirVal
302
- );
303
- }
304
- }
305
- }
306
- unset($ DirVal , $ DirKey , $ CatVal , $ CatKey );
307
- }
292
+ $ this ->decodeConfigurations ();
293
+
308
294
} elseif (preg_match ('~\.ya?ml$~i ' , $ this ->ConfigurationPath )) {
309
295
if ($ Configuration = $ this ->readFile ($ this ->ConfigurationPath )) {
310
296
$ this ->YAML ->process ($ Configuration , $ this ->Configuration );
@@ -329,7 +315,7 @@ public function __construct(
329
315
330
316
/** Calculate and build various paths. */
331
317
foreach (['CachePath ' , 'QuarantinePath ' , 'SignaturesPath ' ] as $ Path ) {
332
- if (!$ $ Path ) {
318
+ if (!$ { $ Path} ) {
333
319
if (!$ VendorPath ) {
334
320
continue ;
335
321
}
@@ -446,6 +432,30 @@ public function __construct(
446
432
});
447
433
}
448
434
435
+ /**
436
+ * Method to decode the configurations
437
+ * @return void
438
+ */
439
+ private function decodeConfigurations () : void
440
+ {
441
+ if (is_array ($ this ->Configuration )) {
442
+ foreach ($ this ->Configuration as $ CatKey => &$ CatVal ) {
443
+ if (is_array ($ CatVal )) {
444
+ foreach ($ CatVal as $ DirKey => &$ DirVal ) {
445
+ if (!is_string ($ DirVal )) {
446
+ continue ;
447
+ }
448
+ $ DirVal = str_replace (
449
+ ["\\\\" , '\0 ' , '\a ' , '\b ' , '\t ' , '\n ' , '\v ' , '\f ' , '\r ' , '\e ' ],
450
+ ["\\" , "\0" , "\7" , "\8 " , "\t" , "\n" , "\x0B" , "\x0C" , "\r" , "\x1B" ],
451
+ $ DirVal
452
+ );
453
+ }
454
+ }
455
+ }
456
+ }
457
+ }
458
+
449
459
/**
450
460
* Destruct the loader.
451
461
*
0 commit comments