/** * Sets the default resource class * * @param string $class The resource full class name (e.g. \MyCompany\Resource) * * @throws \InvalidArgumentException * @return string The default Resource class */ public static function setDefaultResourceClass($class) { if (!is_string($class) or $class == null or $class == '') { throw new \InvalidArgumentException("\$class should be a string and cannot be null or empty"); } if (!class_exists($class)) { throw new \InvalidArgumentException("Given class should be an existing class"); } $ancestors = class_parents($class); if ($class != 'EasyRdf\\Resource' && (empty($ancestors) || !in_array('EasyRdf\\Resource', $ancestors))) { throw new \InvalidArgumentException("Given class should have EasyRdf\\Resource as an ancestor"); } return self::$defaultResourceClass = $class; } } /* Register default set of mapped types */ TypeMapper::set('rdf:Alt', 'EasyRdf\\Container'); TypeMapper::set('rdf:Bag', 'EasyRdf\\Container'); TypeMapper::set('rdf:List', 'EasyRdf\\Collection'); TypeMapper::set('rdf:Seq', 'EasyRdf\\Container');