This relates to a minor dilemma I come across from time and time, and
I'm looking for advice on pros and cons and best practice. Last night I
encountered it again.
Within a site I have a User object, and within page code would like to have
if ($crntUser->isASubscriber) {...}
There seems to be two ways to handle this:
I can have a User object method "getSubscriberStatus()" which sets
$this->isASubscriber. But to use this I would have to run the method
just before the if statement.
Or I could have a method "isASubscriber()" which returns the result,
meaning the if statement should be
if ($crntUser->isASubscriber()) {...}
While this is last night's specific example, I seem to face the
method-setting-variable or the method-returning-result-directly decision
quite often.
Is either of these approaches preferable, or does it simply not matter?
Thanks
Roddie Grant
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php