Deceptively, the word visibility has nothing to do with application security! Instead it is simply a mechanism to control the use of your code. It can be used to steer an inexperienced developer away from the public use of methods that should only be called inside the class definition.
privatekeyword in front of any property or method definition. You can label properties as
privateto enforce access only through public
Baseclass is defined with a protected property
$id. In order to access this property, the
setId()public methods are defined. The protected method