I have this router class, but I am not sure what pattern it should belongs to. It seems to be a facade or mediator pattern to me. What do you think?
class Router
{
...
}
usage,
$router = new Router();
$router->get('/', function() { ... });
$router->get('foo/', function() { ... });
$router->post('foo/', function() { ... });
But then, it seems that it is said that router is an anti-pattern as some of the commets suggest in this question. if router is violating patterns, then what are the solutions?
Aucun commentaire:
Enregistrer un commentaire