Hi, On Sun, Sep 8, 2013 at 1:43 AM, Levi Morrison <morrison.l...@gmail.com>wrote:
> You have a flawed understanding of good functional design. Instead of > directly calling the escaping function you would simply ask for a callable > and pass in the escaping function. Thus, you could use an alternative > escaping function at runtime. > > The methods route is a poor choice. If we use classes at all, separate the > responsibility of each type of escaping to a separate class. Escaping JSON > and HTML code have little (possibly nothing) in common and do not belong in > the same class. > You are proposing something like $escape_function = function($input) { $output=avaScriptEscaper->escape($input); $output=do_some_additional($output); return $output; } my_escape($some_data, $escape_function) { return $escape_function($some_data); } Is this correct? Regards, -- Yasuo Ohgaki yohg...@ohgaki.net