Skip to content

Instantly share code, notes, and snippets.

@tadeubdev
Last active February 9, 2022 18:15
Show Gist options
  • Select an option

  • Save tadeubdev/59fc332ba43110afbb88d2bd742bb5c7 to your computer and use it in GitHub Desktop.

Select an option

Save tadeubdev/59fc332ba43110afbb88d2bd742bb5c7 to your computer and use it in GitHub Desktop.
<?php
class Example
{
private $tipo;
private $valor;
public function __construct($tipo, $valor)
{
$this->tipo = $tipo;
$this->valor = $valor;
}
public function execute($tipoDeUsuario, $ocupacao)
{
if ($this->tipo === 1) {
$this->valor += 50;
} else if ($tipoDeUsuario === TiposDeUsuario::ADMIN) {
$this->valor += 100;
} else if ($ocupacao->getTipo() === 40) {
$this->valor += 200;
}
return $this->valor;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment