function setDirMap(array $moduleMap)
    {
        if(!empty($moduleMap) && array_values($moduleMap) === $moduleMap)
            throw new \Exception('Module map must be associative array, module name and class map.');

        foreach($moduleMap as $m => $v) {
            if (strstr($v, '/') !== false || strstr($v, '\\') !== false) {
                // module names in Namespace\To\Module\Style
                $v = rtrim($v, "\\/");
                $v = str_replace('\\', '/', $v);

                $moduleMap[$m] = $v;
            }
        }

        $this->dirMap = array_merge($this->dirMap, $moduleMap);
        return $this;
    }