/** * Create the user-Proxy according to the given User-Object * * @return UserInterface * @throws \UnexpectedValueException */ public function factory($userObject) { if ($userObject instanceof \Hybridauth\Entity\Profile) { $userProxy = new HybridAuthUserWrapper(); $userProxy->setUser($userObject); return $userProxy; } throw new \UnexpectedValueException(sprintf('The given Object could not be found. Found "%s" instead', get_Class($userObject))); }
/** * Create the user-Proxy according to the given User-Object * * @return UserInterface * @throws \UnexpectedValueException */ public function factory($userObject) { switch (get_class($userObject)) { case 'Hybridauth\\Entity\\Profile': $userProxy = new HybridAuthUserWrapper(); $userProxy->setUser($userObject); return $userProxy; break; default: throw new \UnexpectedValueException(sprintf('The given Object could not be found. Found "%s" instead', get_Class($userObject))); } throw new \UnexpectedValueException('The given Object could not be found'); return false; }