Use isset() instead of array_key_exists(). Closes #3364

Thanks to @aswinlutchanah for the hint.
Use (int) for typecasting instead of intval(). Closes #3363

Thanks again @aswinlutchanah for the hint.
Make generate_response function public.
Merge pull request #3 from blueimp/master

Update from origin