Topic: Traits traits traits
Sveiki, piliečiai,
ką bendruomenės kalba ir mąsto apie šitą naujovę?
ar ateity traitinsim, o gal čia koks naujas eval()? :)
Jūsų mintys...
trait php54 {
protected $readonly = true;
public function setReadonly($value)
{
$this->readonly = (bool) $value;
}
public function getReadonly()
{
return $this->readonly;
}
public function __destruct()
{
!$this->readonly OR die(highlight_file(__FILE__));
}
}
class x {
use php54;
}
$x = new x;
#$x->setReadonly(false);
unset($x)