1 | <?php |
||
27 | class Reader |
||
28 | { |
||
29 | /** |
||
30 | * Configuration file name |
||
31 | * |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $configFileName; |
||
35 | |||
36 | /** |
||
37 | * Define the directories to search in. Only the first file found is taken into account |
||
38 | * Can be defined via the constructor |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | protected $configDirectories; |
||
43 | |||
44 | /** |
||
45 | * Configuration file name |
||
46 | * |
||
47 | * @var string|array |
||
48 | */ |
||
49 | protected $configFilePath; |
||
50 | |||
51 | /** |
||
52 | * Stores the config values |
||
53 | * |
||
54 | * @var array |
||
55 | */ |
||
56 | protected $configValues = []; |
||
57 | |||
58 | |||
59 | /** |
||
60 | * Set a few properties, open the config file and parse it |
||
61 | * |
||
62 | * @param string $configFileName |
||
63 | * @param array $configDirectories |
||
64 | */ |
||
65 | 26 | public function __construct(string $configFileName, array $configDirectories = ['.']) |
|
75 | |||
76 | |||
77 | /** |
||
78 | * Getter |
||
79 | * |
||
80 | * @return array Config Values |
||
81 | */ |
||
82 | 23 | public function getConfigValues() |
|
86 | |||
87 | |||
88 | /** |
||
89 | * Getter |
||
90 | * |
||
91 | * @return array Config Values |
||
92 | */ |
||
93 | 5 | public function getEntityConfig(string $entity) |
|
100 | |||
101 | |||
102 | /** |
||
103 | * Return the list of entites |
||
104 | * |
||
105 | * @return array |
||
106 | */ |
||
107 | 7 | public function getEntities(): array |
|
111 | |||
112 | |||
113 | /** |
||
114 | * Parse and validate the configuration |
||
115 | */ |
||
116 | 25 | protected function parseAndValidateConfig() |
|
124 | } |
||
125 |