RestServer
RestServer copied to clipboard
Improve the error if there is no controller
PHP can be configured to show errors when $this->map[$this->method] is called In this case, the user can see the name of the lib It shouldn't show it for security reason :)
This essentially wraps the function in an if statement, which the if statement inside does anyway?
If you are worried about this segment causing errors visible to the user:
$urls = $this->map[$this->method];
if (!$urls) return null;
then it would be better to rewrite this to not generate a warning in the first place:
if (empty($this->map[$this-method])) return null;
I'd probably say that this isn't too great a concern, as production environments would hide these warnings anyway, but I may have misunderstood your intent.