There's no harm in doing it that way. By convention across my classes though I declare properties private and provide access via public getter methods.
The reason I use getters instead of direct access to properties (especially in PHP) is you can hide a lot of laziness behind them (i.e. database runs, object initialization etc) while at the same time providing a consistent interface to client code.
2 comments
[ 3.1 ms ] story [ 19.6 ms ] thread$config->databaseUrl;
versus
$config->getDatabaseUrl();
?
The reason I use getters instead of direct access to properties (especially in PHP) is you can hide a lot of laziness behind them (i.e. database runs, object initialization etc) while at the same time providing a consistent interface to client code.