TestBase::_callMethod PHP Method

_callMethod() protected static method

protected static _callMethod ( $objectOrClassName, $methodName, $args = null )
    protected static function _callMethod($objectOrClassName, $methodName, $args = null)
    {
        $isStatic = is_string($objectOrClassName);
        if (!$isStatic) {
            if (!is_object($objectOrClassName)) {
                throw new Exception('Method call on non existent object or class');
            }
        }
        $class = $isStatic ? $objectOrClassName : get_class($objectOrClassName);
        $object = $isStatic ? null : $objectOrClassName;
        $reflectionClass = new ReflectionClass($class);
        $method = $reflectionClass->getMethod($methodName);
        $method->setAccessible(true);
        return $method->invokeArgs($object, $args);
    }