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.