Implemented Tamer & Cache Drivers (WIP)
This commit is contained in:
parent
26f0f31cc6
commit
d346c4d23d
39 changed files with 2211 additions and 913 deletions
|
@ -5,6 +5,7 @@
|
|||
use FederationLib\Enums\Standard\PeerType;
|
||||
use FederationLib\Enums\Standard\InternetPeerType;
|
||||
use FederationLib\Enums\Standard\PeerAssociationType;
|
||||
use FederationLib\Enums\Standard\PermissionRole;
|
||||
use FederationLib\Enums\Standard\UserPeerType;
|
||||
|
||||
class Validate
|
||||
|
@ -57,4 +58,48 @@
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a client name based on certain criteria.
|
||||
*
|
||||
* The client name must be alphanumeric, allowing spaces, periods, dashes, and underscores,
|
||||
* with a minimum length of 3 characters and a maximum length of 42 characters.
|
||||
*
|
||||
* @param string $name The client name to validate
|
||||
* @return bool Returns true if the client name is valid, false otherwise
|
||||
*/
|
||||
public static function clientName(string $name): bool
|
||||
{
|
||||
if (!preg_match('/^[a-zA-Z0-9\s\.\-_]+$/', $name))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$length = strlen($name);
|
||||
return !($length < 3 || $length > 42);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a client description based on certain criteria.
|
||||
*
|
||||
* @param string $description The client description to validate
|
||||
* @return bool Returns true if the client description is valid, false otherwise
|
||||
*/
|
||||
public static function clientDescription(string $description): bool
|
||||
{
|
||||
$length = strlen($description);
|
||||
return !($length < 3 || $length > 255);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates if the given permission role is valid.
|
||||
*
|
||||
* @param string|int $role
|
||||
* @return bool
|
||||
*/
|
||||
public static function permissionRole(string|int $role): bool
|
||||
{
|
||||
return (int)$role >= 0 && (int)$role <= 5;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue