Get a EasyRdf_Format from a name, uri or mime type
string $query a query string to search for:
object the first EasyRdf_Format that matches the query
EasyRdf_Exception if no format is found
public static function getFormat($query) {
if (!is_string($query) or $query == null or $query == '') {
throw new InvalidArgumentException("\$query should be a string and cannot be null or empty");
}
foreach (self::$formats as $format) {
if ($query == $format->name or $query == $format->uri or array_key_exists($query, $format->mimeTypes) or in_array($query, $format->extensions)) {
return $format;
}
}
# No match
throw new EasyRdf_Exception("Format is not recognised: {$query}");
}