Erc
extends Anvl
in package
Electronic Resource Citation (ERC).
Methods for creating and interacting with ERC records.
Tags
Table of Contents
Constants
- ENCODINGSCHEME : mixed = ["chr" => [' ', '!', '"', '#', '$', '&', '\'',...
Properties
- $record : array<string|int, mixed>
- $lineLength : int
Methods
- __construct() : mixed
- ERC Record.
- add() : void
- Add Kernel element.
- addComment() : void
- Add Comment
- decodeElementValue() : string
- Decode element value.
- decodeRecord() : string
- Decode record.
- encodeElementValue() : string
- Encode element value.
- isValidKernelElementLabel() : bool
- Kernel Element Label Validation.
- isValidRecord() : bool
- ERC record Validation.
- load() : void
- Load ERC record.
- mergeRecords() : string|null
- Merge two Records.
- record() : string
- Retrieve record.
Constants
ENCODINGSCHEME
public
mixed
ENCODINGSCHEME
= ["chr" => [' ', '!', '"', '#', '$', '&', '\'', '(', ')', '*', '+', ',', '.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']', '|'], "code" => ['%sp', '%ex', '%dq', '%ns', '%do', '%am', '%sq', '%op', '%cp', '%as', '%pl', '%co', '%pd', '%sl', '%cn', '%sc', '%lt', '%eq', '%gt', '%qu', '%at', '%ox', '%ls', '%cx', '%vb']]
Properties
$record
public
array<string|int, mixed>
$record
$lineLength
protected
int
$lineLength
Methods
__construct()
ERC Record.
public
__construct([int $lineLength = 72 ]) : mixed
Parameters
- $lineLength : int = 72
-
The number of characters at which the element-bodies will be wrapped (default: 72).
add()
Add Kernel element.
public
add(string $elementName, string $elementBody) : void
Add a Kernel element to the record.
Parameters
- $elementName : string
-
String beginning with a letter that may contain any combination of letters, numbers, hyphens, and underscores. An element label may also be accompanied by its coded synonym e. g. wer(h1)
- $elementBody : string
-
Value of the element will be encoded.
Attributes
- #[Override]
addComment()
Add Comment
public
addComment(string $comment) : void
Parameters
- $comment : string
-
Any text.
decodeElementValue()
Decode element value.
public
static decodeElementValue(string $value) : string
Parameters
- $value : string
-
String which should be decoded.
Tags
Return values
stringdecodeRecord()
Decode record.
public
static decodeRecord(string $record) : string
Get record in decoded form.
Parameters
- $record : string
-
String containing a valid ERC record.
Return values
stringencodeElementValue()
Encode element value.
public
static encodeElementValue(string $value) : string
Parameters
- $value : string
-
String which should be encoded.
Tags
Return values
stringisValidKernelElementLabel()
Kernel Element Label Validation.
public
static isValidKernelElementLabel(string $label) : bool
Kernel element labels are strings beginning with a letter that may contain any combination of letters, numbers, hyphens, and underscores ("_"). An element label may also be accompanied by its coded synonym e. g. wer(h1).
Parameters
- $label : string
Tags
Return values
boolisValidRecord()
ERC record Validation.
public
static isValidRecord(string $record[, array<string|int, string>|null $labelList = null ]) : bool
Checks if string is a valid ERC record.
Parameters
- $record : string
-
String to check.
- $labelList : array<string|int, string>|null = null
-
Optionally pass a list of allowed labels.
Return values
boolload()
Load ERC record.
public
load(string $record) : void
Parameters
- $record : string
Attributes
- #[Override]
mergeRecords()
Merge two Records.
public
static mergeRecords(string $primaryRecord, string $secondaryRecord[, string|null $strategy = null ][, bool $decode = false ]) : string|null
Parameters
- $primaryRecord : string
- $secondaryRecord : string
- $strategy : string|null = null
-
Strategy how element-bodies should be merged. Possible strategies "keep", "overwrite", "substitute".
- $decode : bool = false
-
If the returned record should be decoded (default: false).
Return values
string|nullrecord()
Retrieve record.
public
record([bool $comments = false ][, bool $decode = true ]) : string
Parameters
- $comments : bool = false
-
Hide comments.
- $decode : bool = true
-
Decode values.
Attributes
- #[Override]