Documentation

Gesetz
in package
Uses Regex

Class Gesetz

Utilities for dealing with german legal norms

Table of Contents

$attributes  : array<string|int, mixed>
Defines HTML attributes
$drivers  : array<string|int, mixed>
Available providers
$groups  : array<string|int, mixed>
Names for capturing groups
$pattern  : string
The regex, holding the world together in its inmost folds
$title  : string|false
Controls `title` attribute
__construct()  : void
Constructor
analyze()  : array<string|int, mixed>
Analyzes a single legal norm
extract()  : array<string|int, mixed>
Extracts legal norms as array of strings
gesetzify()  : string
Converts legal references throughout text into `a` tags
roman2arabic()  : int
Converts roman numerals to arabic numerals
validate()  : bool
Validates a single legal norm (across all providers)
groupMatch()  : array<string|int, mixed>
Creates match array
linkify()  : string
Converts matched legal reference into `a` tag

Properties

$attributes

Defines HTML attributes

public array<string|int, mixed> $attributes = []

$drivers

Available providers

public array<string|int, mixed> $drivers = []

$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)/'

$title

Controls `title` attribute

public string|false $title = false

Possible values:

'light' => abbreviated law (eg 'GG') 'normal' => complete law (eg 'Grundgesetz') 'full' => official heading (eg 'Art 45d Parlamentarisches Kontrollgremium')

Methods

__construct()

Constructor

public __construct([string|array<string|int, mixed> $drivers = null ]) : void
Parameters
$drivers : string|array<string|int, mixed> = null

Identifiers of providers to be used

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

extract()

Extracts legal norms as array of strings

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

Text

Return values
array<string|int, mixed>

gesetzify()

Converts legal references throughout text into `a` tags

public gesetzify(string $string[, callable $callback = null ]) : string
Parameters
$string : string

Unprocessed text

$callback : callable = null

Callback function

Return values
string

Processed text

roman2arabic()

Converts roman numerals to arabic numerals

public static roman2arabic(string $string) : int
Parameters
$string : string
Tags
throws
Exception
Return values
int

validate()

Validates a single legal norm (across all providers)

public validate(string $string) : bool
Parameters
$string : string

Legal norm

Return values
bool

Whether legal norm is valid (with regard to its 'linkability')

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

linkify()

Converts matched legal reference into `a` tag

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

Matched legal norm

Return values
string

Search results