Skip to content

Commit

Permalink
Apply php-cs-fixer changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pr3d4dor authored and actions-user committed Apr 3, 2024
1 parent 5cd7673 commit 6f6905e
Show file tree
Hide file tree
Showing 29 changed files with 918 additions and 919 deletions.
17 changes: 9 additions & 8 deletions application/controllers/Mine.php
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ public function visualizarOs($id = null)
$this->load->view('conecte/template', $data);
}

public function validarCPF($cpf) {
public function validarCPF($cpf)
{
$cpf = preg_replace('/[^0-9]/', '', $cpf);
if (strlen($cpf) !== 11 || preg_match('/^(\d)\1+$/', $cpf)) {
return false;
Expand All @@ -550,7 +551,8 @@ public function validarCPF($cpf) {
return $dv2 == $cpf[10];
}

public function validarCNPJ($cnpj) {
public function validarCNPJ($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', $cnpj);
if (strlen($cnpj) !== 14 || preg_match('/^(\d)\1+$/', $cnpj)) {
return false;
Expand All @@ -574,14 +576,13 @@ public function validarCNPJ($cnpj) {
return $dv2 == $cnpj[13];
}

public function formatarChave($chave) {
public function formatarChave($chave)
{
if ($this->validarCPF($chave)) {
return substr($chave, 0, 3) . '.' . substr($chave, 3, 3) . '.' . substr($chave, 6, 3) . '-' . substr($chave, 9);
}
elseif ($this->validarCNPJ($chave)) {
} elseif ($this->validarCNPJ($chave)) {
return substr($chave, 0, 2) . '.' . substr($chave, 2, 3) . '.' . substr($chave, 5, 3) . '/' . substr($chave, 8, 4) . '-' . substr($chave, 12);
}
elseif (strlen($chave) === 11) {
} elseif (strlen($chave) === 11) {
return '(' . substr($chave, 0, 2) . ') ' . substr($chave, 2, 5) . '-' . substr($chave, 7);
}
return $chave;
Expand Down Expand Up @@ -1044,7 +1045,7 @@ public function captcha()
$arrFont = ['font-ZXX_Noise.otf', 'font-karabine.ttf', 'font-capture.ttf', 'font-captcha.ttf'];
shuffle($arrFont);

$codigoCaptcha = substr(md5(time()) ,0, 7);
$codigoCaptcha = substr(md5(time()), 0, 7);
$img = imagecreatefromjpeg('./assets/img/captcha_bg.jpg');
$corCaptcha = imagecolorallocate($img, 255, 0, 0);
$font = './assets/font-awesome/'.$arrFont[0];
Expand Down
15 changes: 8 additions & 7 deletions application/controllers/Os.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ public function visualizar()
return $this->layout();
}

public function validarCPF($cpf) {
public function validarCPF($cpf)
{
$cpf = preg_replace('/[^0-9]/', '', $cpf);
if (strlen($cpf) !== 11 || preg_match('/^(\d)\1+$/', $cpf)) {
return false;
Expand All @@ -371,7 +372,8 @@ public function validarCPF($cpf) {
return $dv2 == $cpf[10];
}

public function validarCNPJ($cnpj) {
public function validarCNPJ($cnpj)
{
$cnpj = preg_replace('/[^0-9]/', '', $cnpj);
if (strlen($cnpj) !== 14 || preg_match('/^(\d)\1+$/', $cnpj)) {
return false;
Expand All @@ -395,14 +397,13 @@ public function validarCNPJ($cnpj) {
return $dv2 == $cnpj[13];
}

public function formatarChave($chave) {
public function formatarChave($chave)
{
if ($this->validarCPF($chave)) {
return substr($chave, 0, 3) . '.' . substr($chave, 3, 3) . '.' . substr($chave, 6, 3) . '-' . substr($chave, 9);
}
elseif ($this->validarCNPJ($chave)) {
} elseif ($this->validarCNPJ($chave)) {
return substr($chave, 0, 2) . '.' . substr($chave, 2, 3) . '.' . substr($chave, 5, 3) . '/' . substr($chave, 8, 4) . '-' . substr($chave, 12);
}
elseif (strlen($chave) === 11) {
} elseif (strlen($chave) === 11) {
return '(' . substr($chave, 0, 2) . ') ' . substr($chave, 2, 5) . '-' . substr($chave, 7);
}
return $chave;
Expand Down
Loading

0 comments on commit 6f6905e

Please sign in to comment.