You are here

public static function EasyRdf_TypeMapper::get in Zircon Profile 8

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

Get the registered class for an RDF type

If a type is not registered, then this method will return null.

Parameters

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

Return value

string The class name (e.g. Model_Foaf_Name)

1 call to EasyRdf_TypeMapper::get()
EasyRdf_Graph::classForResource in vendor/easyrdf/easyrdf/lib/EasyRdf/Graph.php
Work out the class to instantiate a resource as @ignore

File

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

Class

EasyRdf_TypeMapper
Class to map between RDF Types and PHP Classes

Code

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