Ark
in package
Archival Resource Key (ARK).
Methods for minting ARKs.
Tags
Table of Contents
Methods
- areLexicalEquivalent() : bool
- Compare multiple ARKs for lexical equivalence
- generate() : string
- Generate an ARK of desired length with given NAAN and character repetoire.
- normalize() : string
- Normalization for ARK.
- removeDuplicateChars() : string|array<string|int, string>
- Remove duplicate characters from repetoire.
- splitIntoComponents() : array<string|int, mixed>
- Split ARK into components.
Methods
areLexicalEquivalent()
Compare multiple ARKs for lexical equivalence
public
static areLexicalEquivalent(array<string|int, string> $arks) : bool
Checks if all ARKs in a list are lexically equivalent.
Parameters
- $arks : array<string|int, string>
-
List containing arks .
Tags
Return values
bool —True if all ARKs in list are lexically equivalent, false otherwise
generate()
Generate an ARK of desired length with given NAAN and character repetoire.
public
static generate(string $naan, string $xdigits, int $length[, string $shoulder = null ][, string $nma = null ][, bool $ncda = true ][, bool $slashAfterLabel = false ]) : string
Parameters
- $naan : string
-
Name Assigning Authority Number.
- $xdigits : string
-
Charachter repetoire e.g. "0123456789bcdfghjkmnpqrstvwxz".
- $length : int
-
Desired length of ID.
- $shoulder : string = null
-
Prefix to blade (default: null).
- $nma : string = null
-
Name Mapping Authority (default: null).
- $ncda : bool = true
-
Executes Noid Check Digit Algorithm and appends result to blade (default: true).
- $slashAfterLabel : bool = false
-
Include / in label part e.g. ark:/ (default: false).
Tags
Return values
string —$id Generated ARK.
normalize()
Normalization for ARK.
public
static normalize(mixed $ark) : string
Reformats string containing an ARK into a normalized form.
Parameters
- $ark : mixed
-
ARK or URI containing an ARK.
Tags
Return values
stringremoveDuplicateChars()
Remove duplicate characters from repetoire.
public
static removeDuplicateChars(string $xdigits[, bool $sort = true ][, bool $arr = false ]) : string|array<string|int, string>
Duplicate characters get removed from given string.
Parameters
- $xdigits : string
-
String containing the character repetoire.
- $sort : bool = true
-
Sort the characters
- $arr : bool = false
-
Return the characters as array.
Tags
Return values
string|array<string|int, string>splitIntoComponents()
Split ARK into components.
public
static splitIntoComponents(string $ark) : array<string|int, mixed>
Splits an ARK into the following components: Resolver Service, NAAN, Base Name, Base Compact Name, Check Zone and Suffixes.
Parameters
- $ark : string
Tags
Return values
array<string|int, mixed> —In case of an invalid array, the returned array, will have empty values.