was thinking about creating a Single class called ‘Request’ to handle and clean POST and GET variables but being new to the singleton pattern I’m not sure how to implement it. Ideally I’d like to have 2 functions post($name,$clean) and get($name,$clean) – $clean being a boolean to determine whether to trim/ escape the value
was thinking about creating a Single class called ‘Request’ to handle and clean POST
Share
I’m not sure why you think this is a good candidate for a singleton – I’ve have thought a simple static class would make much more sense. (Incidentally, I presume you’re using the built in filter functions?)
Whilst a gross simplification, singleton’s are good at limiting/controlling access to a finite resource which isn’t really the case in this instance.