Skip to content

Commit

Permalink
refactor: Retirar elseif redundantes
Browse files Browse the repository at this point in the history
  • Loading branch information
emanuellopess committed Jan 19, 2023
1 parent ec6a030 commit 67b0bcf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions includes/class-lkn-wc-gateway-cielo-credit.php
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ private function validate_card_number($ccnum) {
$this->add_notice_once(__('Credit Card number is required!', 'lkn-wc-gateway-cielo'), 'error');

return false;
} elseif (!empty($ccnum)) {
} else {
$isValid = !preg_match('/[^0-9\s]/', $ccnum);

if ($isValid !== true || strlen($ccnum) < 12) {
Expand All @@ -345,7 +345,7 @@ private function validate_exp_date($expDate) {
$this->add_notice_once(__('Expiration date is required!', 'lkn-wc-gateway-cielo'), 'error');

return false;
} elseif (!empty($expDate)) {
} else {
$expDateSplit = explode('/', $expDate);

try {
Expand Down Expand Up @@ -379,7 +379,7 @@ private function validate_cvv($cvv) {
$this->add_notice_once(__('CVV is required!', 'lkn-wc-gateway-cielo'), 'error');

return false;
} elseif (!empty($cvv)) {
} else {
$isValid = !preg_match('/\D/', $cvv);

if ($isValid !== true || strlen($cvv) < 3) {
Expand Down
6 changes: 3 additions & 3 deletions includes/class-lkn-wc-gateway-cielo-debit.php
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ private function validate_card_number($dcnum) {
$this->add_notice_once(__('Debit Card number is required!', 'lkn-wc-gateway-cielo'), 'error');

return false;
} elseif (!empty($dcnum)) {
} else {
$isValid = !preg_match('/[^0-9\s]/', $dcnum);

if ($isValid !== true || strlen($dcnum) < 12) {
Expand All @@ -423,7 +423,7 @@ private function validate_exp_date($expDate) {
$this->add_notice_once(__('Expiration date is required!', 'lkn-wc-gateway-cielo'), 'error');

return false;
} elseif (!empty($expDate)) {
} else {
$expDateSplit = explode('/', $expDate);

try {
Expand Down Expand Up @@ -457,7 +457,7 @@ private function validate_cvv($cvv) {
$this->add_notice_once(__('CVV is required!', 'lkn-wc-gateway-cielo'), 'error');

return false;
} elseif (!empty($cvv)) {
} else {
$isValid = !preg_match('/\D/', $cvv);

if ($isValid !== true || strlen($cvv) < 3) {
Expand Down

0 comments on commit 67b0bcf

Please sign in to comment.