You are here

function messaging_check_object in Messaging 7

Same name and namespace in other branches
  1. 6.4 messaging.module \messaging_check_object()

Check that a parameter is an instance of a given class

File

./messaging.module, line 517

Code

function messaging_check_object($object, $class, $create = FALSE) {
  if ($object && is_object($object) && is_a($object, $class)) {
    return $object;
  }
  elseif ($create) {
    return new $class($object);
  }
}