Skip to content

Commit

Permalink
Added isACorrectStringLenght method
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Fiedler committed Jan 3, 2018
1 parent cd484e0 commit 3af4bd3
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions models/ModelTools/VarContentValidator.Class.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,73 +13,82 @@ class VarContentValidator
{

//Método que apenas filtra uma variavel com um filtro fixo ou personalizado
public static function internalFilter (string $stringToFilter, int $typeOfFilter = FILTER_SANITIZE_STRING) {
public static function internalFilter (string $stringToFilter, int $typeOfFilter = FILTER_SANITIZE_STRING) :boll {

return filter_var ($stringToFilter, $typeOfFilter);

}

//Método responsável por retornar se determinado conteudo e do tipo email
public static function isAValidEmail (string $contentToValidate) {
public static function isAValidEmail (string $contentToValidate) :boll {

return filter_var ($contentToValidate, FILTER_VALIDATE_EMAIL);

}

//Verifica se o conteudo e do tipo inteiro
public static function isAValidInt (string $contentToValidate) {
public static function isAValidInt (string $contentToValidate) :boll {

return filter_var ($contentToValidate, FILTER_VALIDATE_INT);

}

//Verifica se o conteudo é uma url
public static function isAValidURL (string $contentToValidate) {
public static function isAValidURL (string $contentToValidate) :boll {

return filter_var ($contentToValidate, FILTER_VALIDATE_URL);

}

//Verifica se o conteudo é um endereço IP
public static function isAValidIPAddress (string $contentToValidate) {
public static function isAValidIPAddress (string $contentToValidate) :boll {

return filter_var ($contentToValidate, FILTER_VALIDATE_IP);

}

//Verifica se o conteúdo é do tipo max
public static function isAValidMacAddress (string $contentToValidate) {
public static function isAValidMacAddress (string $contentToValidate) :boll {

return filter_var ($contentToValidate, FILTER_VALIDATE_MAC);

}

//Verifica se o conteudo e um dominio
public static function isAValidDomain (string $contentToValidate) {
public static function isAValidDomain (string $contentToValidate) :boll {

return filter_var ($contentToValidate, FILTER_VALIDATE_DOMAIN);

}

//Verifica se o conteudo e do tipo boolean
public static function isAValidBoolean (string $contentToValidate) {
public static function isAValidBoolean (string $contentToValidate) :boll {

return filter_var ($contentToValidate, FILTER_VALIDATE_BOOLEAN);

}

//Veirifica se o conteudo e do tipo Float
public static function isAValidFloat (string $contentToValidate) {
public static function isAValidFloat (string $contentToValidate) :boll {

return filter_var ($contentToValidate, FILTER_VALIDATE_FLOAT);

}

//Verifica se o conteudo é um Regex válido
public static function isAValidRegexExp (string $contentToValidate) {
public static function isAValidRegexExp (string $contentToValidate) :bool {

return filter_var ($contentToValidate, FILTER_VALIDATE_REGEXP);

}

//Verifica se o conteudo é exatamente do tamanho especificado
public static function isACorrectStringLenght (string $contentToValidate, int $stringLenght) :bool {

return strlen ($contentToValidate) == $stringLenght;

}



}

0 comments on commit 3af4bd3

Please sign in to comment.