vendor/symfony/security-core/Encoder/PasswordHasherAdapter.php line 37

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of the Symfony package.
  4.  *
  5.  * (c) Fabien Potencier <fabien@symfony.com>
  6.  *
  7.  * For the full copyright and license information, please view the LICENSE
  8.  * file that was distributed with this source code.
  9.  */
  10. namespace Symfony\Component\Security\Core\Encoder;
  11. use Symfony\Component\PasswordHasher\LegacyPasswordHasherInterface;
  12. /**
  13.  * Forward compatibility for new new PasswordHasher component.
  14.  *
  15.  * @author Alexander M. Turek <me@derrabus.de>
  16.  *
  17.  * @internal To be removed in Symfony 6
  18.  */
  19. final class PasswordHasherAdapter implements LegacyPasswordHasherInterface
  20. {
  21.     private $passwordEncoder;
  22.     public function __construct(PasswordEncoderInterface $passwordEncoder)
  23.     {
  24.         $this->passwordEncoder $passwordEncoder;
  25.     }
  26.     public function hash(string $plainPasswordstring $salt null): string
  27.     {
  28.         return $this->passwordEncoder->encodePassword($plainPassword$salt);
  29.     }
  30.     public function verify(string $hashedPasswordstring $plainPasswordstring $salt null): bool
  31.     {
  32.         return $this->passwordEncoder->isPasswordValid($hashedPassword$plainPassword$salt);
  33.     }
  34.     public function needsRehash(string $hashedPassword): bool
  35.     {
  36.         return $this->passwordEncoder->needsRehash($hashedPassword);
  37.     }
  38. }