PHP Classes

File: src/Passwdqc.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   PHP Password Strength Check   src/Passwdqc.php   Download  
File: src/Passwdqc.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Password Strength Check
Check the strength of a new password that changed
Author: By
Last change:
Date: 3 years ago
Size: 1,051 bytes
 

Contents

Class file image Download
<?php
declare(strict_types=1);
namespace
ParagonIE\Passwdqc;

/**
 * Class Passwdqc
 *
 * This class extends the compatibility layer and offers a simpler
 * interface for PHP developers to grasp.
 *
 * @package ParagonIE\Passwdqc
 */
final class Passwdqc extends Compat
{

   
/**
     * @var Params
     */
   
protected $params;
   
   
/**
     * Passwdqc constructor.
     */
   
public function __construct(Params $params = null)
    {
        if (
$params === null) {
           
$params = static::getDefaultParams();
        }
       
$this->params = $params;
    }

   
/**
     * Simplified API for passwdqc
     *
     * @param string $newPassword
     * @param string $oldPassword
     * @param UserInformation|null $pw
     * @return bool
     */
   
public function check(
       
string $newPassword,
       
string $oldPassword = '',
       
UserInformation $pw = null
   
): bool {
        return static::
passwdqc_check(
           
$this->params,
           
$newPassword,
           
$oldPassword,
           
$pw
       
);
    }
}