Config.php 506 B

12345678910111213141516171819202122232425
  1. <?php
  2. namespace App\Utils;
  3. use RuntimeException;
  4. class Config
  5. {
  6. private const PATH = __DIR__ . '/../../config/';
  7. /*
  8. * Obtiene opciones de configuración desde un archivo.
  9. */
  10. public static function getFromFilename(string $filename)
  11. {
  12. $config = require self::PATH . $filename . '.php';
  13. if (!is_array($config)) {
  14. throw new RuntimeException(sprintf('Config file options "%s" are not an array.', $filename));
  15. }
  16. return $config;
  17. }
  18. }