Guest User

Untitled

a guest
Feb 18th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4. * @see Symfony\Component\Security\Core\Encoder\EncoderFactory::getEncoder()
  5. */
  6. public function getEncoder(SecurityUserInterface $user)
  7. {
  8. if (!$user instanceof UserInterface) {
  9. return $this->genericFactory->getEncoder($user);
  10. }
  11.  
  12. if (isset($this->encoders[$algorithm = $user->getAlgorithm()])) {
  13. return $this->encoders[$algorithm];
  14. }
  15.  
  16. return $this->encoders[$algorithm] = $this->createEncoder($algorithm);
  17. }
  18.  
  19. /**
  20. * @see Symfony\Component\Security\Core\Encoder\EncoderFactory::getEncoder()
  21. */
  22. public function getEncoder(SecurityUserInterface $user)
  23. {
  24. try {
  25. return $this->genericFactory->getEncoder($user);
  26. } catch (\RuntimeException $e) {
  27. if (isset($this->encoders[$algorithm = $user->getAlgorithm()])) {
  28. return $this->encoders[$algorithm];
  29. }
  30.  
  31. return $this->encoders[$algorithm] = $this->createEncoder($algorithm);
  32. }
  33. }
Add Comment
Please, Sign In to add comment