1
0
Fork 0
mirror of synced 2024-05-06 22:02:41 +12:00
appwrite/src/Appwrite/Auth/Validator/Password.php

70 lines
1 KiB
PHP

<?php
namespace Appwrite\Auth\Validator;
use Utopia\Validator;
/**
* Password.
*
* Validates user password string
*/
class Password extends Validator
{
/**
* Get Description.
*
* Returns validator description
*
* @return string
*/
public function getDescription()
{
return 'Password must be at least 8 characters';
}
/**
* Is valid.
*
* @param mixed $value
*
* @return bool
*/
public function isValid($value)
{
if (!\is_string($value)) {
return false;
}
if (\strlen($value) < 8) {
return false;
}
return true;
}
/**
* Is array
*
* Function will return true if object is array.
*
* @return bool
*/
public function isArray(): bool
{
return false;
}
/**
* Get Type
*
* Returns validator type.
*
* @return string
*/
public function getType(): string
{
return self::TYPE_STRING;
}
}