private constants

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: private constants

Post by Jenk »

Yes, that is a caveat on it. I do regularly use private properties myself, but my beef is not having access to them at all, rather than directly via $obj->_prop, infact I'd much rather have an accessor (and mutator if needed.) The previous example I gave, would actually be better solved with a factory that I can have a 'test mode' on, so that the factory returns the mock when in testing mode, and the normal stream when not.
Post Reply