You are here

public static function EasyRdf_Namespace::get in Zircon Profile 8

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

Return a namespace given its prefix.

Parameters

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

Return value

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

8 calls to EasyRdf_Namespace::get()
EasyRdf_Namespace::expand in vendor/easyrdf/easyrdf/lib/EasyRdf/Namespace.php
Expand a shortened URI (qname) back into a full URI.
EasyRdf_Parser_Rdfa::expandCurie in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Rdfa.php
EasyRdf_Parser_Turtle::parseCollection in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a collection [16], e.g: ( item1 item2 item3 ) @ignore
EasyRdf_Parser_Turtle::parseNumber in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parses a numeric value, either of type integer, decimal or double @ignore
EasyRdf_Parser_Turtle::parsePredicate in vendor/easyrdf/easyrdf/lib/EasyRdf/Parser/Turtle.php
Parse a predicate [11] @ignore

... See full list

File

vendor/easyrdf/easyrdf/lib/EasyRdf/Namespace.php, line 137

Class

EasyRdf_Namespace
A namespace registry and manipulation class.

Code

public static function get($prefix) {
  if (!is_string($prefix) or $prefix === null) {
    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");
  }
  $prefix = strtolower($prefix);
  $namespaces = self::namespaces();
  if (array_key_exists($prefix, $namespaces)) {
    return $namespaces[$prefix];
  }
  else {
    return null;
  }
}