PHPPM\Utils::bindAndCall PHP Метод

bindAndCall() публичный статический Метод

Executes a function in the context of an object. This basically bypasses the private/protected check of PHP.
public static bindAndCall ( callable $fn, object $newThis, array $args = [], string $bindClass = null )
$fn callable
$newThis object
$args array
$bindClass string
    public static function bindAndCall(callable $fn, $newThis, $args = [], $bindClass = null)
    {
        $func = \Closure::bind($fn, $newThis, $bindClass ?: get_class($newThis));
        if ($args) {
            call_user_func_array($func, $args);
        } else {
            $func();
            //faster
        }
    }