Code: Select all
<?php
class A {
//
protected function _doSomething()
{
// some code
}
//
public function doSomething()
{
$this->_doSomething();
}
}
?>I have 2 questions about this:Wikipedia wrote: A wrapper function is a function in a computer program whose main purpose is to call a second function with little or no additional computation.
1. What determines the use of a wrapper function? If you create a wrapper function for each protected method this would increase the amount of code you have to check / work through at a later stage.
2. Setting the method to protected stops it from being used outside the class but inside the class, what is a better option: to wrap the protected method or use it directly (throughout the class and any classes extended from the innitial class)?