Dependency injection in constructor, method or just use a static class instead?
- by gaetanm
What is the best between:
$dispatcher = new Dispatcher($request);
$dispatcher->dispatch();
and
$dispatcher = new Dispatcher();
$dispatcher->dispatch($request);
or even
Dispatcher::dispatch($request);
Knowing that only one method of this class uses the $request instance.
I naturally tend to the last solution because the class have no other states, but by I feel that it may not be the best OOP solution.