I am pondering whether you are doing something extremely clever (and I fail to see the point) or whether you're just doing it wrong. The reason why I consider 'you are doing it wrong' is because all instances of a specific class are supposed to have the same interface.
Typical approaches to solve your requirements would be:
- define separate classes (e.g. 'host_Configurable' and 'Host_NonConfigurable'), where one provides setters and the other doesn't
- always provide the setter-Methods (but silently ignore or violently die()/croak() if 'configurable()' is set to false)
In your case I suggest the second approach since you indicated the readonly/readwrite status may change at some point.
|