|
@@ -1,20 +1,13 @@
|
|
|
<?php
|
|
|
-
|
|
|
+//Путь до директории с конфигурационными файлами
|
|
|
const DIR_CONFIG = '/../config';
|
|
|
|
|
|
-spl_autoload_register(function ($className) {
|
|
|
- $paths = include __DIR__ . DIR_CONFIG . '/path.php';
|
|
|
- $className = str_replace('\\', '/', $className);
|
|
|
+//Подключение автозагрузчика composer
|
|
|
+require_once __DIR__ . '/../vendor/autoload.php';
|
|
|
|
|
|
- foreach ($paths['classes'] as $path) {
|
|
|
- $filename = $_SERVER['DOCUMENT_ROOT'] . "/$paths[root]/$path/$className.php";
|
|
|
- if (file_exists($filename)) {
|
|
|
- require_once $filename;
|
|
|
- }
|
|
|
- }
|
|
|
-});
|
|
|
-
|
|
|
-function getConfigs(string $path = DIR_CONFIG): array {
|
|
|
+//Функция, возвращающая массив всех настроек приложения
|
|
|
+function getConfigs(string $path = DIR_CONFIG): array
|
|
|
+{
|
|
|
$settings = [];
|
|
|
foreach (scandir(__DIR__ . $path) as $file) {
|
|
|
$name = explode('.', $file)[0];
|
|
@@ -27,4 +20,5 @@ function getConfigs(string $path = DIR_CONFIG): array {
|
|
|
|
|
|
require_once __DIR__ . '/../routes/web.php';
|
|
|
|
|
|
-return new Src\Application(new Src\Settings(getConfigs()));
|
|
|
+return new Src\Application(new Src\Settings(getConfigs()));
|
|
|
+
|