We can not know. And this is the only correct answer to this specific question.
One thing people do not understand about object orientation is that it is not a way to apply cake recipes and everything looks beautiful and will work wonderfully. It's not the OOP engines that make the code look good, it's how applying them is what makes the code good or bad .
You can not say if something is right or wrong, without knowing the context, without referring to a specific case. That's why I always say that this "best practice" business does not work. If it were a checklist always considering options would be a good one, but in the way they are usually exposed and propagated they usually cause more harm than good. They do not consider context and, in general, "push" an idea that one wants to "sell". And make no mistake, you're always willing to sell something, I'm doing it now. Only you can discern what is best and know when to apply what in each case.
The question has no requirements, it does not say what it needs to do, so it does not do what it does. That's what I say, before you know the answer you need to know the question. When the question is wrong (part of the wrong premise), incomplete (does not have all the necessary data), or is irrelevant (it does not matter), the answer will never be adequate.
In abstract examples one can speak of the mechanism, but one can not speak of its suitability. And the question is about adequacy and not about the mechanism.
I do not know if you need the builder, I do not know if it is enough. I do not know if I have to access or allow to modify each of the members in isolation. And if I can, I do not know if there should be anything else in it. I do not know if a public field is sufficient, usually in PHP it is. I do not know if the correct one should use __get()
and __set()
default language. I do not know if it should be a class or an associative array, maybe with some loose functions, that's enough.
If the code were this, I would go by the simplest path that is an associative array with a function that delivers the most formatted data. If I had a context there I could say how I would. But I already added that in PHP I would still do it very simply, it would not create unnecessary things. I do not adopt the post cult programming .