If the handler for a given command can be expressed as a string or array callable (e.g., a function name, a static method name, a class name of a class that is invokable), we should allow specifying the handler as part of the route configuration, in order to keep the associations in one place.
Application's constructor would need to be altered to allow the following:
The Dispatcher argument could become optional; if none is provided, one would be created.
If the routing is provided as configuration, each route that also defines a handler would be mapped to the Dispatcher using that handler if a handler is not already set for the command.
If the handler for a given command can be expressed as a string or array callable (e.g., a function name, a static method name, a class name of a class that is invokable), we should allow specifying the handler as part of the route configuration, in order to keep the associations in one place.
Application
's constructor would need to be altered to allow the following:Dispatcher
argument could become optional; if none is provided, one would be created.