Originally reported by: Marcel Bollmann (Bitbucket: mbollmann, GitHub: mbollmann)
The main purpose of the RequestHandler class is in delegating various AJAX requests to their respective PHP functions. For most requests, this has become a one-liner delegating to a SessionHandler method.
Could we simplify this by just looking for an appropriate SessionHandler method and calling it? Something like:
#!PHP
if (method_exists($foo, $sh)) {
return $sh->{$foo}($_GET, $_POST);
}
This would simplify the code immensely, and also give more meaning to the SessionHandler class. It would mean:
Names of requests and names of SessionHandler methods would have to be unified.
SessionHandler would be responsible for parsing the GET/POST variables.
However, the following issues might arise and should be considered:
Does SessionHandler have any methods that should not be accessible from JSON requests? If it's only a few, maybe they can reasonably be excluded from this mechanism.
Are SessionHandler methods called from outside of RequestHandler, where the new functionality would be undesirable?
Originally reported by: Marcel Bollmann (Bitbucket: mbollmann, GitHub: mbollmann)
The main purpose of the
RequestHandler
class is in delegating various AJAX requests to their respective PHP functions. For most requests, this has become a one-liner delegating to aSessionHandler
method.Could we simplify this by just looking for an appropriate
SessionHandler
method and calling it? Something like:This would simplify the code immensely, and also give more meaning to the SessionHandler class. It would mean:
However, the following issues might arise and should be considered: