Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
config.php
1<?php
2
4
7
12class Config
13{
14 private ?string $path;
15 private array $config = [];
16
17 public function __construct($path)
18 {
19 $this->path = Path::normalize($path);
20 $file = new File($this->path);
21 if ($file->isExists())
22 {
23 $content = include($this->path);
24
25 if (is_array($content))
26 {
27 $this->config = $content;
28 }
29 }
30 }
31
32 public function __get($name)
33 {
34 $config = $this->config;
35 if ($name == "extensions")
36 {
37 if (array_keys($config) !== range(0, count($config) - 1) && array_key_exists('extensions', $config))
38 {
39 return $config['extensions'];
40 }
41 else
42 {
43 return [];
44 }
45 }
46 elseif ($name == "dynamicData")
47 {
48 return $config['dynamicData'] ?? [];
49 }
50 }
51}
static normalize($path)
Definition path.php:26