Files
izyim/app/Traits/DeterminesIfUserPasswordMatchesRequirements.php
T
2019-02-16 06:42:42 +08:00

29 lines
651 B
PHP

<?php
namespace App\Traits;
trait DeterminesIfUserPasswordMatchesRequirements {
/**
* @param string $password
*
* @return bool
*/
private function doesPasswordMeetRequirements(string $password): bool {
$matches = [];
// preg_match('/^.*(?=.{3,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d]).*$/', $password, $matches);
// return count($matches) > 0;
return true;
}
/**
* @param string $password
*
* @return bool
*/
private function checkPasswordAndThrowIfInvalid(string $password): bool {
return $this->doesPasswordMeetRequirements($password) === true;
}
}