I do a lot of stuff specifically with PHP and WordPress, and I've come across this concept quite often throughout the WordPress application; although, this question isn't specific to WordPress. I'll demonstrate with an example.
Say there is some global object of a class.
global $foo;
$foo = new Foo();
And then this class has some sort of accessor method that could be used with our global object.
global $foo;
$bar = $foo->get_bar();
Well, often I see this wrapped in a general function that takes care of tapping into the object's method, essentially hiding that part of it, making it more simple to access that item.
function wp_get_bar() {
global $foo;
return $foo->get_bar();
}
And so a developer using the application could just do this where ever they wanted without knowing about the $foo global object specifically:
$bar = wp_get_bar();
I'm just curious if this is a general computer science concept? If so, is there a name for it? Or is this something I can read more about somewhere?