comphist / cora

A web-based, token-level annotation tool for non-standard language data
http://www.linguistics.rub.de/comphist/resources/cora/
MIT License
10 stars 6 forks source link

Simplifying RequestHandler #24

Open mbollmann opened 9 years ago

mbollmann commented 9 years ago

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:

However, the following issues might arise and should be considered: