public static function EasyRdf_Namespace::set

Register a new namespace.

Parameters

string $prefix The namespace prefix (eg 'foaf'):

string $long The namespace URI (eg 'http://xmlns.com/foaf/0.1/'):

1 call to EasyRdf_Namespace::set()
EasyRdf_Namespace::splitUri in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Namespace.php
Try and breakup a URI into a prefix and local part

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Namespace.php, line 145

Class

EasyRdf_Namespace
A namespace registry and manipulation class.

Code

public static function set($prefix, $long) {
  if (!is_string($prefix) or $prefix === null or $prefix === '') {
    throw new InvalidArgumentException("\$prefix should be a string and cannot be null or empty");
  }
  if (preg_match('/\\W/', $prefix)) {
    throw new InvalidArgumentException("\$prefix should only contain alpha-numeric characters");
  }
  if (!is_string($long) or $long === null or $long === '') {
    throw new InvalidArgumentException("\$long should be a string and cannot be null or empty");
  }
  $prefix = strtolower($prefix);
  self::$namespaces[$prefix] = $long;
}