public function generateClassMap(array $dirs, $pattern, $type, $ignoreProject = true)
    {
        $patterns = (array) $pattern;
        $types = (array) $type;

        $map = [];
        foreach ($patterns as $i => $pattern) {
            $files = $this->globByDirs($dirs, $pattern);
            foreach ($files as $file) {
                $class = $this->guessClassName($file, $ignoreProject);
                if (!$class) {
                    continue;
                }

                $name = $this->getShortName($class, $types[$i]);

                $this->addDuplicates($map, $name, $class);
                $map[$name] = $class;
            }
        }

        ksort($map);

        // Display first type name
        return $this->filterDuplicates($map, lcfirst(is_array($type) ? current($type) : $type));
    }