protected function classMapFromPath($subPath, $namespace = null)
    {
        $messages = array();
        $classMap = $this->generator->scan($subPath, null, $namespace, $messages);

        if ($messages) {
            foreach ($messages as $message) {
                $this->report->warn(new GenericViolation($message));
            }
        }

        foreach ($classMap as $class => $file) {
            try {
                $this->classMap->add($class, $file);
            } catch (ClassAlreadyRegisteredException $exception) {
                $this->report->append(
                    new ClassAddedMoreThanOnceViolation(
                        $this->getName(),
                        $class,
                        array(
                            $exception->getFileName(),
                            $file
                        )
                    )
                );
            }
        }

        return $classMap;
    }