This a bug. PHP allows you to use properties you haven't declared.
Both $config
and $db
will be public, because that is the default declaration.
There is no good reason to use undeclared properties.
This class looks poorly designed. The input is a registry
but it only needs "config"
and "db"
, so why isn't the signature:
public function __construct(DB $db, Config $config)
You can also wonder whether an object named Customer
(which looks like a data wrapper) should be given a DB
object.
Based on all the other private variables there doesn't actually seem any use for $db
and $config
because it's all just flat data.