/** * @param string $name * @return SolverInterface * @throws LogicException */ protected function resolveHandler($name) { try { $handler = $this->factory->create($name); } catch (Error $ex) { throw new IllegalCallException("Tried to invoke [{$name}] which is undefined."); } catch (Exception $ex) { throw new IllegalCallException("Tried to invoke [{$name}] which is undefined."); } return $handler; }
/** * Resolve handler. * * This method returns passed argument if it is instance of SolverInterface or newly created object of passed class * if the $solverOrName argument was string. * * IllegalCallException is thrown if passed argument is string of invalid class. * * @param SolverInterface|string $solverOrName * @return SolverInterface * @throws IllegalCallException */ protected function resolveHandler($solverOrName) { if (!is_string($solverOrName)) { return $solverOrName; } $ex = null; $handler = null; try { $handler = $this->factory->create($solverOrName); } catch (Error $ex) { } catch (Exception $ex) { } if ($ex !== null) { throw new IllegalCallException("Tried to invoke [{$solverOrName}] which is undefined."); } return $handler; }