canax /
remserver
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Configuration file for DI container. |
||
| 4 | */ |
||
| 5 | return [ |
||
| 6 | "services" => [ |
||
| 7 | "remserver" => [ |
||
| 8 | "shared" => true, |
||
| 9 | "callback" => function () { |
||
| 10 | $rem = new \Anax\RemServer\RemServer(); |
||
| 11 | $rem->injectSession($this->get("session")); |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 12 | |||
| 13 | // Load the configuration file |
||
| 14 | $cfg = $this->get("configuration"); |
||
| 15 | $config = $cfg->load("remserver/config.php"); |
||
| 16 | $configFile = $config["file"] ?? null; |
||
| 17 | |||
| 18 | $dataset = $config["config"]["dataset"] ?? null; |
||
| 19 | if (!$dataset) { |
||
| 20 | throw new Exception("Configuration file '$configFile' is missing an entry 'dataset'."); |
||
| 21 | } |
||
| 22 | |||
| 23 | $rem->setDefaultDataset($dataset); |
||
| 24 | return $rem; |
||
| 25 | } |
||
| 26 | ], |
||
| 27 | ], |
||
| 28 | ]; |
||
| 29 |