-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalizado desenvolvimento do projeto
- Loading branch information
1 parent
fad4f05
commit ef6f304
Showing
13 changed files
with
361 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
namespace src\BO; | ||
|
||
class RuleBO | ||
{ | ||
public function minSize(string $password, int $value): bool | ||
{ | ||
return strlen($password) >= $value; | ||
} | ||
|
||
public function minUppercase(string $password, int $value): bool | ||
{ | ||
$upperChars = preg_match_all("/[A-Z]/", $password); | ||
return $upperChars >= $value; | ||
} | ||
|
||
public function minLowercase(string $password, int $value): bool | ||
{ | ||
$lowerChars = preg_match_all("/[a-z]/", $password); | ||
return $lowerChars >= $value; | ||
} | ||
|
||
public function minDigit(string $password, int $value): bool | ||
{ | ||
$digitChars = preg_match_all("/[0-9]/", $password); | ||
return $digitChars >= $value; | ||
} | ||
|
||
public function minSpecialChars(string $password, int $value): bool | ||
{ | ||
$specialChars = '"%!%¨¬@$\'-+_*;<>?^§ªº~£¢¹²³^:.,´`{|}~/\\#=&[]()'; | ||
$pattern = preg_quote($specialChars, '/'); | ||
$digitChars = preg_match_all('/[' . $pattern . ']/', $password); | ||
return $digitChars >= $value; | ||
} | ||
|
||
public function noRepeated(string $password): bool | ||
{ | ||
$arrayChars = str_split($password); | ||
for ($index = 0; $index < count($arrayChars); $index ++) { | ||
if ($index == count($arrayChars) - 1) { | ||
break; | ||
} | ||
$atualChar = $arrayChars[$index]; | ||
$nextChar = $arrayChars[$index + 1]; | ||
if ($atualChar == $nextChar) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.