Documentation

Driver
in package
Uses Regex

Class Driver

Base template for drivers

Table of Contents

$groups  : array<string|int, mixed>
Names for capturing groups
$pattern  : string
The regex, holding the world together in its inmost folds
$identifier  : string
Individual identifier
$library  : array<string|int, mixed>
Available laws
__construct()  : void
Constructor
analyze()  : array<string|int, mixed>
Analyzes a single legal norm
buildAttributes()  : array<string|int, mixed>
Builds HTML attributes for corresponding legal norm
validate()  : bool
Validates a single legal norm
buildTitle()  : string
Builds description for corresponding legal norm
buildURL()  : string
Builds URL for corresponding legal norm
groupMatch()  : array<string|int, mixed>
Creates match array

Properties

$groups

Names for capturing groups

public array<string|int, mixed> $groups = ['norm', 'absatz', 'satz', 'nr', 'lit', 'gesetz']

$pattern

The regex, holding the world together in its inmost folds

public string $pattern = '' . '/' . '(?:§+|&sect;|Art\\.?|Artikel)\\s*' . '(\\d+(?:\\w\\b)?)\\s*' . '(?:(?:Abs(?:atz|\\.)\\s*)?((?:\\d+|[XIV]+)(?:\\w\\b)?))?\\s*' . '(?:(?:S\\.|Satz)\\s*(\\d+))?\\s*' . '(?:(?:Nr\\.|Nummer)\\s*(\\d+(?:\\w\\b)?))?\\s*' . '(?:(?:lit\\.|litera|Buchst\\.|Buchstabe)\\s*([a-z]?))?' . '.{0,10}?' . '(\\b[A-Z][A-Za-z]*[A-Z](?:(?:\\s|\\b)[XIV]+)?\\b)' . '/'

For reference:

'/(?:§+|Art.?|Artikel)\s*(\d+(?:\w\b)?)\s*(?:(?:Abs(?:atz|.)\s*)?((?:\d+|[XIV]+)(?:\w\b)?))?\s*(?:(?:S.|Satz)\s*(\d+))?\s*(?:(?:Nr.|Nummer)\s*(\d+(?:\w\b)?))?\s*(?:(?:lit.|litera|Buchst.|Buchstabe)\s*([a-z]?))?.{0,10}?(\b[A-Z][A-Za-z]*A-Z?\b)/'

$identifier

Individual identifier

protected string $identifier = ''

$library

Available laws

protected array<string|int, mixed> $library

Methods

__construct()

Constructor

public __construct([string $file = null ]) : void
Parameters
$file : string = null

Path to JSON index file

Tags
throws
Exception
Return values
void

analyze()

Analyzes a single legal norm

public analyze(string $string) : array<string|int, mixed>
Parameters
$string : string

Legal norm

Return values
array<string|int, mixed>

Formatted regex match

buildAttributes()

Builds HTML attributes for corresponding legal norm

public buildAttributes(string|array<string|int, mixed> $data[, string|false $mode = null ]) : array<string|int, mixed>
Parameters
$data : string|array<string|int, mixed>

Matched text OR formatted regex match

$mode : string|false = null

Mode of operation

Return values
array<string|int, mixed>

validate()

Validates a single legal norm

public validate(string|array<string|int, mixed> $data) : bool
Parameters
$data : string|array<string|int, mixed>

Matched text OR formatted regex match

Return values
bool

Validity of legal norm

buildTitle()

Builds description for corresponding legal norm

protected buildTitle(string|array<string|int, mixed> $data[, string|false $mode = null ]) : string

Used as title attribute

Parameters
$data : string|array<string|int, mixed>

Matched text OR formatted regex match

$mode : string|false = null

Mode of operation

Return values
string

buildURL()

Builds URL for corresponding legal norm

protected abstract buildURL(string|array<string|int, mixed> $data) : string

Used as href attribute

Parameters
$data : string|array<string|int, mixed>

Matched text OR formatted regex match

Return values
string

groupMatch()

Creates match array

private groupMatch(array<string|int, mixed> $match) : array<string|int, mixed>
Parameters
$match : array<string|int, mixed>

Matched legal norm

Return values
array<string|int, mixed>

Formatted regex match

Search results