private function setMap(array $map)
    {
        // Resets (overwrites) map.
        $this->map = [];
        foreach ($map as $type => $className) {
            $this->addClassToMap($type, $className);
        }
        return $this;
    }