protected function checkPlugins($module)
    {
        $loadedPlugins = Configure::read('plugins');
        $arr = [];

        if (empty($loadedPlugins) || !is_array($loadedPlugins)) {
            return $arr;
        }

        foreach ($loadedPlugins as $plugin => $pluginPath) {
            $pluginPath = Plugin::classPath($plugin) . 'Module' . DS . 'Modules';
            $files = new DirectoryIterator($pluginPath);

            foreach ($files as $file) {
                $filename = $file->getFilename();

                if ($file->isDot() || $file->isDir() || $filename[0] == '.') {
                    continue;
                } elseif ($file->isFile() && substr($filename, -4) != '.php') {
                    continue;
                } elseif (Inflector::camelize(substr($filename, 0, -4)) !== $module) {
                    continue;
                } else {
                    $arr = ['pathDir' => $pluginPath, 'plugin' => $plugin];

                    return $arr;
                }
            }
        }

        return $arr;
    }