Skip to content

Instantly share code, notes, and snippets.

@tadeubdev
Created February 9, 2022 17:43
Show Gist options
  • Select an option

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

Select an option

Save tadeubdev/ca6c59edf43c3464aef1309abdf214d9 to your computer and use it in GitHub Desktop.
<?php
class altera
{
public $usuario;
public $v;
public function __construct($usuario, $v)
{
$this->usuario = $usuario;
$this->v = $v;
}
public function execute()
{
if ($his->usuario->temcredito()) {
$this->usuario->tira($this->v);
return $this->usuario;
} else {
$emp = new Emprestimo($this->v);
$emp->adiciona($this->usuario);
if ($emp->liberado()) {
$cred = $emp->credito();
$this->usuario->adiciona($cred);
if ($his->usuario->temcredito()) {
$this->usuario->tira($this->v);
}
}
return $this->usuario;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment