4
How can we know if a class uses a Trait?
For example:
trait Setter
{
protected $vars = [];
public function __set($key, $value)
{
$this->vars[$key] = $value;
}
}
class User
{
use Setter;
}
$user = new User;
if ($user contém o trait Setter) {
// faça alguma coisa
}
According to the given code, how to know that $user
is using the trait
Setter
?
Wallace today is too much with the questions :) +1
– Jorge B.
Sometimes I already know the answer to some, but I ask only to have in SOPT :)
– Wallace Maxters
I know Wallace :)
– Jorge B.