This file contains hidden or 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
<?php | |
class ContratoClt | |
{ | |
public function salario() | |
{ | |
//... | |
} | |
} |
This file contains hidden or 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
<?php | |
//Ruim: | |
function emailClients(array $clients): void | |
{ | |
foreach ($clients as $client) { | |
$clientRecord = $db->find($client); | |
if ($clientRecord->isActive()) { | |
email($client); | |
} |
This file contains hidden or 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
<?php | |
class Order | |
{ | |
public function calculateTotalSum(){/*...*/} | |
public function getItems(){/*...*/} | |
public function getItemCount(){/*...*/} | |
public function addItem($item){/*...*/} | |
public function deleteItem($item){/*...*/} | |
} |
This file contains hidden or 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
<?php | |
class Order | |
{ | |
public function calculateTotalSum(){/*...*/} | |
public function getItems(){/*...*/} | |
public function getItemCount(){/*...*/} | |
public function addItem($item){/*...*/} | |
public function deleteItem($item){/*...*/} |
This file contains hidden or 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
<?php | |
//Ruim | |
function createFile(string $name, bool $temp = false): void | |
{ | |
if ($temp) { | |
touch('./temp/'.$name); | |
} else { | |
touch($name); | |
} |
This file contains hidden or 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
<?php | |
/********** Ruim **********/ | |
$nomeUsuarios = []; | |
foreach ($usuarios as $usuario) { | |
$nomeUsuarios[] = $usuario->nome; | |
} | |
return $nomeUsuarios; |
This file contains hidden or 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
<?php | |
private function deveExecutar() | |
{ | |
$gruposAcesso = explode(',', $_SESSION['GRUPOSACESSO']); | |
/* | |
if (in_array(self::GRUPO_ADMINISTRADOR, $gruposAcesso)) { | |
return true; | |
} |
This file contains hidden or 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
<?php | |
/*Ruim*/ | |
//Nome não pode ser vazio nem nulo | |
if (!is_empty($nome) && !is_null($nome)) { | |
} | |
/*Bom*/ |
This file contains hidden or 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
<?php | |
//Autentica usuário | |
$this->autenticar($usuario, $senha); | |
// método construtor | |
public function __construct() | |
{ | |
} |
This file contains hidden or 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
<?php | |
//Ruim | |
if ($article->state === 'published') { | |
// ... | |
} | |
//Bom | |
if ($article->isPublished()) { |