public function using($trait)
{
foreach (func_get_args() as $trait) {
$fqtn = ltrim($trait, '\\');
$parts = explode('\\', $fqtn);
$class = array_pop($parts);
$ns = implode('\\', $parts);
//
// We want to create the trait if it doesn't exist yet. We don't want to
// qualify the namespace until below.
//
if (!trait_exists($trait)) {
eval(call_user_func(function () use($ns, $trait) {
ob_start();
?>
namespace <?php
echo $ns;
?>
{
trait <?php
echo $trait;
?>
{
}
}
<?php
return ob_get_clean();
}));
}
self::$traits[$this->class][] = self::qualify($trait);
}
return $this;
}