FOS\UserBundle\Model\UserInterface::setAlgorithm PHP Method

setAlgorithm() public method

public setAlgorithm ( $algorithm )
    function setAlgorithm($algorithm);

Usage Example

 /**
  * {@inheritDoc}
  */
 public function updatePassword(UserInterface $user)
 {
     if (0 !== strlen($password = $user->getPlainPassword())) {
         $user->setAlgorithm($this->algorithm);
         $encoder = $this->getEncoder($user);
         $user->setPassword($encoder->encodePassword($password, $user->getSalt()));
         $user->eraseCredentials();
     }
 }