In recent reading, I see conflicting recommendations on encapsulation methods and OOP best practices.
I am beginning development of a series of PHP classes that will be used to transport and transform data from multiple source systems to a final destination. Therefore, the properties of the first class are to contain source URL and authentication values.
Which of the following is best for a long-term project with unlimited potential for expansion?
Declare as public properties. Set values externally for each source when constructing class. Pro: simple. Con: No encapsulation advantage
Use __get and __set. Set values externally for each source. Pro: Follows OOP convention. Con: Opens all to external access; again, no encapsulation
Declare properties as protected. For each source system I need to work with, extend the original class and set the properties in the subclass. Pro:OOP with encapsulation. Con: more classes, and potentially files, to manage.
Currently, option 3 seems the best, despite the file overhead. I'm also open to other ideas.
References I have read for this question:
http://typicalprogrammer.com/?p=23
http://www.php.net/manual/en/language.oop5.overloading.php
Independent getter/setter methods, or combined?