You are here

public static function EasyRdf_TypeMapper::set in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/easyrdf/easyrdf/lib/EasyRdf/TypeMapper.php \EasyRdf_TypeMapper::set()

Register an RDF type with a PHP Class name

Parameters

string $type The RDF type (e.g. foaf:Person):

string $class The PHP class name (e.g. Model_Foaf_Name):

Return value

string The PHP class name

1 call to EasyRdf_TypeMapper::set()
TypeMapper.php in vendor/easyrdf/easyrdf/lib/EasyRdf/TypeMapper.php

File

vendor/easyrdf/easyrdf/lib/EasyRdf/TypeMapper.php, line 79

Class

EasyRdf_TypeMapper
Class to map between RDF Types and PHP Classes

Code

public static function set($type, $class) {
  if (!is_string($type) or $type == null or $type == '') {
    throw new InvalidArgumentException("\$type should be a string and cannot be null or empty");
  }
  if (!is_string($class) or $class == null or $class == '') {
    throw new InvalidArgumentException("\$class should be a string and cannot be null or empty");
  }
  $type = EasyRdf_Namespace::expand($type);
  return self::$map[$type] = $class;
}