I have this multiple traits
trait router{
function router_name(){
return 'home';
}
}
trait database{
function database_name(){
return 'app';
}
}
trait httpinput{
function input_name(){
return 'get';
}
}
and this array of names of traits
$cofig['traits'] = ['router','database','httpinput'];
and a class where all traits will be use in
class testclass{
}
now, how can I dynamically declare the traits inside the class using the $config
array
I know I can do,
class testclass{
use router,database,httpinput;
}
but I want to embed those traits dynamically base on those values on the $config
array e.g.
foreach($config as $c){
use $c;
}
any help, ideas please?