Created
July 12, 2011 08:53
-
-
Save makasim/1077647 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @see Symfony\Component\Security\Core\Encoder\EncoderFactory::getEncoder() | |
*/ | |
public function getEncoder(SecurityUserInterface $user) | |
{ | |
if (!$user instanceof UserInterface) { | |
return $this->genericFactory->getEncoder($user); | |
} | |
if (isset($this->encoders[$algorithm = $user->getAlgorithm()])) { | |
return $this->encoders[$algorithm]; | |
} | |
return $this->encoders[$algorithm] = $this->createEncoder($algorithm); | |
} | |
/** | |
* @see Symfony\Component\Security\Core\Encoder\EncoderFactory::getEncoder() | |
*/ | |
public function getEncoder(SecurityUserInterface $user) | |
{ | |
try { | |
return $this->genericFactory->getEncoder($user); | |
} catch (\RuntimeException $e) { | |
if (isset($this->encoders[$algorithm = $user->getAlgorithm()])) { | |
return $this->encoders[$algorithm]; | |
} | |
return $this->encoders[$algorithm] = $this->createEncoder($algorithm); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment