public static function EasyRdf_Format::register

Register a new format

Parameters

string $name The name of the format (e.g. ntriples):

string $label The label for the format (e.g. N-Triples):

string $uri The URI for the format:

string $mimeTypes One or more mime types for the format:

string $extensions One or more extensions (file suffix):

Return value

object The new EasyRdf_Format object

4 calls to EasyRdf_Format::register()
Arc.php in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Serialiser/Arc.php
EasyRdf_Format::registerParser in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Format.php
Class method to register a parser class to a format name
EasyRdf_Format::registerSerialiser in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Format.php
Class method to register a serialiser class to a format name
Format.php in drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Format.php

File

drupal/core/vendor/easyrdf/easyrdf/lib/EasyRdf/Format.php, line 165

Class

EasyRdf_Format
Class the represents an RDF file format.

Code

public static function register($name, $label = null, $uri = null, $mimeTypes = array(), $extensions = array()) {
  if (!is_string($name) or $name == null or $name == '') {
    throw new InvalidArgumentException("\$name should be a string and cannot be null or empty");
  }
  if (!array_key_exists($name, self::$formats)) {
    self::$formats[$name] = new EasyRdf_Format($name);
  }
  self::$formats[$name]
    ->setLabel($label);
  self::$formats[$name]
    ->setUri($uri);
  self::$formats[$name]
    ->setMimeTypes($mimeTypes);
  self::$formats[$name]
    ->setExtensions($extensions);
  return self::$formats[$name];
}