protected function getFileListForModule(Module $module)
    {
        $modulePath = $module->getPath();

        // Search all .ss files in themes
        if (stripos($module->getRelativePath(), 'themes/') === 0) {
            return $this->getFilesRecursive($modulePath, null, 'ss');
        }

        // If non-standard module structure, search all root files
        if (!is_dir("{$modulePath}/code") && !is_dir("{$modulePath}/src")) {
            return $this->getFilesRecursive($modulePath);
        }

        // Get code files
        if (is_dir("{$modulePath}/src")) {
            $files = $this->getFilesRecursive("{$modulePath}/src", null, 'php');
        } else {
            $files = $this->getFilesRecursive("{$modulePath}/code", null, 'php');
        }

        // Search for templates in this module
        if (is_dir("{$modulePath}/templates")) {
            $templateFiles = $this->getFilesRecursive("{$modulePath}/templates", null, 'ss');
        } else {
            $templateFiles = $this->getFilesRecursive($modulePath, null, 'ss');
        }

        return array_merge($files, $templateFiles);
    }