<?php

namespace Hura8\System;

use Hura8\Traits\ClassCacheTrait;

class ModuleManager
{
    use ClassCacheTrait;


    public static function getModuleRouting($module) {
        $cache_key = "module-routing-".$module;

        return static::getCache($cache_key, function () use ($module) {
            $config_file = CONFIG_DIR . '/modules/'.$module.'/routing.php';
            if (file_exists($config_file)) {
                return include $config_file;
            }

            return null;
        });
    }


    public static function getModuleAdmin($module) {
        $cache_key = "module-admin-".$module;

        return static::getCache($cache_key, function () use ($module) {
            $config_file = CONFIG_DIR . '/modules/'.$module.'/admin.php';
            if (file_exists($config_file)) {
                return include $config_file;
            }

            return null;
        });
    }

}
