class baseClass {
protected $a;
protected $b;
public function __construct($a, $b = null) {
$this->a = $a;
$this->b = $b;
}
public function sayWhat() {
echo $this->a, $this->b, PHP_EOL;
}
}
trait SayAB {
private $separator = ' ';
public function sayIt() {
echo $this->a, $this->separator, $this->b, PHP_EOL;
}
}
class AnonymousFactory {
private $className;
private $constructorArguments;
private $traits;
public function __construct($class, ...$args) {
$this->className = $class;
$this->constructorArguments = $args;