You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
715 B
33 lines
715 B
<?php
|
|
|
|
class Validation
|
|
{
|
|
public function ValidateSet($var) :bool{
|
|
if (isset($var)) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public function ValidateNotEmpty($var) :bool{
|
|
if (empty($var)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function ValidateURL(string $url) :bool{
|
|
if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i",$url)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
public function ValidateEmail(string $email) :bool{
|
|
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|