<?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;
    }
    public function ValidateUsername(string $username) : bool{
      
        // if(!filter_var($username,FILTER_VALIDATE_REGEXP,array("options" => array( "regexp" => "^[^&=_'\-+;<>.]{1,18}$" ))))
        // {
        //     return false;
        // }
        return true;
    }
    public function ValidatePassword(string $password) : bool{
        if(strlen($password)>100)
        {
            return false;
        }
        return true;
    }
}
