I have written classes. Loader
class will call mulitple classes via foreach $tasks
Is there a name of this design pattern?
Loader
class Loader
{
public function handle()
{
$tasks = [
DoSomethingFirst::class,
DoSomethingSecond::class,
];
foreach ($tasks as $task)
{
(new $task)->handle();
}
}
}
Called via Loader
class DoSomethingFirst
{
public function handle() { //do something }
}
class DoSomethingSecond
{
public function handle() { //do something }
}
Aucun commentaire:
Enregistrer un commentaire