I read many times about encapsulation, but always I see a code like this I finish wondering the same. Is it this encapsulation?
class create_active_parent{
function __construct(){
//something
}
function clean_queues_redis(){
//creating in this way an object, and using it, is not encapsulation, is it?
$redis = RedisDB::fetch_instance();
$redis->db->flushdb();
}
Encapsulation is to hide private fields from outside. $redis is just a local variable, and it will die at the end of clean_queues_redis method execution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With