private function getTargetClass(\Exception $exception) { foreach ($this->mapper as $source => $target) { if ($exception instanceof $source) { return $target; } } return null; }