Hi Dieter,
Thanks for your suggestions.
I
introduced new function to initialize set of properties of
PMA_DisplayResults class which are not set inside the constructor.
That functions is appeared as processParams().
But I'm not sure its a good name for that method.
Will a name like setProperties() or setAdditionalProperties() more
suitable
for this function ?
Welcome to any suggestions.
Hi Chanaka,
Assuming that you are talking about the properties that are not set
with a constructor parameter (the properties should be defined in the
constructor anyway, but not necessarely with a value supplied by a
constructor parameter), I think setProperties() is the best choice.
Yes, that's good.
Would this method only set the properties that cannot be set with a
constructor parameter, or just any property?
This method only set the properties which cannot be set in constructor.
Maybe you can consider calling it setProperty($name, $value). This
enables you to set just any parameter.
The class already have a method called __set($name, $value) to set any of
the property in class.
But since there are around 17 properties to initialized, I think better to
use this setProperties() method.
How are your properties defined? As single variables? Or as an array
of properties?
Sorry if I'm not calling to your question. (I'm not clear about what you try
to ask.)
This is what I meant : Do you have a single array (or an container
class) with properties, like :
private $_properties = array();
or do you define all your properties seperately (ommiting the
docblocks in this example) :
private $_property1;
private $_property2;
private $_property3;
...
private $_propertyN;
Kind regards,
Dieter