Check that a URI/resource parameter is valid, and convert it to a string @ignore
protected function checkResourceParam(&$resource, $allowNull = false) {
if ($allowNull == true) {
if ($resource === null) {
if ($this->uri) {
$resource = $this->uri;
}
else {
return;
}
}
}
elseif ($resource === null) {
throw new InvalidArgumentException("\$resource cannot be null");
}
if (is_object($resource) and $resource instanceof EasyRdf_Resource) {
$resource = $resource
->getUri();
}
elseif (is_object($resource) and $resource instanceof EasyRdf_ParsedUri) {
$resource = strval($resource);
}
elseif (is_string($resource)) {
if ($resource == '') {
throw new InvalidArgumentException("\$resource cannot be an empty string");
}
elseif (preg_match("|^<(.+)>\$|", $resource, $matches)) {
$resource = $matches[1];
}
else {
$resource = EasyRdf_Namespace::expand($resource);
}
}
else {
throw new InvalidArgumentException("\$resource should be a string or an EasyRdf_Resource");
}
}