You are here

public static function AuthcacheP13nObjectFactory::ensureClass in Authenticated User Page Caching (Authcache) 7.2

Throw an exception if given value cannot be used in place of class.

Return value

var The input value.

Throws

AuthcacheP13nObjectFactoryException

File

modules/authcache_p13n/includes/AuthcacheP13nObjectFactory.inc, line 346
Defines the class AuthcacheP13nObjectFactory.

Class

AuthcacheP13nObjectFactory
A utility class helping with dependency injection.

Code

public static function ensureClass($value, $class, $name) {
  if (!is_a($value, $class)) {
    throw new AuthcacheP13nObjectFactoryException("Resource {$name} must be an instance of {$class}");
  }
  return $value;
}