Array

object @Array() {
	clear(object $array): object {}
	combine(object $keys, object $values): object {}
	complementByKeys(object $array, ...$arrays): object {}
	complementByValues(object $array, ...$arrays): object {}
	concat(object $array, ...$arrays): object {}
	contains(object $array, ...$arrays): bool {}
	count(object $array): int {}
	countDistinctValues(object $array): int {}
	countUsedValues(object $array): object {}
	countValue(object $array, mixed $value): int {}
	createAssociative(object $keys, mixed $value): object {}
	createIndex(int $length, mixed $value): object {}
	createRange(number $from, number $to, number $step): object {}
	equals(object $array1, object $array2): bool {}
	equalsInOrder(object $array1, object $array2): bool {}
	every(object $array, function $callback, ?object $bind): bool {}
	filter(object $array, function $callback, ?object $bind): object {}
	findKey(object $array, function $callback, ?object $bind): int {}
	findValue(object $array, function $callback, ?object $bind): mixed {}
	firstKey(object $array): int {}
	firstValue(object $array): mixed {}
	flip(object $array, ?string $key): object {}
	forEach(object $array, function $callback, ?object $bind) {}
	fromCSV(string $string, string $delimiter): object {}
	hasKey(object $array, string $key): bool {}
	hasKeys(object $array, object $keys): bool {}
	hasSameKeys(object $array1, object $array2): bool {}
	hasSameValues(object $array1, object $array2): bool {}
	hasValue(object $array, mixed $value): bool {}
	hasValues(object $array, object $values): bool {}
	head(object $array): object {}
	insert(object $array, object $values, int $offset): object {}
	intersectByKeys(object $array, ...$arrays): object {}
	intersectByValues(object $array, ...$arrays): object {}
	isEmpty(object $array): bool {}
	isIndexed(object $array): bool {}
	isMultidimensional(object $array): bool {}
	joinKeys(object $array, string $delimiter): string {}
	joinNonEmptyValues(object $array, string $delimiter, ?string $key): string {}
	joinValues(object $array, string $delimiter, ?string $key): string {}
	keyOf(object $array, mixed $value): int {}
	lastKey(object $array): int {}
	lastKeyOf(object $array, mixed $value): int {}
	lastValue(object $array): mixed {}
	linearize(object $array, string $key): object {}
	listKeys(object $array): object {}
	listValues(object $array, ?string $key): object {}
	map(object $array, function $callback, ?object $bind): object {}
	merge(object $array, ...$arrays): object {}
	pad(object $array, int $length, mixed $padding): object {}
	partition(object $array, int $length): object {}
	pop(object $array): mixed {}
	push(object $array, mixed $value): object {}
	randomKey(object $array): int {}
	randomValue(object $array): mixed {}
	reduce(object $array, mixed $initial, function $callback, ?object $bind): mixed {}
	reindex(object $array, int $initial): object {}
	remove(object $array, ...$arrays): object {}
	removeKey(object $array, string $key): object {}
	removeKeys(object $array, object $keys): object {}
	removeValue(object $array, mixed $value): object {}
	removeValues(object $array, object $values): object {}
	repeat(object $values, int $count): object {}
	replace(object $array, ...$arrays): object {}
	reverse(object $array): object {}
	shift(object $array): mixed {}
	shuffle(object $array): object {}
	slice(object $array, int $offset, ?int $length): object {}
	some(object $array, function $callback, ?object $bind): bool {}
	sortAscByKeys(object $array): object {}
	sortAscByValues(object $array, ?string $key): object {}
	sortByKeys(object $array, function $callback, ?object $bind): object {}
	sortByValues(object $array, function $callback, ?object $bind, ?string $key): object {}
	sortDescByKeys(object $array): object {}
	sortDescByValues(object $array, ?string $key): object {}
	sortMultidimensional(object $array, object $callbacks, ?object $bind): object {}
	sortNaturalAscByKeys(object $array): object {}
	sortNaturalAscByValues(object $array, ?string $key): object {}
	sortNaturalDescByKeys(object $array): object {}
	sortNaturalDescByValues(object $array, ?string $key): object {}
	splice(object $array, int $offset, ?int $length, object $replacement): object {}
	tail(object $array): object {}
	toCSV(object $array, string $delimiter, bool $enclosed): string {}
	toLowerKeys(object $array): object {}
	toUpperKeys(object $array): object {}
	unionByKeys(object $array, ...$arrays): object {}
	unionByValues(object $array, ...$arrays): object {}
	unique(object $array, ?string $key): object {}
	unshift(object $array, mixed $value): object {}
	valueAt(object $array, string $key): mixed {}
}

Static array related prototypes and functions.

Functions

clear

@Array.clear(object $array): object

Clears an array by removing all elements.

This function is destructive, in the sense that it modifies the array in-place.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object

combine

@Array.combine(object $keys, object $values): object
Parameters
# Name Type Value Default
1 keys object [key, ...] []
2 values object [value, ...] []
Return Values
Type Value Description
object [keys-unique-string-value: last-applicable-value, ...]

complementByKeys

@Array.complementByKeys(object $array, ...$arrays): object
Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [retained-original-key: original-value, ...]

complementByValues

@Array.complementByValues(object $array, ...$arrays): object
Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [original-key: retained-original-value, ...]

concat

@Array.concat(object $array, ...$arrays): object

Concatenates specific values to an array.

This function is destructive, in the sense that it modifies the array in-place. It preserves the original keys in the array, but implicitly generates a consecutive numeric key for each added value.

Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [original-key: original-value, ..., concatenated-value, ...]

contains

@Array.contains(object $array, ...$arrays): bool

Determines whether an array contains specific elements.

Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
bool

count

@Array.count(object $array): int

Counts the total number of elements within an array.

This function is equivalent to the "count" operator on objects.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
int

countDistinctValues

@Array.countDistinctValues(object $array): int

Counts the total number of distinct values within an array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
int

countUsedValues

@Array.countUsedValues(object $array): object

Counts the total number of occurrences for each value within an array.

Values are interpreted as strings for the purpose of counting.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [unique-string-value: count, ...]

countValue

@Array.countValue(object $array, mixed $value): int

Counts the total number of occurrences of a specific value within an array.

Parameters
# Name Type Value Default
1 array object []
2 value mixed null
Return Values
Type Value Description
int

createAssociative

@Array.createAssociative(object $keys, mixed $value): object

Creates an associative array with uniformly initialized values.

Parameters
# Name Type Value Default
1 keys object []
2 value mixed null
Return Values
Type Value Description
object [keys-unique-string-value: init-value, ...]

createIndex

@Array.createIndex(int $length, mixed $value): object

Creates an indexed array of a specific length with uniformly initialized values.

This function implicitly generates a consecutive numeric key for each value.

Parameters
# Name Type Value Default
1 length int 0
2 value mixed null
Return Values
Type Value Description
object [init-value, ...]

createRange

@Array.createRange(number $from, number $to, number $step): object

Creates an indexed array with values of a specific numeric range.

This function implicitly generates a consecutive numeric key for each value.

Parameters
# Name Type Value Default
1 from number 0
2 to number 0
3 step number 1
Return Values
Type Value Description
object [range-value, ...]

equals

@Array.equals(object $array1, object $array2): bool

Determines whether two arrays are equal, not considering the order of elements, meaning they have the same elements, but not necessarily in the same order.

Parameters
# Name Type Value Default
1 array1 object []
2 array2 object []
Return Values
Type Value Description
bool

equalsInOrder

@Array.equalsInOrder(object $array1, object $array2): bool

Determines whether two arrays are equal, also considering the order of elements, meaning they have the same elements in the same order.

Parameters
# Name Type Value Default
1 array1 object []
2 array2 object []
Return Values
Type Value Description
bool

every

@Array.every(object $array, function $callback, ?object $bind): bool
Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null
Return Values
Type Value Description
bool

filter

@Array.filter(object $array, function $callback, ?object $bind): object

This function is destructive, in the sense that it modifies the array in-place.

Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null
Return Values
Type Value Description
object [retained-key: retained-value, ...]

findKey

@Array.findKey(object $array, function $callback, ?object $bind): int
Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null
Return Values
Type Value Description
int if integer key
string if string key
null if not found

findValue

@Array.findValue(object $array, function $callback, ?object $bind): mixed
Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null
Return Values
Type Value Description
mixed
null if not found

firstKey

@Array.firstKey(object $array): int

Returns the key of the first element within an array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
int if integer key
string if string key
null if the array is empty

firstValue

@Array.firstValue(object $array): mixed

Returns the value of the first element within an array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
mixed
null if the array is empty

flip

@Array.flip(object $array, ?string $key): object

Flips the elements of an array by exchanging keys for values.

A key may specify the column of a multidimensional array to flip by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is skipped.

Values are interpreted as strings for the purpose of flipping. If a value has several occurrences within the array, only the key of the last occurrence of that particular value is retained.

This function is destructive, in the sense that it modifies the array in-place.

Parameters
# Name Type Value Default
1 array object []
2 key ?string unidimensional
Return Values
Type Value Description
object [unique-string-value: last-applicable-key, ...]

forEach

@Array.forEach(object $array, function $callback, ?object $bind)
Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null

fromCSV

@Array.fromCSV(string $string, string $delimiter): object

This function is complementary to "toCSV".

Parameters
# Name Type Value Default
1 string string ""
2 delimiter string ";"
Return Values
Type Value Description
object [[value, ...], ...]

hasKey

@Array.hasKey(object $array, string $key): bool

Determines whether an array has a specific key.

This function is equivalent to the "in" operator on objects.

Parameters
# Name Type Value Default
1 array object []
2 key string "0"
Return Values
Type Value Description
bool

hasKeys

@Array.hasKeys(object $array, object $keys): bool

Determines whether an array has specific keys.

Parameters
# Name Type Value Default
1 array object []
2 keys object [key, ...] []
Return Values
Type Value Description
bool

hasSameKeys

@Array.hasSameKeys(object $array1, object $array2): bool

Determines whether two arrays have the same keys.

Parameters
# Name Type Value Default
1 array1 object []
2 array2 object []
Return Values
Type Value Description
bool

hasSameValues

@Array.hasSameValues(object $array1, object $array2): bool

Determines whether two arrays have the same values.

Parameters
# Name Type Value Default
1 array1 object []
2 array2 object []
Return Values
Type Value Description
bool

hasValue

@Array.hasValue(object $array, mixed $value): bool

Determines whether an array has a specific value.

Parameters
# Name Type Value Default
1 array object []
2 value mixed null
Return Values
Type Value Description
bool

hasValues

@Array.hasValues(object $array, object $values): bool

Determines whether an array has specific values.

Parameters
# Name Type Value Default
1 array object []
2 values object [value, ...] []
Return Values
Type Value Description
bool

head

@Array.head(object $array): object

Returns the head of an array, meaning only the first element.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [first-key: first-value]

insert

@Array.insert(object $array, object $values, int $offset): object

Inserts specific values into an array at a specific offset.

If the offset is negative, it inserts at that many elements from the end of the array.

This function is destructive, in the sense that it modifies the array in-place. It re-indexes all numeric keys in the array and implicitly generates a consecutive numeric key for each inserted value.

Parameters
# Name Type Value Default
1 array object []
2 values object [value, ...] []
3 offset int 0
Return Values
Type Value Description
object [(non-numeric-original-key: original-value) / original-value-if-numeric-key, ..., inserted-value, ..., (non-numeric-original-key: original-value) / original-value-if-numeric-key, ...]

intersectByKeys

@Array.intersectByKeys(object $array, ...$arrays): object
Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [retained-original-key: original-value, ...]

intersectByValues

@Array.intersectByValues(object $array, ...$arrays): object
Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [original-key: retained-original-value, ...]

isEmpty

@Array.isEmpty(object $array): bool

Determines whether an array is empty, meaning it does not contain any elements.

This function is equivalent to the "empty" operator on objects.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
bool

isIndexed

@Array.isIndexed(object $array): bool

Determines whether an array is indexed, meaning it only contains consecutive numeric keys from zero onwards.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
bool

isMultidimensional

@Array.isMultidimensional(object $array): bool

Determines whether an array is multidimensional, meaning it contains object values.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
bool

joinKeys

@Array.joinKeys(object $array, string $delimiter): string

Joins the keys of an array to form a string representation with each key separated by a specific delimiter.

Parameters
# Name Type Value Default
1 array object []
2 delimiter string ""
Return Values
Type Value Description
string

joinNonEmptyValues

@Array.joinNonEmptyValues(object $array, string $delimiter, ?string $key): string

Joins the values of an array to form a string representation with each value separated by a specific delimiter, whereas empty string values are ignored.

A key may specify the column of a multidimensional array to join by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is skipped.

Values are interpreted as strings for the purpose of joining.

Parameters
# Name Type Value Default
1 array object []
2 delimiter string ""
3 key ?string unidimensional
Return Values
Type Value Description
string

joinValues

@Array.joinValues(object $array, string $delimiter, ?string $key): string

Joins the values of an array to form a string representation with each value separated by a specific delimiter.

A key may specify the column of a multidimensional array to join by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is skipped.

Values are interpreted as strings for the purpose of joining.

Parameters
# Name Type Value Default
1 array object []
2 delimiter string ""
3 key ?string unidimensional
Return Values
Type Value Description
string

keyOf

@Array.keyOf(object $array, mixed $value): int

Returns the key of the first occurrence of a specific value within an array.

Parameters
# Name Type Value Default
1 array object []
2 value mixed null
Return Values
Type Value Description
int if integer key
string if string key
null if the value is not found

lastKey

@Array.lastKey(object $array): int

Returns the key of the last element within an array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
int if integer key
string if string key
null if the array is empty

lastKeyOf

@Array.lastKeyOf(object $array, mixed $value): int

Returns the key of the last occurrence of a specific value within an array.

Parameters
# Name Type Value Default
1 array object []
2 value mixed null
Return Values
Type Value Description
int
null if the value is not found

lastValue

@Array.lastValue(object $array): mixed

Returns the value of the last element within an array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
mixed
null if the array is empty

linearize

@Array.linearize(object $array, string $key): object

Linearizes the elements of a multidimensional array by a specific key.

If the key does not exist within the inner array, the corresponding element of the outer array is discarded.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 key string "0"
Return Values
Type Value Description
object [outer-key: inner-value-by-key, ...]

listKeys

@Array.listKeys(object $array): object

Lists all keys of an array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [original-key, ...]

listValues

@Array.listValues(object $array, ?string $key): object

Lists all values of an array.

A key may specify the column of a multidimensional array to list by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is skipped.

Parameters
# Name Type Value Default
1 array object []
2 key ?string unidimensional
Return Values
Type Value Description
object [original-value, ...]

map

@Array.map(object $array, function $callback, ?object $bind): object

This function is destructive, in the sense that it modifies the array in-place.

Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null
Return Values
Type Value Description
object [original-key: mapped-value, ...]

merge

@Array.merge(object $array, ...$arrays): object

Merges an array with specific elements, whereas duplicate non-numeric keys are overwritten while elements with numeric keys are appended.

This function is destructive, in the sense that it modifies the array in-place. It preserves the original keys in the array.

Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [original-key: (elements-value / original-value), ..., (supplemental-non-numeric-elements-key: elements-value) / elements-value-if-numeric-key, ...]

pad

@Array.pad(object $array, int $length, mixed $padding): object

Pads an array to a specific length by repeatedly filling it with a specific padding value.

If the length is positive, the array is padded right-sidedly at its end, if it is negative, the array is padded left-sidedly at its beginning.

This function is destructive, in the sense that it modifies the array in-place. It re-indexes all numeric keys in the array and implicitly generates a consecutive numeric key for each added value.

Parameters
# Name Type Value Default
1 array object []
2 length int 0
3 padding mixed null
Return Values
Type Value Description
object [(non-numeric-original-key: original-value) / original-value-if-numeric-key, ..., padding-value, ...]

partition

@Array.partition(object $array, int $length): object

Partitions an array into isolated chunks of a specific length.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 length int 1
Return Values
Type Value Description
object [[original-key: original-value, ...], ...]

pop

@Array.pop(object $array): mixed

Pops an element off the end of an array and returns its value.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
mixed
null if the array is empty

push

@Array.push(object $array, mixed $value): object

Pushes a specific value onto the end of an array.

This function is destructive, in the sense that it modifies the array in-place. It preserves the original keys in the array, but implicitly generate a consecutive numeric key for the added value. It is equivalent to the "[]" operator.

Parameters
# Name Type Value Default
1 array object []
2 value mixed null
Return Values
Type Value Description
object [original-key: original-value, ..., added-value]

randomKey

@Array.randomKey(object $array): int

Returns the key of a random element within an array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
int if integer key
string if string key
null if the array is empty

randomValue

@Array.randomValue(object $array): mixed

Returns the value of a random element within an array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
mixed
null if the array is empty

reduce

@Array.reduce(object $array, mixed $initial, function $callback, ?object $bind): mixed
Parameters
# Name Type Value Default
1 array object []
2 initial mixed null
3 callback function null
4 bind ?object null
Return Values
Type Value Description
mixed

reindex

@Array.reindex(object $array, int $initial): object

Re-indexes all elements of an array with consecutive numeric keys.

This function is destructive, in the sense that it modifies the array in-place. It re-indexes all keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 initial int 0
Return Values
Type Value Description
object [original-value, ...]

remove

@Array.remove(object $array, ...$arrays): object

Removes specific elements from an array.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [retained-key: retained-value, ...]

removeKey

@Array.removeKey(object $array, string $key): object

Remove the element with a specific key from an array.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 key string "0"
Return Values
Type Value Description
object [retained-key: original-value, ...]

removeKeys

@Array.removeKeys(object $array, object $keys): object

Removes elements with specific keys from an array.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 keys object [key, ...] []
Return Values
Type Value Description
object [retained-key: original-value, ...]

removeValue

@Array.removeValue(object $array, mixed $value): object

Removes elements with a specific value from an array.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 value mixed null
Return Values
Type Value Description
object [original-key: retained-value, ...]

removeValues

@Array.removeValues(object $array, object $values): object

Removes elements with specific values from an array.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 values object [value, ...] []
Return Values
Type Value Description
object [original-key: retained-value, ...]

repeat

@Array.repeat(object $values, int $count): object

Repeatedly concatenates specific values to themselves and returns the aligned end-to-end array.

This function implicitly generates a consecutive numeric key for each value.

Parameters
# Name Type Value Default
1 values object [value, ...] []
2 count int 1
Return Values
Type Value Description
object [first-value, ..., last-value, first-value, ..., last-value, ...]

replace

@Array.replace(object $array, ...$arrays): object

Replaces specific elements of an array based on common keys.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [original-key: (elements-value / original-value), ..., supplemental-elements-key: elements-value, ...]

reverse

@Array.reverse(object $array): object

Reverse the order of elements within an array.

This function is its own inverse. It is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [last-key: last-value, ..., first-key: first-value]

shift

@Array.shift(object $array): mixed

Shifts an element off the beginning of an array and returns its value.

This function is destructive, in the sense that it modifies the array in-place. It re-indexes all numeric keys in the array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
mixed
null if the array is empty

shuffle

@Array.shuffle(object $array): object

Suffles an array by randomizing the order of elements.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [reordered-key: original-value, ...]

slice

@Array.slice(object $array, int $offset, ?int $length): object

Slices an array by creating a shallow copy of a specific portion.

If the offset is negative, it starts that many elements from the end of the array. If the length is null, every element from the offset until the end of the array is returned, if it is negative, it stops that many elements from the end of the array.

This function preserves the keys in the array. It is equivalent to the "[..., ...]" operator on objects.

Parameters
# Name Type Value Default
1 array object []
2 offset int 0
3 length ?int maximum length
Return Values
Type Value Description
object [retained-key: retained-value, ...]

some

@Array.some(object $array, function $callback, ?object $bind): bool
Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null
Return Values
Type Value Description
bool

sortAscByKeys

@Array.sortAscByKeys(object $array): object

Sorts an array by keys in ascending lexicographic or numeric order.

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [reordered-key: original-value, ...]

sortAscByValues

@Array.sortAscByValues(object $array, ?string $key): object

Sorts an array by values in ascending lexicographic or numeric order.

A key may specify the column of a multidimensional array to sort by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is interpreted as null for the purpose of sorting.

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 key ?string unidimensional
Return Values
Type Value Description
object [original-key: reordered-value, ...]

sortByKeys

@Array.sortByKeys(object $array, function $callback, ?object $bind): object

Sorts an array by keys in a particular order determined by a specific comparison callback function.

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null
Return Values
Type Value Description
object [reordered-key: original-value, ...]

sortByValues

@Array.sortByValues(object $array, function $callback, ?object $bind, ?string $key): object

Sorts an array by values in a particular order determined by a specific comparison callback function.

A key may specify the column of a multidimensional array to sort by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is interpreted as null for the purpose of sorting.

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 callback function null
3 bind ?object null
4 key ?string unidimensional
Return Values
Type Value Description
object [original-key: reordered-value, ...]

sortDescByKeys

@Array.sortDescByKeys(object $array): object

Sorts an array by keys in descending lexicographic or numeric order.

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [reordered-key: original-value, ...]

sortDescByValues

@Array.sortDescByValues(object $array, ?string $key): object

Sorts an array by values in descending lexicographic or numeric order.

A key may specify the column of a multidimensional array to sort by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is interpreted as null for the purpose of sorting.

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 key ?string unidimensional
Return Values
Type Value Description
object [original-key: reordered-value, ...]

sortMultidimensional

@Array.sortMultidimensional(object $array, object $callbacks, ?object $bind): object

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 callbacks object [key: callback, ...] []
3 bind ?object null
Return Values
Type Value Description
object [original-key: reordered-value, ...]

sortNaturalAscByKeys

@Array.sortNaturalAscByKeys(object $array): object

Sorts an array by keys in ascending natural and case-insensitive order (US-ASCII only).

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [reordered-key: original-value, ...]

sortNaturalAscByValues

@Array.sortNaturalAscByValues(object $array, ?string $key): object

Sorts an array by values in ascending natural and case-insensitive order (US-ASCII only).

A key may specify the column of a multidimensional array to sort by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is interpreted as null for the purpose of sorting.

The sorting is not necessarily stable. Complex values are interpreted as strings for the purpose of sorting.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 key ?string unidimensional
Return Values
Type Value Description
object [original-key: reordered-value, ...]

sortNaturalDescByKeys

@Array.sortNaturalDescByKeys(object $array): object

Sorts an array by keys in descending natural and case-insensitive order (US-ASCII only).

The sorting is not necessarily stable.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [reordered-key: original-value, ...]

sortNaturalDescByValues

@Array.sortNaturalDescByValues(object $array, ?string $key): object

Sorts an array by values in descending natural and case-insensitive order (US-ASCII only).

A key may specify the column of a multidimensional array to sort by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is interpreted as null for the purpose of sorting.

The sorting is not necessarily stable. Complex values are interpreted as strings for the purpose of sorting.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 key ?string unidimensional
Return Values
Type Value Description
object [original-key: reordered-value, ...]

splice

@Array.splice(object $array, int $offset, ?int $length, object $replacement): object

Extracts a specific portion of an array and replaces it with specific replacement values.

If the offset is negative, it starts that many elements from the end of the array. If the length is null, every element from the offset until the end of the array is extracted, if it is negative, it stops that many elements from the end of the array.

This function is destructive, in the sense that it modifies the array in-place. It re-indexes all numeric keys in the original array and implicitly generates a consecutive numeric key for each replaced value, but preserves the keys in the extracted array.

Parameters
# Name Type Value Default
1 array object []
2 offset int 0
3 length ?int maximum length
4 replacement object [value, ...] []
Return Values
Type Value Description
object [extracted-key: extracted-value, ...]

tail

@Array.tail(object $array): object

Creates a shallow copy of the tail of an array, meaning all elements except the first.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [tail-key: tail-value, ...]

toCSV

@Array.toCSV(object $array, string $delimiter, bool $enclosed): string

This function is complementary to "fromCSV".

Parameters
# Name Type Value Default
1 array object [[value, ...], ...] []
2 delimiter string ";"
3 enclosed bool false
Return Values
Type Value Description
string

toLowerKeys

@Array.toLowerKeys(object $array): object

Converts the keys of an array to lower case (US-ASCII only).

This function is destructive, in the sense that it modifies the array in-place.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [unique-lower-string-key: last-applicable-value, ...]

toUpperKeys

@Array.toUpperKeys(object $array): object

Converts the keys of an array to upper case (US-ASCII only).

This function is destructive, in the sense that it modifies the array in-place.

Parameters
# Name Type Value Default
1 array object []
Return Values
Type Value Description
object [unique-upper-string-key: last-applicable-value, ...]

unionByKeys

@Array.unionByKeys(object $array, ...$arrays): object
Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [original-key: original-value, ..., supplemental-elements-key: elements-value]

unionByValues

@Array.unionByValues(object $array, ...$arrays): object
Parameters
# Name Type Value Default
1 array object []
... arrays variadic [key: value, ...] ...
Return Values
Type Value Description
object [original-key: (supplemental-elements-value / original-value), ..., (non-numeric-elements-key: supplemental-elements-value) / supplemental-elements-value-if-numeric-key, ...]

unique

@Array.unique(object $array, ?string $key): object

Uniquifies an array by discarding duplicate values, retaining only the first occurrence of each value.

A key may specify the column of a multidimensional array to distinguish by. If the key is null, the array is treated as an unidimensional list. If a key is specified, and it does not exist within the inner array, the corresponding element of the outer array is discarded.

This function is destructive, in the sense that it modifies the array in-place. It preserves the keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 key ?string unidimensional
Return Values
Type Value Description
object [first-applicable-key: unique-value, ...]

unshift

@Array.unshift(object $array, mixed $value): object

Prepends a specific value to the beginning of an array.

This function is destructive, in the sense that it modifies the array in-place. It re-indexes all numeric keys in the array.

Parameters
# Name Type Value Default
1 array object []
2 value mixed null
Return Values
Type Value Description
object [added-value, (non-numeric-original-key: original-value) / original-value-if-numeric-key, ...]

valueAt

@Array.valueAt(object $array, string $key): mixed

Returns the value at a specific key within an array.

This function is equivalent to the "[...]" operator on objects.

Parameters
# Name Type Value Default
1 array object []
2 key string "0"
Return Values
Type Value Description
mixed
null if the key is not found

.Iterator

Array.Iterator

object @Array.Iterator(@Base) {
	construct(object $array) {}
	hasMore(): bool {}
	next(): object {}
	reset(): $this {}
}

Array iterator prototype.

Prototype

Base

Methods

construct

new @Array.Iterator(object $array)
Parameters
# Name Type Value Default
1 array object []

hasMore

$this.hasMore(): bool
Return Values
Type Value Description
bool

next

$this.next(): object
Return Values
Type Value Description
object [key: value]
null if there are no more elements

reset

$this.reset(): $this
Return Values
Type Value Description
$this

Array.Reverse Iterator

object @Array.ReverseIterator(@Array.Iterator) {}

Array reverse iterator prototype.

Base

Base

object @Base() {
	construct() {}
	callMethod(function $function, ...$arguments): mixed {}
	clone(): object {}
	countSlots(): int {}
	getInternalID(): int {}
	hasSlot(): bool {}
	isInstanceOf(mixed $prototype): bool {}
	listPrototypes(): object {}
	listSlotNames(): object {}
	listSlots(): object {}
	setSlots(object $slots, string $prefix): $this {}
	toJSON(): string {}
}

Base prototype.

Methods

construct

new @Base()

callMethod

$this.callMethod(function $function, ...$arguments): mixed

Calls a function with variadic arguments, bound as a method to this object.

Parameters
# Name Type Value Default
1 function function null
... arguments variadic ...
Return Values
Type Value Description
mixed

clone

$this.clone(): object

Clones this object by creating a shallow copy.

This function is equivalent to the "clone" operator.

Return Values
Type Value Description
object

countSlots

$this.countSlots(): int

Counts the total number of slots within this object.

This function is equivalent to the "count" operator.

Return Values
Type Value Description
int

getInternalID

$this.getInternalID(): int

Returns the unique internal identification number of this object.

Return Values
Type Value Description
int

hasSlot

$this.hasSlot(): bool

Determines whether this object has a specific slot.

This function is equivalent to the "in" operator.

Return Values
Type Value Description
bool

isInstanceOf

$this.isInstanceOf(mixed $prototype): bool

Determines whether this object is an instance of a specific prototype.

This function is equivalent to the "is" operator.

Parameters
# Name Type Value Default
1 prototype mixed null
Return Values
Type Value Description
bool

listPrototypes

$this.listPrototypes(): object

Lists all prototypes of this object.

Return Values
Type Value Description
object [prototype, ...]

listSlotNames

$this.listSlotNames(): object

Lists all slot names of this object.

Return Values
Type Value Description
object [name, ...]

listSlots

$this.listSlots(): object

Lists all slots of this object.

Return Values
Type Value Description
object [name: value, ...]

setSlots

$this.setSlots(object $slots, string $prefix): $this

Sets multiple slots with slot names expanded by a specific prefix.

Parameters
# Name Type Value Default
1 slots object [name: value, ...] []
2 prefix string ""
Return Values
Type Value Description
$this

toJSON

$this.toJSON(): string

Returns the JavaScript Object Notation (JSON) representation of this object according to RFC 4627.

Return Values
Type Value Description
string

Console

object @Console() {
	CREATOR;
	VERSION;
	clear() {}
	disableAssertions() {}
	enableAssertions() {}
	getSummary(): string {}
	listMessages(): object {}
	log(...$messages) {}
}

Static console related functions.

Consts

Name Type Description
CREATOR string Zymba creator
VERSION int Zymba version number

Functions

clear

@Console.clear()

Clears the console by removing all messages.

disableAssertions

@Console.disableAssertions()

Disables assertions.

This function is complementary to "enableAssertions".

enableAssertions

@Console.enableAssertions()

Enables assertions.

This function is complementary to "disableAssertions".

getSummary

@Console.getSummary(): string
Return Values
Type Value Description
string

listMessages

@Console.listMessages(): object
Return Values
Type Value Description
object [message, ...]

log

@Console.log(...$messages)
Parameters
# Name Type Value Default
... messages variadic ... Crypt

Crypt

object @Crypt() {
	createIV(string $cipher): string {}
	createNonce(int $size): string {}
	createNonceRaw(int $size): string {}
	createPassword(int $length): string {}
	createUUID(): string {}
	decrypt(string $string, string $key, string $cipher, string $iv): string {}
	encrypt(string $string, string $key, string $cipher, string $iv): string {}
	equalsTimeConstant(string $secret, string $input): bool {}
	hash(string $string, string $algorithm, ?string $key): string {}
	hashFile(string $path, string $algorithm, ?string $key): string {}
	hashFileRaw(string $path, string $algorithm, ?string $key): string {}
	hashRaw(string $string, string $algorithm, ?string $key): string {}
	listCiphers(): object {}
	listHashAlgorithms(): object {}
	pbkdf2(string $password, string $salt, string $algorithm, int $iterations, int $length): string {}
	pbkdf2Raw(string $password, string $salt, string $algorithm, int $iterations, int $length): string {}
	validatePasswordPHP(string $password, string $hash): bool {}
}

Static cryptographic functions.

Functions

createIV

@Crypt.createIV(string $cipher): string

Creates a suitable initialization vector for a specific cipher from a random source.

Parameters
# Name Type Value Default
1 cipher string "aes-192-ecb"
Return Values
Type Value Description
string

createNonce

@Crypt.createNonce(int $size): string

Creates a nonce of a specific size in number of bytes from a random source in its hexadecimal string representation.

Parameters
# Name Type Value Default
1 size int 20
Return Values
Type Value Description
string

createNonceRaw

@Crypt.createNonceRaw(int $size): string

Creates a nonce of a specific size in number of bytes from a random source as raw binary data.

Parameters
# Name Type Value Default
1 size int 20
Return Values
Type Value Description
string

createPassword

@Crypt.createPassword(int $length): string

Creates a secure password of a specific length in number of characters from a random source.

The possible characters of the password are "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ0123456789".

Parameters
# Name Type Value Default
1 length int 10
Return Values
Type Value Description
string

createUUID

@Crypt.createUUID(): string

Creates a version 4 universally unique identifier (UUID) from a random source according to RFC 4122.

Return Values
Type Value Description
string

decrypt

@Crypt.decrypt(string $string, string $key, string $cipher, string $iv): string

Decryptes a string with a specific key.

This function is complementary to "encrypt".

Parameters
# Name Type Value Default
1 string string ""
2 key string ""
3 cipher string "aes-192-ecb"
4 iv string ""
Return Values
Type Value Description
string
null if decryption failed

encrypt

@Crypt.encrypt(string $string, string $key, string $cipher, string $iv): string

Encryptes a string with a specific key.

This function is complementary to "decrypt".

Parameters
# Name Type Value Default
1 string string ""
2 key string ""
3 cipher string "aes-192-ecb"
4 iv string ""
Return Values
Type Value Description
string

equalsTimeConstant

@Crypt.equalsTimeConstant(string $secret, string $input): bool

Determines whether two strings are equal based on time-constant string comparison that guards against timing attacks.

Parameters
# Name Type Value Default
1 secret string ""
2 input string ""
Return Values
Type Value Description
bool

hash

@Crypt.hash(string $string, string $algorithm, ?string $key): string

Generates the hash of a string in its hexadecimal string representation using a specific algorithm.

A key may specify the shared secret key for generating the HMAC variant of the message digest according to RFC 2104.

Parameters
# Name Type Value Default
1 string string ""
2 algorithm string "sha1"
3 key ?string non-HMAC
Return Values
Type Value Description
string

hashFile

@Crypt.hashFile(string $path, string $algorithm, ?string $key): string

Generates the hash of the content of an existing file in its hexadecimal string representation using a specific algorithm.

A key may specify the shared secret key for generating the HMAC variant of the message digest according to RFC 2104.

Parameters
# Name Type Value Default
1 path string ""
2 algorithm string "sha1"
3 key ?string non-HMAC
Return Values
Type Value Description
string

hashFileRaw

@Crypt.hashFileRaw(string $path, string $algorithm, ?string $key): string

Generates the hash of the content of an existing file as raw binary data using a specific algorithm.

A key may specify the shared secret key for generating the HMAC variant of the message digest according to RFC 2104.

Parameters
# Name Type Value Default
1 path string ""
2 algorithm string "sha1"
3 key ?string non-HMAC
Return Values
Type Value Description
string

hashRaw

@Crypt.hashRaw(string $string, string $algorithm, ?string $key): string

Generates the hash of a string as raw binary data using a specific algorithm.

A key may specify the shared secret key for generating the HMAC variant of the message digest according to RFC 2104.

Parameters
# Name Type Value Default
1 string string ""
2 algorithm string "sha1"
3 key ?string non-HMAC
Return Values
Type Value Description
string

listCiphers

@Crypt.listCiphers(): object

Lists all available ciphers.

Return Values
Type Value Description
object [cipher, ...]

listHashAlgorithms

@Crypt.listHashAlgorithms(): object

Lists all available hash algorithms.

Return Values
Type Value Description
object [algorithm, ...]

pbkdf2

@Crypt.pbkdf2(string $password, string $salt, string $algorithm, int $iterations, int $length): string

Generatesa a PBKDF2 key derived from a password along with a salt in its hexadecimal string representation using a specific algorithm.

Parameters
# Name Type Value Default
1 password string ""
2 salt string ""
3 algorithm string "sha1"
4 iterations int 10000
5 length int full key length
Return Values
Type Value Description
string

pbkdf2Raw

@Crypt.pbkdf2Raw(string $password, string $salt, string $algorithm, int $iterations, int $length): string

Generates a PBKDF2 key derived from a password along with a salt as raw binary data using a specific algorithm.

Parameters
# Name Type Value Default
1 password string ""
2 salt string ""
3 algorithm string "sha1"
4 iterations int 10000
5 length int full key length
Return Values
Type Value Description
string

validatePasswordPHP

@Crypt.validatePasswordPHP(string $password, string $hash): bool

Validates a password against a specific PHP password hash.

Parameters
# Name Type Value Default
1 password string ""
2 hash string ""
Return Values
Type Value Description
bool

DNS

object @DNS() {
	exists(string $host, string $type): bool {}
	isValidDomain(string $domain): bool {}
	isValidHost(string $host): bool {}
	isValidIP(string $ip): bool {}
	lookup(string $domain): string {}
	resolve(string $domain, string $type): object {}
	reverse(string $ip): string {}
}

Static DNS related functions.

Functions

exists

@DNS.exists(string $host, string $type): bool

Determines whether a DNS record of a specific type exists for a host (domain name or IP address).

Parameters
# Name Type Value Default
1 host string ""
2 type string "any"
Return Values
Type Value Description
bool

isValidDomain

@DNS.isValidDomain(string $domain): bool

Determines whether a domain name is valid.

Parameters
# Name Type Value Default
1 domain string ""
Return Values
Type Value Description
bool

isValidHost

@DNS.isValidHost(string $host): bool

Determines whether a host (domain name or IP address) is valid.

Parameters
# Name Type Value Default
1 host string ""
Return Values
Type Value Description
bool

isValidIP

@DNS.isValidIP(string $ip): bool

Determines whether an IP address is valid.

Parameters
# Name Type Value Default
1 ip string "0.0.0.0"
Return Values
Type Value Description
bool

lookup

@DNS.lookup(string $domain): string

Resolves a domain name and returns its IP address.

Parameters
# Name Type Value Default
1 domain string ""
Return Values
Type Value Description
string
null if the domain name cannot be resolved

resolve

@DNS.resolve(string $domain, string $type): object

Resolves a domain name into the DNS records of a specific type.

Parameters
# Name Type Value Default
1 domain string ""
2 type string "any"
Return Values
Type Value Description
object [["host": ..., "class": ..., "type": ..., "ttl": ...], ...]
null if the domain name cannot be resolved

reverse

@DNS.reverse(string $ip): string

Reverse resolves an IP address and returns its domain name.

Parameters
# Name Type Value Default
1 ip string "0.0.0.0"
Return Values
Type Value Description
string
null if the IP address cannot be resolved

Date

object @Date() {
	JUDGMENTDAY;
	create(?int $day, ?int $month, ?int $year, int $hour, int $minute, int $second): int {}
	createUTC(?int $day, ?int $month, ?int $year, int $hour, int $minute, int $second): int {}
	format(string $format, ?int $timestamp): string {}
	formatUTC(string $format, ?int $timestamp): string {}
	getDay(?int $timestamp): int {}
	getDayOfWeek(?int $timestamp): int {}
	getDayOfWeekISO8601(?int $timestamp): int {}
	getDayOfYear(?int $timestamp): int {}
	getHour(?int $timestamp): int {}
	getMinute(?int $timestamp): int {}
	getMonth(?int $timestamp): int {}
	getSecond(?int $timestamp): int {}
	getTimezone(): string {}
	getTimezoneAbbreviation(): string {}
	getTimezoneOffset(): int {}
	getWeekISO8601(?int $timestamp): int {}
	getYear(?int $timestamp): int {}
	getYearISO8601(?int $timestamp): int {}
	inDST(?int $timestamp): bool {}
	isLeapYear(?int $timestamp): bool {}
	isMidnight(?int $timestamp): bool {}
	isValid(?int $day, ?int $month, ?int $year): bool {}
	listTimezones(): object {}
	now(): int {}
	nowExact(): float {}
	parse(string $string): int {}
	setTimezone(string $timezone) {}
	today(): int {}
	truncateDay(?int $timestamp): int {}
	truncateMonth(?int $timestamp): int {}
	truncateYear(?int $timestamp): int {}
}

Static date and time related constants and functions.

Consts

Name Type Description
JUDGMENTDAY int Easter egg timestamp for the date on which Skynet becomes self-aware (August 29, 1997, 02:14:00 EST / 07:14:00 UTC)

Functions

create

@Date.create(?int $day, ?int $month, ?int $year, int $hour, int $minute, int $second): int

Creates the timestamp of a Gregorian date formed by its components.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 day ?int now
2 month ?int now
3 year ?int now
4 hour int 0
5 minute int 0
6 second int 0
Return Values
Type Value Description
int

createUTC

@Date.createUTC(?int $day, ?int $month, ?int $year, int $hour, int $minute, int $second): int

Creates the timestamp of a Gregorian date formed by its components using UTC instead of local time.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 day ?int now
2 month ?int now
3 year ?int now
4 hour int 0
5 minute int 0
6 second int 0
Return Values
Type Value Description
int

format

@Date.format(string $format, ?int $timestamp): string

Returns the formatted representation of a date according to a specific PHP-compatible format.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 format string "c"
2 timestamp ?int now
Return Values
Type Value Description
string

formatUTC

@Date.formatUTC(string $format, ?int $timestamp): string

Returns the formatted representation of a date according to a specific PHP-compatible format using UTC instead of local time.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 format string "c"
2 timestamp ?int now
Return Values
Type Value Description
string

getDay

@Date.getDay(?int $timestamp): int

Gets the day of the month (1-31) of a date.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getDayOfWeek

@Date.getDayOfWeek(?int $timestamp): int

Gets the day of the week (0-6) of a date.

The week starts on Sunday.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getDayOfWeekISO8601

@Date.getDayOfWeekISO8601(?int $timestamp): int

Gets the day of the week (1-7) of a date according to ISO-8601.

The week starts on Monday.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getDayOfYear

@Date.getDayOfYear(?int $timestamp): int

Gets the day of the year (0-365) of a date.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getHour

@Date.getHour(?int $timestamp): int

Gets the hour (0-23) of a date.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getMinute

@Date.getMinute(?int $timestamp): int

Gets the minute (0-59) of a date.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getMonth

@Date.getMonth(?int $timestamp): int

Gets the month (1-12) of a date.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getSecond

@Date.getSecond(?int $timestamp): int

Gets the second (0-59) of a date.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getTimezone

@Date.getTimezone(): string

Gets the current timezone identifier.

Return Values
Type Value Description
string

getTimezoneAbbreviation

@Date.getTimezoneAbbreviation(): string

Gets the current timezone identifier abbreviation.

Return Values
Type Value Description
string

getTimezoneOffset

@Date.getTimezoneOffset(): int

Gets the current timezone offset in number of seconds.

Return Values
Type Value Description
int

getWeekISO8601

@Date.getWeekISO8601(?int $timestamp): int

Gets the week number in the year of a date according to ISO-8601.

The week starts on Monday.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getYear

@Date.getYear(?int $timestamp): int

Gets the 4-digit year of a date.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

getYearISO8601

@Date.getYearISO8601(?int $timestamp): int

Gets the 4-digit year of a date according to ISO-8601.

The year is determined by the week number of the date.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

inDST

@Date.inDST(?int $timestamp): bool

Determines whether a date is in daylight saving time.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
bool

isLeapYear

@Date.isLeapYear(?int $timestamp): bool

Determines whether the year of a date is a leap year.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
bool

isMidnight

@Date.isMidnight(?int $timestamp): bool

Determines whether a date is midnight of the day.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
bool

isValid

@Date.isValid(?int $day, ?int $month, ?int $year): bool

Determines whether a Gregorian date formed by specific components is valid.

Leap years are taken into consideration.

Parameters
# Name Type Value Default
1 day ?int now
2 month ?int now
3 year ?int now
Return Values
Type Value Description
bool

listTimezones

@Date.listTimezones(): object

List all available timezones.

Return Values
Type Value Description
object [timezone, ...]

now

@Date.now(): int

Returns the timestamp for the current date and time.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Return Values
Type Value Description
int

nowExact

@Date.nowExact(): float

Returns the exact timestamp for the current date and time including micro seconds in the fractional part.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Return Values
Type Value Description
float

parse

@Date.parse(string $string): int

Parses a textual representation of date and time and returns the corresponding timestamp.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int
null if the representation is invalid

setTimezone

@Date.setTimezone(string $timezone)

Sets the timezone for all date and time functions.

Parameters
# Name Type Value Default
1 timezone string "UTC"

today

@Date.today(): int

Returns the timestamp for today at midnight.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Return Values
Type Value Description
int

truncateDay

@Date.truncateDay(?int $timestamp): int

Truncates a date to midnight of the day.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

truncateMonth

@Date.truncateMonth(?int $timestamp): int

Truncates a date to the first day of the month.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

truncateYear

@Date.truncateYear(?int $timestamp): int

Truncates a date to the first day of the year.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 timestamp ?int now
Return Values
Type Value Description
int

Exception

object @Exception(@Base) {
	construct(string $message) {}
	getInitialTrace(): object {}
	getMessage(): string {}
	getSummary(): string {}
	getTracesAsString(): string {}
	listTraces(): object {}
	toString(): string {}
}

Exception prototype.

Prototype

Base

Methods

construct

new @Exception(string $message)
Parameters
# Name Type Value Default
1 message string ""

getInitialTrace

$this.getInitialTrace(): object
Return Values
Type Value Description
object ["filename": ..., "line": ..., "site": ..., "function": ..., "params": ...]
null if there is no initial trace

getMessage

$this.getMessage(): string
Return Values
Type Value Description
string

getSummary

$this.getSummary(): string
Return Values
Type Value Description
string

getTracesAsString

$this.getTracesAsString(): string
Return Values
Type Value Description
string

listTraces

$this.listTraces(): object
Return Values
Type Value Description
object [["filename": ..., "line": ..., "site": ..., "function": ..., "params": ...], ...]

toString

$this.toString(): string
Return Values
Type Value Description
string

FTP

object @FTP() {}

Static FTP prototypes.

.Client

FTP.Client

object @FTP.Client(@Base) {
	construct(string $server, string $username, string $password, int $timeout) {}
	close() {}
	countDirectories(string $path): int {}
	countFiles(string $path): int {}
	createDirectory(string $path): $this {}
	delete(string $path): $this {}
	deleteIfExists(string $path): bool {}
	disablePassiveMode(): $this {}
	download(string $path, string $target): $this {}
	echo(string $path): $this {}
	enablePassiveMode(): $this {}
	execute(string $command): object {}
	exists(string $path): bool {}
	exit() {}
	getLastModified(string $path): int {}
	getSize(string $path): int {}
	getWorkingDirectory(): string {}
	isConnected(): bool {}
	isDirectory(string $path): bool {}
	isRegularFile(string $path): bool {}
	listFiles(string $path): object {}
	listDirectories(string $path): object {}
	move(string $path, string $target): $this {}
	read(string $path): string {}
	readCSV(string $path, string $delimiter): object {}
	readJSON(string $path): mixed {}
	setPermissions(string $path, int $mode): $this {}
	setTimeout(int $timeout): $this {}
	setWorkingDirectory(string $path): $this {}
	upload(string $path, string $target): $this {}
	write(string $path, string $string): int {}
}

FTP client prototype.

Prototype

Base

Methods

construct

new @FTP.Client(string $server, string $username, string $password, int $timeout)
Parameters
# Name Type Value Default
1 server string ""
2 username string "anonymous"
3 password string ""
4 timeout int 30

close

$this.close()

Closes this client and frees its associated resources.

countDirectories

$this.countDirectories(string $path): int

Counts the total number of subdirectories in an existing directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int

countFiles

$this.countFiles(string $path): int

Counts the total number of files in an existing directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int

createDirectory

$this.createDirectory(string $path): $this

Creates a directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
$this

delete

$this.delete(string $path): $this

Deletes an existing file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
$this

deleteIfExists

$this.deleteIfExists(string $path): bool

Deletes a file if it exists and return whether it existed.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

disablePassiveMode

$this.disablePassiveMode(): $this

Disables passive mode for this client.

This function is complementary to "enablePassiveMode".

Return Values
Type Value Description
$this

download

$this.download(string $path, string $target): $this

Downloads an existing file to a specific target.

Parameters
# Name Type Value Default
1 path string ""
2 target string ""
Return Values
Type Value Description
$this

echo

$this.echo(string $path): $this

Outputs the content of an existing file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
$this

enablePassiveMode

$this.enablePassiveMode(): $this

Enables passive mode for this client.

This function is complementary to "disablePassiveMode".

Return Values
Type Value Description
$this

execute

$this.execute(string $command): object

Executes a FTP command and returns its output.

Parameters
# Name Type Value Default
1 command string ""
Return Values
Type Value Description
object [line, ...]
null if command failed

exists

$this.exists(string $path): bool

Determines whether a path exists.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

exit

$this.exit()

Closes this client and frees its associated resources for the purpose of contextualization.

getLastModified

$this.getLastModified(string $path): int

Gets the timestamp for the last modification date and time of an existing file.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int
null if unavailable or path is a directory

getSize

$this.getSize(string $path): int

Gets the size of an existing file in number of bytes.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int
null if unavailable or path is a directory

getWorkingDirectory

$this.getWorkingDirectory(): string

Gets the path of the current working directory.

Return Values
Type Value Description
string

isConnected

$this.isConnected(): bool
Return Values
Type Value Description
bool

isDirectory

$this.isDirectory(string $path): bool

Determines whether a path exists and targets a directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

isRegularFile

$this.isRegularFile(string $path): bool

Determines whether a path exists and targets a regular file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

listFiles

$this.listFiles(string $path): object
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
object [filename, ...]

listDirectories

$this.listDirectories(string $path): object
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
object [filename, ...]

move

$this.move(string $path, string $target): $this

Moves an existing file to a specific target.

Parameters
# Name Type Value Default
1 path string ""
2 target string ""
Return Values
Type Value Description
$this

read

$this.read(string $path): string

Reads the content of an existing file in binary mode.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

readCSV

$this.readCSV(string $path, string $delimiter): object
Parameters
# Name Type Value Default
1 path string ""
2 delimiter string ";"
Return Values
Type Value Description
object [[value, ...], ...]

readJSON

$this.readJSON(string $path): mixed
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
mixed

setPermissions

$this.setPermissions(string $path, int $mode): $this

Sets the permissions of an exiting file to a specific numeric mode.

Parameters
# Name Type Value Default
1 path string ""
2 mode int 0o777
Return Values
Type Value Description
$this

setTimeout

$this.setTimeout(int $timeout): $this

Sets the timeout period of this client to a specific number of seconds.

Parameters
# Name Type Value Default
1 timeout int 30
Return Values
Type Value Description
$this

setWorkingDirectory

$this.setWorkingDirectory(string $path): $this

Sets the path of the working directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
$this

upload

$this.upload(string $path, string $target): $this

Uploads an existing file to a specific target.

Parameters
# Name Type Value Default
1 path string ""
2 target string ""
Return Values
Type Value Description
$this

write

$this.write(string $path, string $string): int

Writes a string to a file in binary mode and returns the number of bytes written.

If the file exists, its content is overwritten, if it does not exist, it is implicitly created.

Parameters
# Name Type Value Default
1 path string ""
2 string string ""
Return Values
Type Value Description
int

Function

object @Function() {
	call(function $function, ?object $bind, ...$arguments): mixed {}
	countParameters(function $function): int {}
	isInternal(function $function): bool {}
	isUserDefined(function $function): bool {}
	isVariadic(function $function): bool {}
	listParameterNames(function $function): object {}
	listParameters(function $function): object {}
}

Static function related functions.

#s

call

@Function.call(function $function, ?object $bind, ...$arguments): mixed

Calls a function with variadic arguments, optionally bound as a method to a specific object.

Parameters
# Name Type Value Default
1 function function null
2 bind ?object null
... arguments variadic ...
Return Values
Type Value Description
mixed

countParameters

@Function.countParameters(function $function): int

Counts the total number of parameters of a function.

Parameters
# Name Type Value Default
1 function function null
Return Values
Type Value Description
int

isInternal

@Function.isInternal(function $function): bool

Determines whether a function is internal.

Parameters
# Name Type Value Default
1 function function null
Return Values
Type Value Description
bool

isUserDefined

@Function.isUserDefined(function $function): bool

Determines whether a function is user-defined.

Parameters
# Name Type Value Default
1 function function null
Return Values
Type Value Description
bool

isVariadic

@Function.isVariadic(function $function): bool

Determines whether a function is variadic, meaning it accepts a variable number of arguments.

Parameters
# Name Type Value Default
1 function function null
Return Values
Type Value Description
bool

listParameterNames

@Function.listParameterNames(function $function): object

Lists all parameter names of a function.

Parameters
# Name Type Value Default
1 function function null
Return Values
Type Value Description
object [name, ...]

listParameters

@Function.listParameters(function $function): object

Lists all parameters of a function with associated default values.

Parameters
# Name Type Value Default
1 function function null
Return Values
Type Value Description
object [name: default, ...]

Generator

object @Generator(@Base) {
	getResult(): mixed {}
	next(): object {}
	send(mixed $value): object {}
	throw(mixed $exception): object {}
}

Abstract generator prototype.

Prototype

Base

Methods

getResult

$this.getResult(): mixed
Return Values
Type Value Description
mixed
null if there is no result yet

next

$this.next(): object

Resumes this generator.

Return Values
Type Value Description
object [key: value]
null if there is no more to yield

send

$this.send(mixed $value): object
Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
object [key: value]
null if there is no more to yield

throw

$this.throw(mixed $exception): object
Parameters
# Name Type Value Default
1 exception mixed null
Return Values
Type Value Description
object [key: value]
null if there is no more to yield

HTTP

object @HTTP() {
	canSendHeaders(): bool {}
	clearHeaders() {}
	getAuthenticatedPassword(): string {}
	getAuthenticatedUser(): string {}
	getDocumentRoot(): string {}
	getLocalAddress(): string {}
	getLocalHost(): string {}
	getLocalPort(): int {}
	getRemoteAddress(): string {}
	getRemoteHost(): string {}
	getRemotePort(): int {}
	getRequestBody(): string {}
	getRequestCookie(string $name): string {}
	getRequestFileUpload(string $name): object {}
	getRequestFormVariable(string $name): string {}
	getRequestHeader(string $name): string {}
	getRequestMethod(): string {}
	getRequestQuery(): string {}
	getRequestQueryVariable(string $name): string {}
	getRequestType(): string {}
	getRequestURL(): string {}
	getRequestVariable(string $name): string {}
	getResponseHeader(string $name): string {}
	getStatusCode(): int {}
	isConnectionAborted(): bool {}
	isConnectionSecure(): bool {}
	isUploadedFile(string $path): bool {}
	listRequestCookies(): object {}
	listRequestFileUploads(): object {}
	listRequestFormVariables(): object {}
	listRequestHeaders(): object {}
	listRequestQueryVariables(): object {}
	listRequestVariables(): object {}
	listResponseHeaders(): object {}
	removeHeader(string $name) {}
	request(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): object {}
	requestBody(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): string {}
	requestHeaders(string $url): object {}
	setBasicAuthentication(string $realm) {}
	setCacheExpires(int $seconds) {}
	setCookie(string $name, string $value, int $expires, string $path, string $domain, bool $secure, bool $httponly) {}
	setHeader(string $name, string $value) {}
	setHeaders(object $headers, string $prefix) {}
	setStatusCode(int $code) {}
}

Static HTTP related functions.

Functions

canSendHeaders

@HTTP.canSendHeaders(): bool

Determines whether HTTP response headers can be sent.

Return Values
Type Value Description
bool

clearHeaders

@HTTP.clearHeaders()

Removes all previously set HTTP response headers.

getAuthenticatedPassword

@HTTP.getAuthenticatedPassword(): string
Return Values
Type Value Description
string

getAuthenticatedUser

@HTTP.getAuthenticatedUser(): string
Return Values
Type Value Description
string

getDocumentRoot

@HTTP.getDocumentRoot(): string

Gets the path of the local server's document root directory.

Return Values
Type Value Description
string

getLocalAddress

@HTTP.getLocalAddress(): string

Gets the IP address of the local server.

Return Values
Type Value Description
string

getLocalHost

@HTTP.getLocalHost(): string

Gets the host name of the local server.

Return Values
Type Value Description
string

getLocalPort

@HTTP.getLocalPort(): int

Gets the port number of the local server.

Return Values
Type Value Description
int

getRemoteAddress

@HTTP.getRemoteAddress(): string

Gets the IP address of the remote client.

Return Values
Type Value Description
string

getRemoteHost

@HTTP.getRemoteHost(): string

Gets the host name of the remote client.

Return Values
Type Value Description
string

getRemotePort

@HTTP.getRemotePort(): int

Gets the port number of the remote client.

Return Values
Type Value Description
int

getRequestBody

@HTTP.getRequestBody(): string

Gets the HTTP request body in raw format.

Return Values
Type Value Description
string

getRequestCookie

@HTTP.getRequestCookie(string $name): string

Gets the value of a HTTP request cookie.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string
null if the cookie is not found

getRequestFileUpload

@HTTP.getRequestFileUpload(string $name): object

Gets the details of a HTTP request file upload.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
object ["name": ..., "type": ..., "tmp_name": ..., "error": ..., "size": ...]
null if the file is not found

getRequestFormVariable

@HTTP.getRequestFormVariable(string $name): string

Gets the value of a HTTP request variable submitted via the POST method with content type "application/x-www-form-urlencoded" or "multipart/form-data" according to RFC 2388.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string
null if the variable is not found

getRequestHeader

@HTTP.getRequestHeader(string $name): string

Gets the value of a HTTP request header.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string
null if the header is not found

getRequestMethod

@HTTP.getRequestMethod(): string

Gets the HTTP request method.

Return Values
Type Value Description
string

getRequestQuery

@HTTP.getRequestQuery(): string

Gets the query component of the HTTP request URL.

Return Values
Type Value Description
string

getRequestQueryVariable

@HTTP.getRequestQueryVariable(string $name): string

Gets the value of a HTTP request variable submitted via the URL query component.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string
null if the variable is not found

getRequestType

@HTTP.getRequestType(): string

Gets the content type of the HTTP request.

Return Values
Type Value Description
string

getRequestURL

@HTTP.getRequestURL(): string

Gets the complete HTTP request URL.

Return Values
Type Value Description
string

getRequestVariable

@HTTP.getRequestVariable(string $name): string

Gets the value of a HTTP request variable.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string
null if the variable is not found

getResponseHeader

@HTTP.getResponseHeader(string $name): string

Gets the value of a HTTP response header.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string
null if the header is not found

getStatusCode

@HTTP.getStatusCode(): int

Gets the current HTTP response status code.

Return Values
Type Value Description
int

isConnectionAborted

@HTTP.isConnectionAborted(): bool

Determines whether the current connection is aborted, meaning the client has disconnected.

Return Values
Type Value Description
bool

isConnectionSecure

@HTTP.isConnectionSecure(): bool

Determines whether the current connection is secure, meaning over HTTPS.

Return Values
Type Value Description
bool

isUploadedFile

@HTTP.isUploadedFile(string $path): bool

Determines whether a file was created by an upload according to RFC 1867.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

listRequestCookies

@HTTP.listRequestCookies(): object

Lists all HTTP request cookies.

Return Values
Type Value Description
object [name: value, ...]

listRequestFileUploads

@HTTP.listRequestFileUploads(): object

Lists the details of all HTTP request file uploads submitted via the POST method with content type "multipart/form-data" according to RFC 1867.

Return Values
Type Value Description
object [name: ["name": ..., "type": ..., "tmp_name": ..., "error": ..., "size": ...], ...]

listRequestFormVariables

@HTTP.listRequestFormVariables(): object

Lists all HTTP request variables submitted via the POST method with content type "application/x-www-form-urlencoded" or "multipart/form-data" according to RFC 2388.

Return Values
Type Value Description
object [name: value, ...]

listRequestHeaders

@HTTP.listRequestHeaders(): object

Lists all HTTP request headers.

Return Values
Type Value Description
object [name: value, ...]

listRequestQueryVariables

@HTTP.listRequestQueryVariables(): object

Lists all HTTP request variables submitted via the URL query component.

Return Values
Type Value Description
object [name: value, ...]

listRequestVariables

@HTTP.listRequestVariables(): object

Lists all HTTP request variables.

Return Values
Type Value Description
object [name: value, ...]

listResponseHeaders

@HTTP.listResponseHeaders(): object

Lists all HTTP response headers.

Return Values
Type Value Description
object [name: value, ...]

removeHeader

@HTTP.removeHeader(string $name)

Removes a HTTP response header.

Parameters
# Name Type Value Default
1 name string ""

request

@HTTP.request(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): object
Parameters
# Name Type Value Default
1 url string ""
2 method string "GET"
3 body string ""
4 headers object [name: value, ...] []
5 timeout int 30
6 validate bool true
Return Values
Type Value Description
object ["url": ..., "status": ..., "type": ..., "time": ..., "header": ..., "body": ...]

requestBody

@HTTP.requestBody(string $url, string $method, string $body, object $headers, int $timeout, bool $validate): string
Parameters
# Name Type Value Default
1 url string ""
2 method string "GET"
3 body string ""
4 headers object [name: value, ...] []
5 timeout int 30
6 validate bool true
Return Values
Type Value Description
string

requestHeaders

@HTTP.requestHeaders(string $url): object
Parameters
# Name Type Value Default
1 url string ""
Return Values
Type Value Description
object [name: value, ...]

setBasicAuthentication

@HTTP.setBasicAuthentication(string $realm)
Parameters
# Name Type Value Default
1 realm string ""

setCacheExpires

@HTTP.setCacheExpires(int $seconds)
Parameters
# Name Type Value Default
1 seconds int 86400

setCookie

@HTTP.setCookie(string $name, string $value, int $expires, string $path, string $domain, bool $secure, bool $httponly)
Parameters
# Name Type Value Default
1 name string ""
2 value string ""
3 expires int 0
4 path string ""
5 domain string ""
6 secure bool false
7 httponly bool false

setHeader

@HTTP.setHeader(string $name, string $value)

Sets a HTTP response header.

Parameters
# Name Type Value Default
1 name string ""
2 value string ""

setHeaders

@HTTP.setHeaders(object $headers, string $prefix)

Sets multiple HTTP response headers by treating slot names as header names, expanded by a specific prefix, and slot values as non-referential header values.

Parameters
# Name Type Value Default
1 headers object [name: value, ...] []
2 prefix string ""

setStatusCode

@HTTP.setStatusCode(int $code)

Sets the HTTP response status code.

Parameters
# Name Type Value Default
1 code int 200 IO

IO

object @IO() {
	EOL;
	append(string $path, string $string): int {}
	appendLine(string $path, string $string): int {}
	canExecute(string $path): bool {}
	canRead(string $path): bool {}
	canWrite(string $path): bool {}
	copy(string $path, string $target) {}
	countDirectories(string $path): int {}
	countFiles(string $path): int {}
	crc32(string $path): int {}
	createDirectories(string $path, int $mode) {}
	createDirectory(string $path, int $mode) {}
	createFile(string $path): bool {}
	createHardLink(string $path, string $target) {}
	createSymbolicLink(string $path, string $target) {}
	createTempFile(string $prefix): string {}
	delete(string $path): string {}
	deleteIfExists(string $path): bool {}
	echo(string $path) {}
	execute(string $command): string {}
	executeFlushed(string $command): int {}
	exists(string $path): bool {}
	getFreeSpace(string $path): float {}
	getGroupID(string $path): int {}
	getLastAccess(): int {}
	getLastModified(): int {}
	getPermissions(): int {}
	getSize(string $path): int {}
	getTotalSpace(string $path): float {}
	getUsedSpace(string $path): float {}
	getUserID(string $path): int {}
	hasExistingTarget(string $path): bool {}
	hasSameContent(string $path1, string $path2): bool {}
	isDirectory(string $path): bool {}
	isRegularFile(string $path): bool {}
	isSameFile(string $path1, string $path2): bool {}
	isSymbolicLink(string $path): bool {}
	listDirectories(string $path): object {}
	listFiles(string $path): object {}
	move(string $path, string $target) {}
	quoteCommandArgument(string $argument): string {}
	read(string $path): string {}
	readCSV(string $path, string $delimiter): object {}
	readJSON(string $path): mixed {}
	readLines(string $path): object {}
	readModifyWrite(string $path, function $callback, ?object $bind): string {}
	readNonEmptyLines(string $path): object {}
	readSymbolicLink(string $path): string {}
	selectReadyStreams(object $read, object $write, object $exceptional, ?number $timeout): object {}
	setGroupByID(string $path, int $id) {}
	setGroupByName(string $path, string $name) {}
	setLastAccess(string $path, ?int $timestamp) {}
	setLastModified(string $path, ?int $timestamp) {}
	setPermissions(string $path, int $mode) {}
	setUserByID(string $path, int $id) {}
	setUserByName(string $path, string $name) {}
	truncate(string $path, int $size) {}
	write(string $path, string $string): int {}
	writeCSV(string $path, object $array, string $delimiter): int {}
	writeJSON(string $path, mixed $value): int {}
}

Static IO related constants, prototypes and functions.

Consts

Name Type Description
EOL string End-of-line sequence

Functions

append

@IO.append(string $path, string $string): int

Appends a string to a file and returns the number of bytes written.

If the file does not exist, it is implicitly created.

Parameters
# Name Type Value Default
1 path string ""
2 string string ""
Return Values
Type Value Description
int

appendLine

@IO.appendLine(string $path, string $string): int

Appends a string appended by an end-of-line sequence to a file and returns the number of bytes written.

If the file does not exist, it is implicitly created.

Parameters
# Name Type Value Default
1 path string ""
2 string string ""
Return Values
Type Value Description
int

canExecute

@IO.canExecute(string $path): bool

Determines whether a file exists and can be executed.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

canRead

@IO.canRead(string $path): bool

Determines whether a file exists and can be read from.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

canWrite

@IO.canWrite(string $path): bool

Determines whether a file exists and can be written to.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

copy

@IO.copy(string $path, string $target)

Copies an existing file to a specific target.

Parameters
# Name Type Value Default
1 path string ""
2 target string ""

countDirectories

@IO.countDirectories(string $path): int

Counts the total number of subdirectories in an existing directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int

countFiles

@IO.countFiles(string $path): int

Counts the total number of files in an existing directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int

crc32

@IO.crc32(string $path): int

Generates the 32-bit cyclic redundancy checksum polynomial of the content of an existing file as a signed integer.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int

createDirectories

@IO.createDirectories(string $path, int $mode)

Creates directories recursively.

Parameters
# Name Type Value Default
1 path string ""
2 mode int 0o777

createDirectory

@IO.createDirectory(string $path, int $mode)

Creates a directory.

Parameters
# Name Type Value Default
1 path string ""
2 mode int 0o777

createFile

@IO.createFile(string $path): bool

Creates an empty file if it does not exist and return whether it was newly created.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

createHardLink

@IO.createHardLink(string $path, string $target)

Creates a hard link to a specific target.

Parameters
# Name Type Value Default
1 path string ""
2 target string ""

createSymbolicLink

@IO.createSymbolicLink(string $path, string $target)

Creates a symbolic link to a specific target.

Parameters
# Name Type Value Default
1 path string ""
2 target string ""

createTempFile

@IO.createTempFile(string $prefix): string

Creates an empty temporary file and returns its absolute path.

Parameters
# Name Type Value Default
1 prefix string "z"
Return Values
Type Value Description
string

delete

@IO.delete(string $path): string

Deletes an existing file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

deleteIfExists

@IO.deleteIfExists(string $path): bool

Deletes a file if it exists and return whether it existed.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

echo

@IO.echo(string $path)

Outputs the content of an existing file.

Parameters
# Name Type Value Default
1 path string ""

execute

@IO.execute(string $command): string

Executes a shell command and returns its output.

Parameters
# Name Type Value Default
1 command string ""
Return Values
Type Value Description
string

executeFlushed

@IO.executeFlushed(string $command): int

Executes a shell command, immediately flushes its output and returns the exit code.

Parameters
# Name Type Value Default
1 command string ""
Return Values
Type Value Description
int

exists

@IO.exists(string $path): bool

Determines whether a path exists.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

getFreeSpace

@IO.getFreeSpace(string $path): float

Gets the free space of a filesystem in number of bytes.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
float

getGroupID

@IO.getGroupID(string $path): int

Gets the group ID of an existing file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int

getLastAccess

@IO.getLastAccess(): int

Gets the timestamp for the last access date and time of an existing file.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Return Values
Type Value Description
int

getLastModified

@IO.getLastModified(): int

Gets the timestamp for the last modification date and time of an existing file.

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Return Values
Type Value Description
int

getPermissions

@IO.getPermissions(): int

Gets the permissions of an existing file as the numeric mode.

Return Values
Type Value Description
int

getSize

@IO.getSize(string $path): int

Gets the size of an existing file in number of bytes.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int

getTotalSpace

@IO.getTotalSpace(string $path): float

Gets the total space of a filesystem in number of bytes.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
float

getUsedSpace

@IO.getUsedSpace(string $path): float

Gets the used space of a filesystem in number of bytes.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
float

getUserID

@IO.getUserID(string $path): int

Gets the user ID of an existing file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
int

hasExistingTarget

@IO.hasExistingTarget(string $path): bool

Determines whether a symbolic link has an existing target.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

hasSameContent

@IO.hasSameContent(string $path1, string $path2): bool

Determines whether two existing files have the same content.

Parameters
# Name Type Value Default
1 path1 string ""
2 path2 string ""
Return Values
Type Value Description
bool

isDirectory

@IO.isDirectory(string $path): bool

Determines whether a path exists and targets a directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

isRegularFile

@IO.isRegularFile(string $path): bool

Determines whether a path exists and targets a regular file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

isSameFile

@IO.isSameFile(string $path1, string $path2): bool

Determines whether two existing paths target the same physical file.

Parameters
# Name Type Value Default
1 path1 string ""
2 path2 string ""
Return Values
Type Value Description
bool

isSymbolicLink

@IO.isSymbolicLink(string $path): bool

Determines whether a path exists and targets a symbolic link.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

listDirectories

@IO.listDirectories(string $path): object
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
object [filename, ...]

listFiles

@IO.listFiles(string $path): object
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
object [filename, ...]

move

@IO.move(string $path, string $target)

Moves an existing file to a specific target.

Parameters
# Name Type Value Default
1 path string ""
2 target string ""

quoteCommandArgument

@IO.quoteCommandArgument(string $argument): string
Parameters
# Name Type Value Default
1 argument string ""
Return Values
Type Value Description
string

read

@IO.read(string $path): string

Reads the content of an existing file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

readCSV

@IO.readCSV(string $path, string $delimiter): object
Parameters
# Name Type Value Default
1 path string ""
2 delimiter string ";"
Return Values
Type Value Description
object [[value, ...], ...]

readJSON

@IO.readJSON(string $path): mixed
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
mixed

readLines

@IO.readLines(string $path): object
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
object [line, ...]

readModifyWrite

@IO.readModifyWrite(string $path, function $callback, ?object $bind): string
Parameters
# Name Type Value Default
1 path string ""
2 callback function null
3 bind ?object null
Return Values
Type Value Description
string

readNonEmptyLines

@IO.readNonEmptyLines(string $path): object
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
object [line, ...]

readSymbolicLink

@IO.readSymbolicLink(string $path): string
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

selectReadyStreams

@IO.selectReadyStreams(object $read, object $write, object $exceptional, ?number $timeout): object

The timeout may include micro seconds in the fractional part.

Parameters
# Name Type Value Default
1 read object [key: stream, ...] []
2 write object [key: stream, ...] []
3 exceptional object [key: stream, ...] []
4 timeout ?number block indefinitely
Return Values
Type Value Description
object [[original-key: stream, ...], [original-key: stream, ...], [original-key: stream, ...]]

setGroupByID

@IO.setGroupByID(string $path, int $id)

Sets the group of an exiting file by ID.

Parameters
# Name Type Value Default
1 path string ""
2 id int 0

setGroupByName

@IO.setGroupByName(string $path, string $name)

Sets the group of an exiting file by name.

Parameters
# Name Type Value Default
1 path string ""
2 name string ""

setLastAccess

@IO.setLastAccess(string $path, ?int $timestamp)

Sets the last access date and time of an exiting file to a specific timestamp.

Parameters
# Name Type Value Default
1 path string ""
2 timestamp ?int now

setLastModified

@IO.setLastModified(string $path, ?int $timestamp)

Sets the last modification date and time of an exiting file to a specific timestamp.

Parameters
# Name Type Value Default
1 path string ""
2 timestamp ?int now

setPermissions

@IO.setPermissions(string $path, int $mode)

Sets the permissions of an exiting file to a specific numeric mode.

Parameters
# Name Type Value Default
1 path string ""
2 mode int 0o777

setUserByID

@IO.setUserByID(string $path, int $id)

Sets the user of an exiting file by ID.

Parameters
# Name Type Value Default
1 path string ""
2 id int 0

setUserByName

@IO.setUserByName(string $path, string $name)

Sets the user of an exiting file by name.

Parameters
# Name Type Value Default
1 path string ""
2 name string ""

truncate

@IO.truncate(string $path, int $size)

Truncates an existing file to a specific size.

Parameters
# Name Type Value Default
1 path string ""
2 size int 0

write

@IO.write(string $path, string $string): int

Writes a string to a file and returns the number of bytes written.

If the file exists, its content is overwritten, if it does not exist, it is implicitly created.

Parameters
# Name Type Value Default
1 path string ""
2 string string ""
Return Values
Type Value Description
int

writeCSV

@IO.writeCSV(string $path, object $array, string $delimiter): int
Parameters
# Name Type Value Default
1 path string ""
2 array object [[value, ...], ...] []
3 delimiter string ";"
Return Values
Type Value Description
int

writeJSON

@IO.writeJSON(string $path, mixed $value): int
Parameters
# Name Type Value Default
1 path string ""
2 value mixed null
Return Values
Type Value Description
int

.DirectoryIterator

IO.Directory Iterator

object @IO.DirectoryIterator(@Base) {
	construct(string $path) {}
	hasMore(): bool {}
	next(): object {}
	reset(): $this {}
}

IO directory iterator prototype.

Prototype

Base

Methods

construct

new @IO.DirectoryIterator(string $path)
Parameters
# Name Type Value Default
1 path string ""

hasMore

$this.hasMore(): bool
Return Values
Type Value Description
bool

next

$this.next(): object
Return Values
Type Value Description
object [path: filename]
null if there are no more files

reset

$this.reset(): $this
Return Values
Type Value Description
$this

IO.File Stream

object @IO.FileStream(@IO.Stream) {
	construct(string $path, bool $readonly) {}
	canLock(): bool {}
	lock(): $this {}
	lockShared(): $this {}
	selectLock(): object {}
	unlock(): $this {}
}

IO file stream prototype.

Prototype

IO.Stream

Methods

construct

new @IO.FileStream(string $path, bool $readonly)
Parameters
# Name Type Value Default
1 path string ""
2 readonly bool false

canLock

$this.canLock(): bool

Determines whether this stream can be locked.

Return Values
Type Value Description
bool

lock

$this.lock(): $this
Return Values
Type Value Description
$this

lockShared

$this.lockShared(): $this
Return Values
Type Value Description
$this

selectLock

$this.selectLock(): object
Return Values
Type Value Description
@IO.LockContext

unlock

$this.unlock(): $this
Return Values
Type Value Description
$this

IO.Lock Context

object @IO.LockContext(@Base) {
	enter() {}
	exit() {}
}

Abstract IO lock context prototype.

Prototype

Base

Methods

enter

$this.enter()

IO.Process

IO.Process

object @IO.Process(@Base) {
	construct(string $command, string $path, ?object $environment) {}
	close(): int {}
	exit() {}
	getCommand(): string {}
	getExitCode(): int {}
	getProcessID(): int {}
	isRunning(): bool {}
	selectErrorStream(): object {}
	selectInputStream(): object {}
	selectOutputStream(): object {}
	terminate(int $signal): bool {}
	toString(): string {}
}

IO process prototype.

Prototype

Base

Methods

construct

new @IO.Process(string $command, string $path, ?object $environment)
Parameters
# Name Type Value Default
1 command string ""
2 path string ""
3 environment ?object inherited

close

$this.close(): int

Closes this process, frees its associated resources and returns its exit code.

Return Values
Type Value Description
int

exit

$this.exit()

Closes this process and frees its associated resources for the purpose of contextualization.

getCommand

$this.getCommand(): string

Gets the command that created this process.

Return Values
Type Value Description
string

getExitCode

$this.getExitCode(): int

Gets the exit code returned by this process.

Return Values
Type Value Description
int

getProcessID

$this.getProcessID(): int

Gets the process ID.

Return Values
Type Value Description
int

isRunning

$this.isRunning(): bool

Determines whether this process is running.

Return Values
Type Value Description
bool

selectErrorStream

$this.selectErrorStream(): object

Selects the error stream of this process.

Return Values
Type Value Description
@IO.Stream

selectInputStream

$this.selectInputStream(): object

Selects the input stream of this process.

Return Values
Type Value Description
@IO.Stream

selectOutputStream

$this.selectOutputStream(): object

Selects the output stream of this process.

Return Values
Type Value Description
@IO.Stream

terminate

$this.terminate(int $signal): bool

Terminates this process without blocking by signaling a termination request.

Parameters
# Name Type Value Default
1 signal int 15
Return Values
Type Value Description
bool

toString

$this.toString(): string

Converts this process to a string by returning the command that created it.

Return Values
Type Value Description
string

IO.Socket Client

object @IO.SocketClient(@IO.SocketStream) {
	construct(string $endpoint, int $timeout) {}
}

IO socket client prototype.

Prototype

IO.SocketStream

Methods

construct

new @IO.SocketClient(string $endpoint, int $timeout)
Parameters
# Name Type Value Default
1 endpoint string ""
2 timeout int 30 IO.SocketServer

IO.Socket Server

object @IO.SocketServer(@IO.SocketStream) {
	construct(string $endpoint) {}
	accept(int $timeout): object {}
}

IO socket server prototype.

Prototype

IO.SocketStream

Methods

construct

new @IO.SocketServer(string $endpoint)
Parameters
# Name Type Value Default
1 endpoint string ""

accept

$this.accept(int $timeout): object
Parameters
# Name Type Value Default
1 timeout int 30
Return Values
Type Value Description
@IO.SocketStream

IO.Socket Stream

object @IO.SocketStream(@IO.Stream) {
	disableEncryption(): $this {}
	enableEncryption(): $this {}
	getLocalEndPoint(): string {}
	getRemoteEndPoint(): string {}
	peek(int $length): string {}
	receive(int $length): object {}
	receiveOutOfBand(int $length): object {}
	send(string $string, string $endpoint): int {}
	sendOutOfBand(string $string, string $endpoint): int {}
	shutdownReceive(): $this {}
	shutdownSend(): $this {}
}

Abstract IO socket stream prototype.

Prototype

IO.Stream

Methods

disableEncryption

$this.disableEncryption(): $this

This function is complementary to "enableEncryption".

Return Values
Type Value Description
$this

enableEncryption

$this.enableEncryption(): $this

This function is complementary to "disableEncryption".

Return Values
Type Value Description
$this

getLocalEndPoint

$this.getLocalEndPoint(): string
Return Values
Type Value Description
string

getRemoteEndPoint

$this.getRemoteEndPoint(): string
Return Values
Type Value Description
string

peek

$this.peek(int $length): string
Parameters
# Name Type Value Default
1 length int 0
Return Values
Type Value Description
string

receive

$this.receive(int $length): object
Parameters
# Name Type Value Default
1 length int 0
Return Values
Type Value Description
object [string, endpoint]
null if there is nothing to receive

receiveOutOfBand

$this.receiveOutOfBand(int $length): object
Parameters
# Name Type Value Default
1 length int 0
Return Values
Type Value Description
object [string, endpoint]
null if there is nothing to receive

send

$this.send(string $string, string $endpoint): int
Parameters
# Name Type Value Default
1 string string ""
2 endpoint string ""
Return Values
Type Value Description
int

sendOutOfBand

$this.sendOutOfBand(string $string, string $endpoint): int
Parameters
# Name Type Value Default
1 string string ""
2 endpoint string ""
Return Values
Type Value Description
int

shutdownReceive

$this.shutdownReceive(): $this
Return Values
Type Value Description
$this

shutdownSend

$this.shutdownSend(): $this
Return Values
Type Value Description
$this

IO.Stream

object @IO.Stream(@Base) {
	canRead(): bool {}
	canSeek(): bool {}
	canWrite(): bool {}
	close() {}
	copyTo(@IO.Stream $stream, int $length): int {}
	copyAllTo(@IO.Stream $stream): int {}
	copyTailTo(@IO.Stream $stream): int {}
	disableBlocking(): $this {}
	echo(int $length): $this {}
	echoAll(): $this {}
	echoLine(): $this {}
	echoTail(): $this {}
	enableBlocking(): $this {}
	exit() {}
	flush(): $this {}
	getPosition(): int {}
	getSize(): int {}
	getURI(): string {}
	hasMore(): bool {}
	hasTimedOut(): bool {}
	isBlocking(): bool {}
	isLocal(): bool {}
	next(): object {}
	overwrite(string $string): int {}
	pollExceptional(): bool {}
	pollRead(): bool {}
	pollWrite(): bool {}
	read(int $length): string {}
	readAll(): string {}
	readLine(): string {}
	readLineCSV(string $delimiter): object {}
	readTail(): string {}
	reset(): $this {}
	seek(int $position): $this {}
	seekEnd(): $this {}
	setReadBuffer(int $size): $this {}
	setTimeout(int $timeout): $this {}
	setWriteBuffer(int $size): $this {}
	skip(int $offset): $this {}
	sync(): bool {}
	toString(): string {}
	truncate(int $size): $this {}
	write(string $string): int {}
	writeFormatted(string $format, ...$arguments): int {}
	writeLine(string $string): int {}
	writeLineCSV(object $array, string $delimiter): int {}
}

Abstract IO stream prototype.

Prototype

Base

Methods

canRead

$this.canRead(): bool

Determines whether this stream can be read from.

Return Values
Type Value Description
bool

canSeek

$this.canSeek(): bool

Determines whether this stream can be sought.

Return Values
Type Value Description
bool

canWrite

$this.canWrite(): bool

Determines whether this stream can be written to.

Return Values
Type Value Description
bool

close

$this.close()

Closes this stream and frees its associated resources.

copyTo

$this.copyTo(@IO.Stream $stream, int $length): int

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 stream @IO.Stream null
2 length int 0
Return Values
Type Value Description
int

copyAllTo

$this.copyAllTo(@IO.Stream $stream): int

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 stream @IO.Stream null
Return Values
Type Value Description
int

copyTailTo

$this.copyTailTo(@IO.Stream $stream): int

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 stream @IO.Stream null
Return Values
Type Value Description
int

disableBlocking

$this.disableBlocking(): $this

Disables blocking mode for this stream.

This function is complementary to "enableBlocking".

Return Values
Type Value Description
$this

echo

$this.echo(int $length): $this

Outputs the content of this stream up to a specific byte-based length.

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 length int 0
Return Values
Type Value Description
$this

echoAll

$this.echoAll(): $this

This function advances the position within the stream.

Return Values
Type Value Description
$this

echoLine

$this.echoLine(): $this

Outputs the content of this stream as far as and including the next end-of-line sequence.

This function advances the position within the stream.

Return Values
Type Value Description
$this

echoTail

$this.echoTail(): $this

Outputs the remaining content of this stream.

This function advances the position within the stream.

Return Values
Type Value Description
$this

enableBlocking

$this.enableBlocking(): $this

Enables blocking mode for this stream.

This function is complementary to "disableBlocking".

Return Values
Type Value Description
$this

exit

$this.exit()

Closes this stream and frees its associated resources for the purpose of contextualization.

flush

$this.flush(): $this

Flushes the write buffer of this stream.

Return Values
Type Value Description
$this

getPosition

$this.getPosition(): int

Gets the current position within this stream as the number of bytes from its beginning.

Return Values
Type Value Description
int

getSize

$this.getSize(): int

Gets the size of this stream in number of bytes.

Return Values
Type Value Description
int

getURI

$this.getURI(): string

Gets the URI associated with this stream.

Return Values
Type Value Description
string

hasMore

$this.hasMore(): bool

Determines whether this stream has more content.

Return Values
Type Value Description
bool

hasTimedOut

$this.hasTimedOut(): bool

Determines whether this stream has timed out.

Return Values
Type Value Description
bool

isBlocking

$this.isBlocking(): bool

Determines whether this stream is in blocking mode.

Return Values
Type Value Description
bool

isLocal

$this.isLocal(): bool

Determines whether this stream is local.

Return Values
Type Value Description
bool

next

$this.next(): object

Reads the content of this stream as far as and including the next end-of-line sequence for the purpose of iteration.

This function advances the position within the stream.

Return Values
Type Value Description
object [position: line]
null if there are no more lines

overwrite

$this.overwrite(string $string): int

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int

pollExceptional

$this.pollExceptional(): bool
Return Values
Type Value Description
bool

pollRead

$this.pollRead(): bool
Return Values
Type Value Description
bool

pollWrite

$this.pollWrite(): bool
Return Values
Type Value Description
bool

read

$this.read(int $length): string

Reads the content of this stream up to a specific byte-based length.

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 length int 1
Return Values
Type Value Description
string

readAll

$this.readAll(): string

Reads the entire content of this stream.

This function advances the position within the stream.

Return Values
Type Value Description
string

readLine

$this.readLine(): string

Reads the content of this stream as far as and including the next end-of-line sequence.

This function advances the position within the stream.

Return Values
Type Value Description
string
null if there are no more lines

readLineCSV

$this.readLineCSV(string $delimiter): object

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 delimiter string ";"
Return Values
Type Value Description
object [value, ...]
null if there are no more lines

readTail

$this.readTail(): string

Reads the remaining content of this stream.

This function advances the position within the stream.

Return Values
Type Value Description
string

reset

$this.reset(): $this

This function alters the position within the stream.

Return Values
Type Value Description
$this

seek

$this.seek(int $position): $this

If the position is negative, it seeks to that many bytes from the end of the stream.

This function alters the position within the stream.

Parameters
# Name Type Value Default
1 position int 0
Return Values
Type Value Description
$this

seekEnd

$this.seekEnd(): $this

This function alters the position within the stream.

Return Values
Type Value Description
$this

setReadBuffer

$this.setReadBuffer(int $size): $this

Sets the read buffer size of this stream to a specific number of bytes.

If the size is zero, read buffering will be disabled.

Parameters
# Name Type Value Default
1 size int 0
Return Values
Type Value Description
$this

setTimeout

$this.setTimeout(int $timeout): $this

Sets the timeout period of this stream to a specific number of seconds.

Parameters
# Name Type Value Default
1 timeout int 30
Return Values
Type Value Description
$this

setWriteBuffer

$this.setWriteBuffer(int $size): $this

Sets the write buffer size of this stream to a specific number of bytes.

If the size is zero, write buffering will be disabled.

Parameters
# Name Type Value Default
1 size int 0
Return Values
Type Value Description
$this

skip

$this.skip(int $offset): $this

This function alters the position within the stream.

Parameters
# Name Type Value Default
1 offset int 1
Return Values
Type Value Description
$this

sync

$this.sync(): bool

Synchonizes this stream with the underlying storage device.

Return Values
Type Value Description
bool

toString

$this.toString(): string

Converts this stream to a string by returning its associated URI.

Return Values
Type Value Description
string

truncate

$this.truncate(int $size): $this

Truncates this stream to a specific size.

Parameters
# Name Type Value Default
1 size int 0
Return Values
Type Value Description
$this

write

$this.write(string $string): int

Writes a string to this stream and returns the number of bytes written.

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int

writeFormatted

$this.writeFormatted(string $format, ...$arguments): int

Complex arguments are interpreted as strings for the purpose of formatting.

Parameters
# Name Type Value Default
1 format string ""
... arguments variadic ...
Return Values
Type Value Description
int

writeLine

$this.writeLine(string $string): int

Writes a string appended by an end-of-line sequence to this stream and returns the number of bytes written.

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int

writeLineCSV

$this.writeLineCSV(object $array, string $delimiter): int

This function advances the position within the stream.

Parameters
# Name Type Value Default
1 array object [value, ...] []
2 delimiter string ";"
Return Values
Type Value Description
int

MIME

object @MIME() {
	createMultipart(object $parts, string $boundary, string $preamble, string $epilog): string {}
	fromBase64(string $string): string {}
	fromEncodedWord(string $string): string {}
	fromQuotedPrintable(string $string): string {}
	isPrintable(string $string): bool {}
	parseMultipart(string $body, ?string $boundary): object {}
	toBase64(string $string): string {}
	toBase64Raw(string $string): string {}
	toEncodedWord(string $string): string {}
	toQuotedPrintable(string $string): string {}
}

Static MIME related functions.

Functions

createMultipart

@MIME.createMultipart(object $parts, string $boundary, string $preamble, string $epilog): string
Parameters
# Name Type Value Default
1 parts object []
2 boundary string ""
3 preamble string ""
4 epilog string ""
Return Values
Type Value Description
string

fromBase64

@MIME.fromBase64(string $string): string

Decodes a string according to RFC 2045 by converting printable characters back to arbitrary byte sequences.

MIME Base64 is designed to make binary data survive transmission via transport layers that are not 8-bit clean. MIME Base64-encoded data is about 33 percent larger than the original data.

This function is complementary to "toBase64".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

fromEncodedWord

@MIME.fromEncodedWord(string $string): string

This function is complementary to "toEncodedWord".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

fromQuotedPrintable

@MIME.fromQuotedPrintable(string $string): string

Decodes a string according to RFC 2045 by replacing sequences incipient with an equal sign ("=") followed by a 2-character hexadecimal number with their applicable characters.

This function is complementary to "toQuotedPrintable".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

isPrintable

@MIME.isPrintable(string $string): bool
Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

parseMultipart

@MIME.parseMultipart(string $body, ?string $boundary): object
Parameters
# Name Type Value Default
1 body string ""
2 boundary ?string detect
Return Values
Type Value Description
object [part, ...]
null if the boundary is not found

toBase64

@MIME.toBase64(string $string): string

Encodes a string in lines of no more than 76 bytes according to RFC 2045 using a 65-character printable subset of US-ASCII to represent arbitrary byte sequences.

MIME Base64 is designed to make binary data survive transmission via transport layers that are not 8-bit clean. MIME Base64-encoded data is about 33 percent larger than the original data.

This function is complementary to "fromBase64".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

toBase64Raw

@MIME.toBase64Raw(string $string): string

Encodes a string without line breaks according to RFC 2045 using a 65-character printable subset of US-ASCII to represent arbitrary byte sequences.

MIME Base64 is designed to make binary data survive transmission via transport layers that are not 8-bit clean. MIME Base64-encoded data is about 33 percent larger than the original data.

This function is complementary to "fromBase64".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

toEncodedWord

@MIME.toEncodedWord(string $string): string

This function is complementary to "fromEncodedWord".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

toQuotedPrintable

@MIME.toQuotedPrintable(string $string): string

Encodes a string in lines of no more than 76 bytes according to RFC 2045 by replacing every unprintable character with an equal sign ("=") followed by a 2-character hexadecimal number.

This function is complementary to "fromQuotedPrintable".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

Mail

object @Mail() {
	isValidAddress(string $address): bool {}
	parseMessage(string $message): object {}
	uudecode(string $string): string {}
	uuencode(string $string): string {}
}

Static mail related prototypes and functions.

Functions

isValidAddress

@Mail.isValidAddress(string $address): bool
Parameters
# Name Type Value Default
1 address string ""
Return Values
Type Value Description
bool

parseMessage

@Mail.parseMessage(string $message): object
Parameters
# Name Type Value Default
1 message string ""
Return Values
Type Value Description
@Mail.Message

uudecode

@Mail.uudecode(string $string): string

Decodes a string using the Uuencoding algorithm.

Uuencoding is designed to make binary data survive transmission over the UUCP mail system.

This function is complementary to "uuencode".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

uuencode

@Mail.uuencode(string $string): string

Encodes a string using the Uuencoding algorithm.

Uuencoding is designed to make binary data survive transmission over the UUCP mail system.

This function is complementary to "uudecode".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

.Message

Mail.Message

object @Mail.Message(@Base) {
	clearHeaders(): $this {}
	create(): string {}
	getDisposition(): string {}
	getFilename(): string {}
	getHeader(string $name): string {}
	getTransferEncoding(): string {}
	getType(): string {}
	isAttachment(): bool {}
	listHeaders(): object {}
	removeHeader(string $name): $this {}
	setHeader(string $name, mixed $value): $this {}
	setHeaders(object $headers, string $prefix): $this {}
	setDisposition(string $disposition, string $filename): $this {}
	setTransferEncoding(string $encoding): $this {}
	setType(string $type): $this {}
}

Abstract mail message prototype.

Prototype

Base

Methods

clearHeaders

$this.clearHeaders(): $this
Return Values
Type Value Description
$this

create

$this.create(): string
Return Values
Type Value Description
string

getDisposition

$this.getDisposition(): string

Gets the content disposition of this message.

Return Values
Type Value Description
string

getFilename

$this.getFilename(): string

Gets the filename of this message.

Return Values
Type Value Description
string

getHeader

$this.getHeader(string $name): string
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string
object [value, ...] if the header has multiple values
null if the header is not found

getTransferEncoding

$this.getTransferEncoding(): string

Gets the content transfer encoding of this message.

Return Values
Type Value Description
string

getType

$this.getType(): string

Gets the content type of this message.

Return Values
Type Value Description
string

isAttachment

$this.isAttachment(): bool
Return Values
Type Value Description
bool

listHeaders

$this.listHeaders(): object
Return Values
Type Value Description
object [name: value, ...]

removeHeader

$this.removeHeader(string $name): $this
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
$this

setHeader

$this.setHeader(string $name, mixed $value): $this

Sets a mail header.

Parameters
# Name Type Value Default
1 name string ""
2 value mixed null
Return Values
Type Value Description
$this

setHeaders

$this.setHeaders(object $headers, string $prefix): $this

Sets multiple mail headers by treating slot names as header names, expanded by a specific prefix, and slot values as non-referential header values.

Parameters
# Name Type Value Default
1 headers object [name: value, ...] []
2 prefix string ""
Return Values
Type Value Description
$this

setDisposition

$this.setDisposition(string $disposition, string $filename): $this

Sets the content disposition of this message.

Parameters
# Name Type Value Default
1 disposition string ""
2 filename string ""
Return Values
Type Value Description
$this

setTransferEncoding

$this.setTransferEncoding(string $encoding): $this

Sets the content transfer encoding of this message.

Parameters
# Name Type Value Default
1 encoding string ""
Return Values
Type Value Description
$this

setType

$this.setType(string $type): $this

Sets the content type of this message.

Parameters
# Name Type Value Default
1 type string ""
Return Values
Type Value Description
$this

Mail.Multipart Message

object @Mail.MultipartMessage(@Mail.Message) {
	construct() {}
	addPart(@Mail.Message $message): $this {}
	attach(string $string, string $filename, string $type): object {}
	attachFile(string $path, ?string $filename, string $type): object {}
	clearParts(): $this {}
	countParts(): int {}
	getBoundary(): string {}
	listParts(): object {}
	removePart(@Mail.Message $message): $this {}
	setBoundary(string $boundary): $this {}
}

Multipart mail message prototype.

Prototype

Mail.Message

Methods

construct

new @Mail.MultipartMessage()

addPart

$this.addPart(@Mail.Message $message): $this
Parameters
# Name Type Value Default
1 message @Mail.Message null
Return Values
Type Value Description
$this

attach

$this.attach(string $string, string $filename, string $type): object
Parameters
# Name Type Value Default
1 string string ""
2 filename string ""
3 type string "application/octet-stream"
Return Values
Type Value Description
@Mail.SimpleMessage

attachFile

$this.attachFile(string $path, ?string $filename, string $type): object
Parameters
# Name Type Value Default
1 path string ""
2 filename ?string derived from path
3 type string "application/octet-stream"
Return Values
Type Value Description
@Mail.SimpleMessage

clearParts

$this.clearParts(): $this
Return Values
Type Value Description
$this

countParts

$this.countParts(): int
Return Values
Type Value Description
int

getBoundary

$this.getBoundary(): string

Gets the boundary delimiter of this message.

Return Values
Type Value Description
string

listParts

$this.listParts(): object
Return Values
Type Value Description
object [message, ...]

removePart

$this.removePart(@Mail.Message $message): $this
Parameters
# Name Type Value Default
1 message @Mail.Message null
Return Values
Type Value Description
$this

setBoundary

$this.setBoundary(string $boundary): $this

Sets the boundary delimiter of this message.

Parameters
# Name Type Value Default
1 boundary string ""
Return Values
Type Value Description
$this

Mail.Simple Message

object @Mail.SimpleMessage(@Mail.Message) {
	construct() {}
	getBody(): string {}
	getBodyRaw(): string {}
	getCharset(): string {}
	isText(): bool {}
	setBody(string $body, ?string $encoding): $this {}
	setBodyRaw(string $body): $this {}
	setCharset(string $charset): $this {}
	setText(string $text, ?string $charset): $this {}
}

Simple mail message prototype.

Prototype

Mail.Message

Methods

construct

new @Mail.SimpleMessage()

getBody

$this.getBody(): string
Return Values
Type Value Description
string

getBodyRaw

$this.getBodyRaw(): string
Return Values
Type Value Description
string

getCharset

$this.getCharset(): string

Gets the character set of this message.

Return Values
Type Value Description
string

isText

$this.isText(): bool
Return Values
Type Value Description
bool

setBody

$this.setBody(string $body, ?string $encoding): $this
Parameters
# Name Type Value Default
1 body string ""
2 encoding ?string current encoding
Return Values
Type Value Description
$this

setBodyRaw

$this.setBodyRaw(string $body): $this
Parameters
# Name Type Value Default
1 body string ""
Return Values
Type Value Description
$this

setCharset

$this.setCharset(string $charset): $this
Parameters
# Name Type Value Default
1 charset string ""
Return Values
Type Value Description
$this

setText

$this.setText(string $text, ?string $charset): $this
Parameters
# Name Type Value Default
1 text string ""
2 charset ?string current charset or UTF-8 if empty
Return Values
Type Value Description
$this

Math

object @Math() {
	E;
	LN2;
	LN10;
	LNPI;
	LOG10E;
	LOG2E;
	PI;
	SQRT2;
	SQRT3;
	SQRTPI;
	abs(number $x): number {}
	acos(number $x): float {}
	acosh(number $x): float {}
	acot(number $x): float {}
	acoth(number $x): float {}
	acsc(number $x): float {}
	acsch(number $x): float {}
	add(number $x, number $y): number {}
	alice(): float {}
	asec(number $x): float {}
	asech(number $x): float {}
	asin(number $x): float {}
	asinh(number $x): float {}
	atan(number $x): float {}
	atan2(number $x, number $y): float {}
	atanh(number $x): float {}
	bob(): float {}
	cbrt(number $x): number {}
	cos(number $x): float {}
	ceil(number $x): float {}
	cosh(number $x): float {}
	cot(number $x): float {}
	coth(number $x): float {}
	csc(number $x): float {}
	csch(number $x): float {}
	dim(number $x, number $y): number {}
	div(number $x, number $y): number {}
	erf(number $x): float {}
	euclideanMod(number $x, number $y): float {}
	exp(number $x): float {}
	expm1(number $x): float {}
	fact(number $x): number {}
	fib(number $x): float {}
	floor(number $x): float {}
	flooredMod(number $x, number $y): float {}
	fromDegrees(number $angle): float {}
	gcd(number $x, number $y): number {}
	hypot(number $x, number $y): float {}
	lcg(): float {}
	ln(number $x): float {}
	ln1p(number $x): float {}
	log(number $x, number $y): float {}
	mod(number $x, number $y): float {}
	mul(number $x, number $y): number {}
	neg(number $x): number {}
	pow(number $x, number $y): number {}
	rand(): float {}
	recip(number $x): float {}
	rem(number $x, number $y): number {}
	root(number $x, number $y): number {}
	round(number $number): float {}
	sec(number $x): float {}
	sech(number $x): float {}
	sgn(number $x): int {}
	sin(number $x): float {}
	sinh(number $x): float {}
	sqr(number $x): number {}
	sqrt(number $x): float {}
	sub(number $x, number $y): number {}
	tan(number $x): float {}
	tanh(number $x): float {}
	toDegrees(number $angle): float {}
	truncate(number $x): float {}
	truncatedDiv(number $x, number $y): number {}
}

Static mathematical constants and functions.

Consts

Name Type Description
E float Euler's number and the base of natural logarithms, approximately 2.718
LN2 float Natural logarithm of 2, approximately 0.693
LN10 float Natural logarithm of 10, approximately 2.303
LNPI float Natural logarithm of PI, approximately 1.145
LOG10E float Base 10 logarithm of E, approximately 0.434
LOG2E float Base 2 logarithm of E, approximately 1.443
PI float Ratio of the circumference of a circle to its diameter, approximately 3.142
SQRT2 float Square root of 2, approximately 1.414
SQRT3 float Square root of 3, approximately 1.732
SQRTPI float Square root of PI, approximately 1.772

Functions

abs

@Math.abs(number $x): number

Returns the absolute value of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
number

acos

@Math.acos(number $x): float

Calculates the inverse cosine of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float NAN if the number is less than minus one or greater than plus one

acosh

@Math.acosh(number $x): float

Calculates the inverse hyperbolic cosine of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float NAN if the number is zero

acot

@Math.acot(number $x): float

Calculates the inverse cotangent of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

acoth

@Math.acoth(number $x): float

Calculates the inverse hyperbolic cotangent of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float +INF if the number is plus one
float -INF if the number is minus one
float NAN if the number is zero or less than plus one and greater than minus one

acsc

@Math.acsc(number $x): float

Calculates the inverse cosecant of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float NAN if the number is zero or less than plus one and greater than minus one

acsch

@Math.acsch(number $x): float

Calculates the inverse hyperbolic cosecant of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float NAN if the number is zero

add

@Math.add(number $x, number $y): number

Adds two numbers (x+y) and returns the sum.

This function is equivalent to the "+" operator.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
number
float NAN if one summand is +INF and the other is -INF

alice

@Math.alice(): float

Easter egg simulating quantum entanglement of two electrons (Alice and Bob).

This function is complementary to "bob".

Return Values
Type Value Description
float +0.5 spin up
float -0.5 spin down

asec

@Math.asec(number $x): float

Calculates the inverse secant of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float NAN if the number is zero or less than plus one and greater than minus one

asech

@Math.asech(number $x): float

Calculates the inverse hyperbolic secant of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float NAN if the number is zero

asin

@Math.asin(number $x): float

Calculates the inverse sine of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float NAN if the number is less than minus one or greater than plus one

asinh

@Math.asinh(number $x): float

Calculates the inverse hyperbolic sine of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

atan

@Math.atan(number $x): float

Calculates the inverse tangent of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

atan2

@Math.atan2(number $x, number $y): float

Calculates the inverse tangent of the division of two numbers (y/x) representing the angle theta of an (x,y) point in radians using the sign of both numbers to determine the quadrant.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
float

atanh

@Math.atanh(number $x): float

Calculates the inverse hyperbolic tangent of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float +INF if the number is plus one
float -INF if the number is minus one
float NAN if the number is less than minus one or greater than plus one

bob

@Math.bob(): float

Easter egg simulating quantum entanglement of two electrons (Alice and Bob).

This function is complementary to "alice".

Return Values
Type Value Description
float +0.5 spin up
float -0.5 spin down

cbrt

@Math.cbrt(number $x): number

Calculates the principal cube root of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
number
float NAN if the number is negative

cos

@Math.cos(number $x): float

Calculates the cosine of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

ceil

@Math.ceil(number $x): float

Returns the ceiling of a number by rounding it up to the next highest integer.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

cosh

@Math.cosh(number $x): float

Calculates the hyperbolic cosine of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

cot

@Math.cot(number $x): float

Calculates the cotangent of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float +INF if the number is zero

coth

@Math.coth(number $x): float

Calculates the hyperbolic cotangent of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float +INF if the number is zero

csc

@Math.csc(number $x): float

Calculates the cosecant of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float +INF if the number is zero

csch

@Math.csch(number $x): float

Calculates the hyperbolic cosecant of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float +INF if the number is zero

dim

@Math.dim(number $x, number $y): number

Returns the greatest of zero and the difference of two numbers (x-y).

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
number
float NAN if any number is NaN

div

@Math.div(number $x, number $y): number

Divides two numbers (x/y) and returns the quotient.

This function is equivalent to the "/" operator.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
number
float +INF if the dividend is greater than zero and the divisor is zero
float -INF if the dividend is less than zero and the divisor is zero
float NAN if the dividend and the divisor are zero or +-INF

erf

@Math.erf(number $x): float

Calculates the error function of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

euclideanMod

@Math.euclideanMod(number $x, number $y): float

Divides two numbers (x/y) and returns the remainder in relation to the euclidean quotient.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
float
float NAN if the divisor is zero

exp

@Math.exp(number $x): float

Raises Euler's constant to the power of an exponent (x).

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

expm1

@Math.expm1(number $x): float

Raises Euler's constant to the power of an exponent (x) minus one (exp(x)-1), calculated with best accuracy.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

fact

@Math.fact(number $x): number

Calculates the factorial of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
number
float NAN if the number is negative

fib

@Math.fib(number $x): float

Calculates a specific Fibonacci number using Binet's formula.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

floor

@Math.floor(number $x): float

Returns the floor of a number by rounding it down to the next lowest integer.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

flooredMod

@Math.flooredMod(number $x, number $y): float

Divides two numbers (x/y) and returns the remainder in relation to the floored quotient.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
float
float NAN if the divisor is zero

fromDegrees

@Math.fromDegrees(number $angle): float

Converts an angle in degrees to its equivalent in radians.

This function is complementary to "toDegrees".

Parameters
# Name Type Value Default
1 angle number 0
Return Values
Type Value Description
float

gcd

@Math.gcd(number $x, number $y): number

Calculates the absolute greatest common divisor of two numbers.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
number
float NAN if any number is NaN or has a fractional part

hypot

@Math.hypot(number $x, number $y): float

Measures the length of the hypotenuse of a right-angle triangle (sqrt(xx+yy)).

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
float

lcg

@Math.lcg(): float

Generates a pseudo-random number between zero and one using a linear congruential generator.

Return Values
Type Value Description
float

ln

@Math.ln(number $x): float

Calculates the natural logarithm of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float -INF if the number is zero
float NAN if the number is negative

ln1p

@Math.ln1p(number $x): float

Calculates the natural logarithm of a number plus one (ln(x+1)), calculated with best accuracy.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float -INF if the number is minus one
float NAN if the number is less than minus one

log

@Math.log(number $x, number $y): float

Calculates the logarithm of a number (x) to a base (y).

Parameters
# Name Type Value Default
1 x number 0
2 y number 10
Return Values
Type Value Description
float
float -INF if the number is zero
float NAN if the number is negative or if the base is less than or equal to zero

mod

@Math.mod(number $x, number $y): float

Divides two numbers (x/y) and returns the remainder in relation to the truncated quotient.

This function is equivalent to the "%" operator.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
float
float NAN if the divisor is zero

mul

@Math.mul(number $x, number $y): number

Multiplies two numbers (x*y) and returns the product.

This function is equivalent to the "*" operator.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
number
float NAN if one multiplicand is zero and the other is +-INF

neg

@Math.neg(number $x): number

Returns the additive inverse of a number.

This function is equivalent to the unary "-" operator.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
number

pow

@Math.pow(number $x, number $y): number

Raises a base (x) to the power of an exponent (y).

This function is equivalent to the "**" operator.

Parameters
# Name Type Value Default
1 x number 0
2 y number 10
Return Values
Type Value Description
number
float NAN if the base is negative and the exponent has a fractional part

rand

@Math.rand(): float

Generates a pseudo-random number between zero and one using the Mersenne Twister algorithm.

Return Values
Type Value Description
float

recip

@Math.recip(number $x): float

Returns the multiplicative inverse (reciprocal, 1/x) of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float +INF if the number is zero

rem

@Math.rem(number $x, number $y): number

Divides two numbers (x/y) and returns the remainder in relation to the rounded quotient as defined in IEEE 754.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
number
float NAN if the divisor is zero

root

@Math.root(number $x, number $y): number

Calculates the principal root of a radicand (x) to a degree (y).

Parameters
# Name Type Value Default
1 x number 0
2 y number 10
Return Values
Type Value Description
number
float NAN if the radicand is negative or the degree is zero

round

@Math.round(number $number): float

Rounds a number to nearest, ties to even as defined in IEEE 754.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
float

sec

@Math.sec(number $x): float

Calculates the secant of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

sech

@Math.sech(number $x): float

Calculates the hyperbolic secant of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

sgn

@Math.sgn(number $x): int

Returns the sign of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
int +1 if the number is positive
int -1 if the number is negative
int 0 if the number is zero
float NAN if the number is NaN

sin

@Math.sin(number $x): float

Calculates the sine of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

sinh

@Math.sinh(number $x): float

Calculates the hyperbolic sine of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

sqr

@Math.sqr(number $x): number

Calculates the square of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
number

sqrt

@Math.sqrt(number $x): float

Calculates the principal square root of a number.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float
float NAN if the number is negative

sub

@Math.sub(number $x, number $y): number

Subtracts two numbers (x-y) and returns the difference.

This function is equivalent to the "-" operator.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
number
float NAN if the minuend is +-INF and the subtrahend is the additive inverse of the minuend

tan

@Math.tan(number $x): float

Calculates the tangent of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

tanh

@Math.tanh(number $x): float

Calculates the hyperbolic tangent of a number in radians.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

toDegrees

@Math.toDegrees(number $angle): float

Converts an angle in radians to its equivalent in degrees.

This function is complementary to "fromDegrees".

Parameters
# Name Type Value Default
1 angle number 0
Return Values
Type Value Description
float

truncate

@Math.truncate(number $x): float

Truncates a number by rounding it towards zero, whereas the fractional part is discarded.

Parameters
# Name Type Value Default
1 x number 0
Return Values
Type Value Description
float

truncatedDiv

@Math.truncatedDiv(number $x, number $y): number

Divides two numbers (x/y) and returns the truncated quotient.

Parameters
# Name Type Value Default
1 x number 0
2 y number 0
Return Values
Type Value Description
number
float +INF if the dividend is greater than zero and the divisor is zero
float -INF if the dividend is less than zero and the divisor is zero
float NAN if the dividend and the divisor are zero or +-INF

Number

object @Number() {
	EPSILON;
	INF;
	INTSIZE;
	MINFLOAT;
	MININT;
	MAXFLOAT;
	MAXINT;
	NAN;
	compare(number $number1, number $number2): int {}
	countLeadingZeros(int $number): int {}
	equals(number $number1, number $number2): bool {}
	format(number $number, int $digits, string $point, string $separator): string {}
	fromBinary(string $binary): number {}
	fromHex(string $hex): number {}
	fromOctal(string $octal): number {}
	hasFractionalPart(number $number): bool {}
	hasIntegerPart(number $number): bool {}
	isBigEndian(): bool {}
	isEven(number $number): bool {}
	isFinite(number $number): bool {}
	isInfinite(number $number): bool {}
	isNaN(number $number): bool {}
	isNatural(number $number): bool {}
	isNegative(number $number): bool {}
	isOdd(number $number): bool {}
	isPositive(number $number): bool {}
	isPrime(number $number): bool {}
	isZero(number $number): bool {}
	max(...$numbers): number {}
	min(...$numbers): number {}
	randomFloat(number $min, number $max): float {}
	randomInt(int $min, int $max): int {}
	roundDown(number $number, int $precision): float {}
	roundHalfDown(number $number, int $precision): float {}
	roundHalfToEven(number $number, int $precision): float {}
	roundHalfToOdd(number $number, int $precision): float {}
	roundHalfToInfinity(number $number, int $precision): float {}
	roundHalfToZero(number $number, int $precision): float {}
	roundHalfUp(number $number, int $precision): float {}
	roundToInfinity(number $number, int $precision): float {}
	roundToZero(number $number, int $precision): float {}
	roundUp(number $number, int $precision): float {}
	toBinary(int $decimal): string {}
	toExponential(number $number, ?int $digits): string {}
	toFixed(number $number, int $digits): string {}
	toHex(int $decimal): string {}
	toOctal(int $decimal): string {}
	toPrecision(number $number, int $precision): string {}
}

Static number related constants and functions.

Consts

Name Type Description
EPSILON float Machine epsilon or unit roundoff, which is defined as the smallest value that, when added to one, yields a result greater than one
INF float Special value representing infinity; returned on overflow
INTSIZE int Size of type "int" in number of bytes
MINFLOAT float Minimum value of type "float"
MININT int Minimum value of type "int"
MAXFLOAT float Maximum value of type "float"
MAXINT int Maximum value of type "int"
NAN float Special "not a number" value

Functions

compare

@Number.compare(number $number1, number $number2): int

Compares two numbers in a numeric manner.

This function is equivalent to the "<=>" operator on numbers.

Parameters
# Name Type Value Default
1 number1 number 0
2 number2 number 0
Return Values
Type Value Description
int +1 if the first number is greater than the second number
int -1 if the first number is less than the second number
int 0 if both numbers are equal or any number is NaN

countLeadingZeros

@Number.countLeadingZeros(int $number): int

Counts the leading zeros of an unsigned integer number.

Parameters
# Name Type Value Default
1 number int 0
Return Values
Type Value Description
int

equals

@Number.equals(number $number1, number $number2): bool

Determines whether two numbers are equal, considering the machine epsilon.

This function is equivalent to the "==" operator on numbers.

Parameters
# Name Type Value Default
1 number1 number 0
2 number2 number 0
Return Values
Type Value Description
bool

format

@Number.format(number $number, int $digits, string $point, string $separator): string

Returns the formatted representation of a number with a fixed number of decimal digits and grouped thousands.

Parameters
# Name Type Value Default
1 number number 0
2 digits int 0
3 point string "."
4 separator string " "
Return Values
Type Value Description
string

fromBinary

@Number.fromBinary(string $binary): number

Converts a binary string representation to its equivalent decimal number.

This function is complementary to "toBinary".

Parameters
# Name Type Value Default
1 binary string ""
Return Values
Type Value Description
number

fromHex

@Number.fromHex(string $hex): number

Converts a hexadecimal string representation to its equivalent decimal number.

This function is complementary to "toHex".

Parameters
# Name Type Value Default
1 hex string ""
Return Values
Type Value Description
number

fromOctal

@Number.fromOctal(string $octal): number

Converts an octal string representation to its equivalent decimal number.

This function is complementary to "toOctal".

Parameters
# Name Type Value Default
1 octal string ""
Return Values
Type Value Description
number

hasFractionalPart

@Number.hasFractionalPart(number $number): bool

Determines whether a number has a fractional part.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

hasIntegerPart

@Number.hasIntegerPart(number $number): bool

Determines whether a number has an integer part.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isBigEndian

@Number.isBigEndian(): bool

Determines whether the machine is of a big-endian architecture.

Return Values
Type Value Description
bool

isEven

@Number.isEven(number $number): bool

Determines whether a number is even.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isFinite

@Number.isFinite(number $number): bool

Determines whether a number is finite.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isInfinite

@Number.isInfinite(number $number): bool

Determines whether a number is infinite.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isNaN

@Number.isNaN(number $number): bool

Determines whether a number is "not a number" (NaN).

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isNatural

@Number.isNatural(number $number): bool

Determines whether a number is in the set of natural numbers including zero.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isNegative

@Number.isNegative(number $number): bool

Determines whether a number is negative.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isOdd

@Number.isOdd(number $number): bool

Determines whether a number is odd.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isPositive

@Number.isPositive(number $number): bool

Determines whether a number is positive.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isPrime

@Number.isPrime(number $number): bool

Determines whether a number is a prime number.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

isZero

@Number.isZero(number $number): bool

Determines whether a number equals zero.

Parameters
# Name Type Value Default
1 number number 0
Return Values
Type Value Description
bool

max

@Number.max(...$numbers): number

Returns the greatest of numbers.

Parameters
# Name Type Value Default
... numbers variadic ...
Return Values
Type Value Description
number
float NAN if any number is NaN
null if there are no numbers

min

@Number.min(...$numbers): number

Returns the least of numbers.

Parameters
# Name Type Value Default
... numbers variadic ...
Return Values
Type Value Description
number
float NAN if any number is NaN
null if there are no numbers

randomFloat

@Number.randomFloat(number $min, number $max): float

Generates a floating point number between two numbers from a random source.

Parameters
# Name Type Value Default
1 min number 0
2 max number MAXINT
Return Values
Type Value Description
float
float NAN if any number is NaN or +-INF

randomInt

@Number.randomInt(int $min, int $max): int

Generates an integer number between two numbers from a random source.

Parameters
# Name Type Value Default
1 min int 0
2 max int MAXINT
Return Values
Type Value Description
int

roundDown

@Number.roundDown(number $number, int $precision): float

Rounds a number downwards to negative infinity with a specific precision.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundHalfDown

@Number.roundHalfDown(number $number, int $precision): float

Rounds a number downwards to nearest with a specific precision, ties towards negative infinity.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundHalfToEven

@Number.roundHalfToEven(number $number, int $precision): float

Rounds a number symmetrically to nearest with a specific precision, ties to even.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundHalfToOdd

@Number.roundHalfToOdd(number $number, int $precision): float

Rounds a number symmetrically to nearest with a specific precision, ties to odd.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundHalfToInfinity

@Number.roundHalfToInfinity(number $number, int $precision): float

Rounds a number symmetrically to nearest with a specific precision, ties towards infinity.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundHalfToZero

@Number.roundHalfToZero(number $number, int $precision): float

Rounds a number symmetrically to nearest with a specific precision, ties towards zero.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundHalfUp

@Number.roundHalfUp(number $number, int $precision): float

Rounds a number upwards to nearest with a specific precision, ties towards positive infinity.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundToInfinity

@Number.roundToInfinity(number $number, int $precision): float

Rounds a number symmetrically towards infinity with a specific precision.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundToZero

@Number.roundToZero(number $number, int $precision): float

Rounds a number symmetrically towards zero with a specific precision.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

roundUp

@Number.roundUp(number $number, int $precision): float

Rounds a number upwards to positive infinity with a specific precision.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
float

toBinary

@Number.toBinary(int $decimal): string

Converts a decimal number to its equivalent binary string representation.

This function is complementary to "fromBinary".

Parameters
# Name Type Value Default
1 decimal int 0
Return Values
Type Value Description
string

toExponential

@Number.toExponential(number $number, ?int $digits): string

Converts a number to its equivalent string representation in exponential notation with a fixed number of decimal digits.

Parameters
# Name Type Value Default
1 number number 0
2 digits ?int all digits necessary
Return Values
Type Value Description
string

toFixed

@Number.toFixed(number $number, int $digits): string

Converts a number to its equivalent string representation in fixed-point notation with a fixed number of decimal digits.

Parameters
# Name Type Value Default
1 number number 0
2 digits int 0
Return Values
Type Value Description
string

toHex

@Number.toHex(int $decimal): string

Converts a decimal number to its equivalent hexadecimal string representation.

This function is complementary to "fromHex".

Parameters
# Name Type Value Default
1 decimal int 0
Return Values
Type Value Description
string

toOctal

@Number.toOctal(int $decimal): string

Converts a decimal number to its equivalent octal string representation.

This function is complementary to "fromOctal".

Parameters
# Name Type Value Default
1 decimal int 0
Return Values
Type Value Description
string

toPrecision

@Number.toPrecision(number $number, int $precision): string

Converts a number to its equivalent string representation in fixed-point or exponential notation to a specific precision.

Parameters
# Name Type Value Default
1 number number 0
2 precision int 0
Return Values
Type Value Description
string

Output

object @Output() {
	echo(...$strings) {}
	getLevel(): int {}
}

Static standard output related prototypes and functions.

Functions

echo

@Output.echo(...$strings)

Outputs strings.

This function is equivalent to the "echo" statement.

Parameters
# Name Type Value Default
... strings variadic ...

getLevel

@Output.getLevel(): int

Gets the nesting level of output buffering.

Return Values
Type Value Description
int

.Buffer

Output.Buffer

object @Output.Buffer(@Base) {
	construct() {}
	clear(): $this {}
	close(): string {}
	exit() {}
	flush(): $this {}
	getContent(): string {}
	getSize(): int {}
}

Output buffer prototype.

Prototype

Base

Methods

construct

new @Output.Buffer()

clear

$this.clear(): $this

Clears this buffer.

Return Values
Type Value Description
$this

close

$this.close(): string

Closes this buffer, frees its associated resources and returns its content.

Return Values
Type Value Description
string

exit

$this.exit()

Closes this buffer and frees its associated resources for the purpose of contextualization.

flush

$this.flush(): $this

Flushes this buffer.

Return Values
Type Value Description
$this

getContent

$this.getContent(): string

Gets the content of this buffer.

Return Values
Type Value Description
string

getSize

$this.getSize(): int

Gets the size of this buffer in number of bytes.

Return Values
Type Value Description
int

Path

object @Path() {
	DIRECTORYSEPARATOR;
	MAXLENGTH;
	PATHSEPARATOR;
	getBase(string $path): string {}
	getDirectory(string $path): string {}
	getExtension(string $path): string {}
	getFile(string $path): string {}
	getTempDirectory(): string {}
	getWorkingDirectory(): string {}
	hasExtension(string $path): bool {}
	isAbsolute(string $path): bool {}
	isLocal(string $path): bool {}
	normalize(string $path): string {}
	parse(string $path): object {}
	setWorkingDirectory(string $path) {}
	toAbsolutePath(string $path): string {}
	toRealPath(string $path): string {}
	toURI(string $path): string {}
}

Static path related constants and functions.

Consts

Name Type Description
DIRECTORYSEPARATOR string
MAXLENGTH int
PATHSEPARATOR string

Functions

getBase

@Path.getBase(string $path): string

Gets the base name component of a path.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

getDirectory

@Path.getDirectory(string $path): string

Gets the directory name component of a path.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

getExtension

@Path.getExtension(string $path): string

Gets the file extension component of a path.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

getFile

@Path.getFile(string $path): string

Gets the filename component of a path.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

getTempDirectory

@Path.getTempDirectory(): string

Gets the absolute path of the system's directory for temporary files.

Return Values
Type Value Description
string

getWorkingDirectory

@Path.getWorkingDirectory(): string

Gets the absolute path of the current working directory.

Return Values
Type Value Description
string

hasExtension

@Path.hasExtension(string $path): bool

Determines whether a path has a file extension component.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

isAbsolute

@Path.isAbsolute(string $path): bool

Determines whether a path is absolute.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

isLocal

@Path.isLocal(string $path): bool

Determines whether a path is local.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

normalize

@Path.normalize(string $path): string

Normalizes a path to its canonicalized representation.

Removes dot-segments from path.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

parse

@Path.parse(string $path): object
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
object ["directory": ..., "file": ..., "extension": ...]

setWorkingDirectory

@Path.setWorkingDirectory(string $path)

Sets the path of the working directory.

Parameters
# Name Type Value Default
1 path string ""

toAbsolutePath

@Path.toAbsolutePath(string $path): string

Converts a path to an absolute path, considering the current working directory.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

toRealPath

@Path.toRealPath(string $path): string

Converts a path to the canonicalized absolute path of an existing file.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

toURI

@Path.toURI(string $path): string

Converts a path to a file URI.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
string

REST

object @REST() {}

Static RESTful prototypes.

.Client

REST.Client

object @REST.Client(@Base) {
	construct(string $url, ?function $callback_request, ?function $callback_response, int $timeout, bool $validate) {}
	bind(string $route, string $method, object $headers): function {}
	call(string $route, string $method, object $headers, ...$arguments): mixed {}
	setLocation(string $url): $this {}
	setTimeout(int $timeout): $this {}
	setValidate(bool $validate): $this {}
}

RESTful client prototype.

Prototype

Base

Methods

construct

new @REST.Client(string $url, ?function $callback_request, ?function $callback_response, int $timeout, bool $validate)
Parameters
# Name Type Value Default
1 url string ""
2 callback_request ?function pass through
3 callback_response ?function universal handler
4 timeout int 30
5 validate bool true

bind

$this.bind(string $route, string $method, object $headers): function
Parameters
# Name Type Value Default
1 route string ""
2 method string "GET"
3 headers object [name: value, ...] []
Return Values
Type Value Description
function

call

$this.call(string $route, string $method, object $headers, ...$arguments): mixed
Parameters
# Name Type Value Default
1 route string ""
2 method string "GET"
3 headers object [name: value, ...] []
... arguments variadic ...
Return Values
Type Value Description
mixed

setLocation

$this.setLocation(string $url): $this
Parameters
# Name Type Value Default
1 url string ""
Return Values
Type Value Description
$this

setTimeout

$this.setTimeout(int $timeout): $this
Parameters
# Name Type Value Default
1 timeout int 30
Return Values
Type Value Description
$this

setValidate

$this.setValidate(bool $validate): $this
Parameters
# Name Type Value Default
1 validate bool true
Return Values
Type Value Description
$this

REST.Server

object @REST.Server(@Base) {
	construct() {}
	bind(function $callback, string $route, string $method): $this {}
	bindMethods(...$routes): $this {}
	handle(): mixed {}
}

RESTful server prototype.

Prototype

Base

Methods

construct

new @REST.Server()

bind

$this.bind(function $callback, string $route, string $method): $this
Parameters
# Name Type Value Default
1 callback function null
2 route string ""
3 method string "GET"
Return Values
Type Value Description
$this

bindMethods

$this.bindMethods(...$routes): $this
Parameters
# Name Type Value Default
... routes variadic ...
Return Values
Type Value Description
$this

handle

$this.handle(): mixed
Return Values
Type Value Description
mixed

Regex

object @Regex() {
	count(string $string, string $pattern, int $offset): int {}
	escape(string $string, string $delimiter): string {}
	isValidPattern(string $pattern): bool {}
	match(string $string, string $pattern, int $offset): object {}
	matchAll(string $string, string $pattern, int $offset): object {}
	replace(string $string, string $pattern, string $replacement, int $limit): string {}
	replaceMultiple(string $string, object $replacements): string {}
	split(string $string, string $pattern, int $limit): object {}
	splitNonEmpty(string $string, string $pattern, int $limit): object {}
	substitute(string $string, string $pattern, function $callback, ?object $bind, int $limit): string {}
	test(string $string, string $pattern, int $offset): bool {}
}

Static regular expression functions.

Functions

count

@Regex.count(string $string, string $pattern, int $offset): int

Counts the total number of matches of a global regular expression search of a string against a specific pattern.

Parameters
# Name Type Value Default
1 string string ""
2 pattern string ""
3 offset int 0
Return Values
Type Value Description
int

escape

@Regex.escape(string $string, string $delimiter): string

Escapes all regular expression meta characters in a string with backslashes.

Parameters
# Name Type Value Default
1 string string ""
2 delimiter string "/"
Return Values
Type Value Description
string

isValidPattern

@Regex.isValidPattern(string $pattern): bool

Determines whether a regular expression pattern is valid.

Parameters
# Name Type Value Default
1 pattern string ""
Return Values
Type Value Description
bool

match

@Regex.match(string $string, string $pattern, int $offset): object

Returns the first match of a regular expression search of a string against a specific pattern.

Parameters
# Name Type Value Default
1 string string ""
2 pattern string ""
3 offset int 0
Return Values
Type Value Description
object [pattern-match, subpattern-match, ...]
null if the pattern is not found

matchAll

@Regex.matchAll(string $string, string $pattern, int $offset): object

Returns all matches of a global regular expression search of a string against a specific pattern.

Parameters
# Name Type Value Default
1 string string ""
2 pattern string ""
3 offset int 0
Return Values
Type Value Description
object [[pattern-match, subpattern-match, ...], ...]
null if the pattern is not found

replace

@Regex.replace(string $string, string $pattern, string $replacement, int $limit): string

Replaces all matches of a global regular expression search of a string against a specific pattern with a specific replacement.

Parameters
# Name Type Value Default
1 string string ""
2 pattern string ""
3 replacement string ""
4 limit int 0
Return Values
Type Value Description
string

replaceMultiple

@Regex.replaceMultiple(string $string, object $replacements): string
Parameters
# Name Type Value Default
1 string string ""
2 replacements object [pattern: replacement, ...] []
Return Values
Type Value Description
string

split

@Regex.split(string $string, string $pattern, int $limit): object

Splits a string into isolated substrings on boundaries formed by a specific pattern, whereas empty substrings are retained.

Parameters
# Name Type Value Default
1 string string ""
2 pattern string ""
3 limit int 0
Return Values
Type Value Description
object [substr, ...]

splitNonEmpty

@Regex.splitNonEmpty(string $string, string $pattern, int $limit): object

Splits a string into isolated substrings on boundaries formed by a specific pattern, whereas empty substrings are discarded.

Parameters
# Name Type Value Default
1 string string ""
2 pattern string ""
3 limit int 0
Return Values
Type Value Description
object [substring, ...]

substitute

@Regex.substitute(string $string, string $pattern, function $callback, ?object $bind, int $limit): string

Substitutes all matches of a global regular expression search of a string against a specific pattern with individual replacements provided by a specific callback function.

Parameters
# Name Type Value Default
1 string string ""
2 pattern string ""
3 callback function null
4 bind ?object null
5 limit int 0
Return Values
Type Value Description
string

test

@Regex.test(string $string, string $pattern, int $offset): bool

Tests a regular expression search of a string against a specific pattern for a successful match.

This function is equivalent to the "~=" operator.

Parameters
# Name Type Value Default
1 string string ""
2 pattern string ""
3 offset int 0
Return Values
Type Value Description
bool

SOAP

object @SOAP() {}

Static SOAP prototypes.

.Client

SOAP.Client

object @SOAP.Client(@Base) {
	construct(string $wsdl, string $username, string $password) {}
	bind(string $operation): function {}
	call(string $operation, ...$arguments): mixed {}
	listOperations(): object {}
	listTypes(): object {}
	setCookie(string $name, string $value): $this {}
	setLocation(string $url): $this {}
}

SOAP client prototype.

Prototype

Base

Methods

construct

new @SOAP.Client(string $wsdl, string $username, string $password)
Parameters
# Name Type Value Default
1 wsdl string ""
2 username string ""
3 password string ""

bind

$this.bind(string $operation): function
Parameters
# Name Type Value Default
1 operation string ""
Return Values
Type Value Description
function

call

$this.call(string $operation, ...$arguments): mixed
Parameters
# Name Type Value Default
1 operation string ""
... arguments variadic ...
Return Values
Type Value Description
mixed

listOperations

$this.listOperations(): object
Return Values
Type Value Description
object [signature, ...]

listTypes

$this.listTypes(): object
Return Values
Type Value Description
object [signature, ...]

setCookie

$this.setCookie(string $name, string $value): $this
Parameters
# Name Type Value Default
1 name string ""
2 value string ""
Return Values
Type Value Description
$this

setLocation

$this.setLocation(string $url): $this
Parameters
# Name Type Value Default
1 url string ""
Return Values
Type Value Description
$this

SOAP.Server

object @SOAP.Server(@Base) {
	construct(string $wsdl) {}
	bind(function $callback, string $operation): $this {}
	bindMethods(...$operations): $this {}
	handle() {}
}

SOAP server prototype.

Prototype

Base

Methods

construct

new @SOAP.Server(string $wsdl)
Parameters
# Name Type Value Default
1 wsdl string ""

bind

$this.bind(function $callback, string $operation): $this
Parameters
# Name Type Value Default
1 callback function null
2 operation string ""
Return Values
Type Value Description
$this

bindMethods

$this.bindMethods(...$operations): $this
Parameters
# Name Type Value Default
... operations variadic ...
Return Values
Type Value Description
$this

SQL

SQL

object @SQL() {
	createSearchCondition(string $query, ...$fields): string {}
	prepare(string $query, ...$arguments): string {}
	quoteIdentifier(...$identifiers): string {}
	quoteLiteral(...$literals): string {}
}

Static SQL related prototypes and functions.

Functions

createSearchCondition

@SQL.createSearchCondition(string $query, ...$fields): string
Parameters
# Name Type Value Default
1 query string ""
... fields variadic ...
Return Values
Type Value Description
string

prepare

@SQL.prepare(string $query, ...$arguments): string
Parameters
# Name Type Value Default
1 query string ""
... arguments variadic ...
Return Values
Type Value Description
string

quoteIdentifier

@SQL.quoteIdentifier(...$identifiers): string
Parameters
# Name Type Value Default
... identifiers variadic ...
Return Values
Type Value Description
string

quoteLiteral

@SQL.quoteLiteral(...$literals): string
Parameters
# Name Type Value Default
... literals variadic ...
Return Values
Type Value Description
string

.Connection

SQL.Connection

object @SQL.Connection(@Base) {
	begin(): $this {}
	close() {}
	commit(): $this {}
	countAffectedRows(): int {}
	countRowsInTable(string $table): int {}
	delete(string $table, object $conditions): int {}
	exists(string $table, object $conditions): bool {}
	exit() {}
	fetchAll(string $query, bool $indexed): object {}
	fetchAllOfField(string $query, int $index): object {}
	fetchOne(string $query, bool $indexed): object {}
	getCharset(): string {}
	getDatabaseName(): string {}
	getDatabaseSize(): int {}
	getLastInsertID(): int {}
	getVersion(): string {}
	insert(string $table, object $data): int {}
	listFieldsInTable(string $table): object {}
	listTables(): object {}
	query(string $query): object {}
	reconnect(): $this {}
	releaseSavepoint(string $name): $this {}
	rollback(): $this {}
	rollbackToSavepoint(string $name): $this {}
	savepoint(string $name): $this {}
	selectAll(string $table, object $fields, object $conditions, object $orderby, int $limit, int $offset, bool $indexed): object {}
	selectAllOfField(string $table, string $field, object $conditions, object $orderby, int $limit, int $offset): object {}
	selectOne(string $table, object $fields, object $conditions, object $orderby, bool $indexed): object {}
	selectSavepoint(string $name): object {}
	selectTransaction(): object {}
	setCharset(string $charset): $this {}
	update(string $table, object $data, object $conditions): int {}
	updateOrInsert(string $table, object $data, object $conditions): int {}
}

Abstract SQL connection prototype.

Prototype

Base

Methods

begin

$this.begin(): $this
Return Values
Type Value Description
$this

close

$this.close()

Closes this connection and frees its associated resources.

commit

$this.commit(): $this
Return Values
Type Value Description
$this

countAffectedRows

$this.countAffectedRows(): int
Return Values
Type Value Description
int

countRowsInTable

$this.countRowsInTable(string $table): int
Parameters
# Name Type Value Default
1 table string ""
Return Values
Type Value Description
int

delete

$this.delete(string $table, object $conditions): int
Parameters
# Name Type Value Default
1 table string ""
2 conditions object [field: value, ...] []
Return Values
Type Value Description
int

exists

$this.exists(string $table, object $conditions): bool
Parameters
# Name Type Value Default
1 table string ""
2 conditions object [field: value, ...] []
Return Values
Type Value Description
bool

exit

$this.exit()

Closes this connection and frees its associated resources for the purpose of contextualization.

fetchAll

$this.fetchAll(string $query, bool $indexed): object
Parameters
# Name Type Value Default
1 query string ""
2 indexed bool false
Return Values
Type Value Description
object [row, ...]

fetchAllOfField

$this.fetchAllOfField(string $query, int $index): object
Parameters
# Name Type Value Default
1 query string ""
2 index int 0
Return Values
Type Value Description
object [value, ...]

fetchOne

$this.fetchOne(string $query, bool $indexed): object
Parameters
# Name Type Value Default
1 query string ""
2 indexed bool false
Return Values
Type Value Description
object [field: value, ...]
null if the result set is empty

getCharset

$this.getCharset(): string
Return Values
Type Value Description
string

getDatabaseName

$this.getDatabaseName(): string
Return Values
Type Value Description
string

getDatabaseSize

$this.getDatabaseSize(): int
Return Values
Type Value Description
int

getLastInsertID

$this.getLastInsertID(): int
Return Values
Type Value Description
int

getVersion

$this.getVersion(): string
Return Values
Type Value Description
string

insert

$this.insert(string $table, object $data): int
Parameters
# Name Type Value Default
1 table string ""
2 data object [field: value, ...] []
Return Values
Type Value Description
int

listFieldsInTable

$this.listFieldsInTable(string $table): object
Parameters
# Name Type Value Default
1 table string ""
Return Values
Type Value Description
object [field, ...]

listTables

$this.listTables(): object
Return Values
Type Value Description
object [table, ...]

query

$this.query(string $query): object
Parameters
# Name Type Value Default
1 query string ""
Return Values
Type Value Description
object SQL.ResultSet
null if the query is a non-SELECT

reconnect

$this.reconnect(): $this
Return Values
Type Value Description
$this

releaseSavepoint

$this.releaseSavepoint(string $name): $this
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
$this

rollback

$this.rollback(): $this
Return Values
Type Value Description
$this

rollbackToSavepoint

$this.rollbackToSavepoint(string $name): $this
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
$this

savepoint

$this.savepoint(string $name): $this
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
$this

selectAll

$this.selectAll(string $table, object $fields, object $conditions, object $orderby, int $limit, int $offset, bool $indexed): object
Parameters
# Name Type Value Default
1 table string ""
2 fields object [field, ...] []
3 conditions object [field: value, ...] []
4 orderby object [field: descending, ...] []
5 limit int 0
6 offset int 0
7 indexed bool false
Return Values
Type Value Description
object [row, ...]

selectAllOfField

$this.selectAllOfField(string $table, string $field, object $conditions, object $orderby, int $limit, int $offset): object
Parameters
# Name Type Value Default
1 table string ""
2 field string ""
3 conditions object [field: value, ...] []
4 orderby object [field: descending, ...] []
5 limit int 0
6 offset int 0
Return Values
Type Value Description
object [value, ...]

selectOne

$this.selectOne(string $table, object $fields, object $conditions, object $orderby, bool $indexed): object
Parameters
# Name Type Value Default
1 table string ""
2 fields object [field, ...] []
3 conditions object [field: value, ...] []
4 orderby object [field: descending, ...] []
5 indexed bool false
Return Values
Type Value Description
object [field: value, ...]
null if the result set is empty

selectSavepoint

$this.selectSavepoint(string $name): object
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
@SQL.SavepointContext

selectTransaction

$this.selectTransaction(): object
Return Values
Type Value Description
@SQL.TransactionContext

setCharset

$this.setCharset(string $charset): $this
Parameters
# Name Type Value Default
1 charset string ""
Return Values
Type Value Description
$this

update

$this.update(string $table, object $data, object $conditions): int
Parameters
# Name Type Value Default
1 table string ""
2 data object [field: value, ...] []
3 conditions object [field: value, ...] []
Return Values
Type Value Description
int

updateOrInsert

$this.updateOrInsert(string $table, object $data, object $conditions): int
Parameters
# Name Type Value Default
1 table string ""
2 data object [field: value, ...] []
3 conditions object [field: value, ...] []
Return Values
Type Value Description
int

SQL.My SQL

object @SQL.MySQL(@SQL.Connection) {
	construct(string $server, string $dbname, string $username, string $password) {}
}

MySQL connection prototype.

Prototype

SQL.Connection

Methods

construct

new @SQL.MySQL(string $server, string $dbname, string $username, string $password)
Parameters
# Name Type Value Default
1 server string ""
2 dbname string ""
3 username string ""
4 password string "" SQL.PostgreSQL

SQL.Postgre SQL

object @SQL.PostgreSQL(@SQL.Connection) {
	construct(string $server, string $dbname, string $username, string $password) {}
	disableTracing(): $this {}
	enableTracing(string $path): $this {}
	getHost(): string {}
	getPort(): int {}
	insertReturning(string $table, object $data, object $fields, bool $indexed): object {}
	isBusy(): bool {}
	isConnected(): bool {}
}

PostgreSQL connection prototype.

Prototype

SQL.Connection

Methods

construct

new @SQL.PostgreSQL(string $server, string $dbname, string $username, string $password)
Parameters
# Name Type Value Default
1 server string ""
2 dbname string ""
3 username string ""
4 password string ""

disableTracing

$this.disableTracing(): $this

This function is complementary to "enableTracing".

Return Values
Type Value Description
$this

enableTracing

$this.enableTracing(string $path): $this

This function is complementary to "disableTracing".

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
$this

getHost

$this.getHost(): string
Return Values
Type Value Description
string

getPort

$this.getPort(): int
Return Values
Type Value Description
int

insertReturning

$this.insertReturning(string $table, object $data, object $fields, bool $indexed): object
Parameters
# Name Type Value Default
1 table string ""
2 data object [field: value, ...] []
3 fields object [field, ...] []
4 indexed bool false
Return Values
Type Value Description
object [field: value, ...]
null if no row was inserted

isBusy

$this.isBusy(): bool
Return Values
Type Value Description
bool

isConnected

$this.isConnected(): bool
Return Values
Type Value Description
bool

SQL.Result Set

object @SQL.ResultSet(@Base) {
	close() {}
	countFields(): int {}
	countRows(): int {}
	exit() {}
	fetch(bool $indexed): object {}
	fetchAll(bool $indexed): object {}
	fetchAllOfField(int $index): object {}
	fetchTail(bool $indexed): object {}
	fetchTailOfField(int $index): object {}
	getFieldName(int $index): string {}
	getFieldTable(int $index): string {}
	getFieldType(int $index): int {}
	getPosition(): int {}
	hasMore(): bool {}
	listFieldNames(): object {}
	next(): object {}
	reset(): $this {}
	seek(int $position): $this {}
	skip(int $offset): $this {}
}

Abstract SQL result set prototype.

Prototype

Base

Methods

close

$this.close()

Closes this result set and frees its associated resources.

countFields

$this.countFields(): int
Return Values
Type Value Description
int

countRows

$this.countRows(): int
Return Values
Type Value Description
int

exit

$this.exit()

Closes this result set and frees its associated resources for the purpose of contextualization.

fetch

$this.fetch(bool $indexed): object
Parameters
# Name Type Value Default
1 indexed bool false
Return Values
Type Value Description
object
null if there are no more rows

fetchAll

$this.fetchAll(bool $indexed): object
Parameters
# Name Type Value Default
1 indexed bool false
Return Values
Type Value Description
object [row, ...]

fetchAllOfField

$this.fetchAllOfField(int $index): object
Parameters
# Name Type Value Default
1 index int 0
Return Values
Type Value Description
object [value, ...]

fetchTail

$this.fetchTail(bool $indexed): object
Parameters
# Name Type Value Default
1 indexed bool false
Return Values
Type Value Description
object [row, ...]

fetchTailOfField

$this.fetchTailOfField(int $index): object
Parameters
# Name Type Value Default
1 index int 0
Return Values
Type Value Description
object [value, ...]

getFieldName

$this.getFieldName(int $index): string
Parameters
# Name Type Value Default
1 index int 0
Return Values
Type Value Description
string

getFieldTable

$this.getFieldTable(int $index): string
Parameters
# Name Type Value Default
1 index int 0
Return Values
Type Value Description
string

getFieldType

$this.getFieldType(int $index): int
Parameters
# Name Type Value Default
1 index int 0
Return Values
Type Value Description
int
string

getPosition

$this.getPosition(): int
Return Values
Type Value Description
int

hasMore

$this.hasMore(): bool
Return Values
Type Value Description
bool

listFieldNames

$this.listFieldNames(): object
Return Values
Type Value Description
object [field, ...]

next

$this.next(): object
Return Values
Type Value Description
object [position: row]
null if there are no more rows

reset

$this.reset(): $this

This function alters the position within the result set.

Return Values
Type Value Description
$this

seek

$this.seek(int $position): $this

If the position is negative, it seeks to that many rows from the end of the result set.

This function alters the position within the result set.

Parameters
# Name Type Value Default
1 position int 0
Return Values
Type Value Description
$this

skip

$this.skip(int $offset): $this

This function alters the position within the result set.

Parameters
# Name Type Value Default
1 offset int 1
Return Values
Type Value Description
$this

SQL.SQLite3

object @SQL.SQLite3(@SQL.Connection) {
	construct(string $path, bool $readonly, string $key) {}
	createAggregate(string $name, function $callback_step, function $callback_final): $this {}
	createCollation(string $name, function $callback): $this {}
	createFunction(string $name, function $callback): $this {}
}

SQLite3 connection prototype.

Prototype

SQL.Connection

Methods

construct

new @SQL.SQLite3(string $path, bool $readonly, string $key)
Parameters
# Name Type Value Default
1 path string ""
2 readonly bool false
3 key string ""

createAggregate

$this.createAggregate(string $name, function $callback_step, function $callback_final): $this
Parameters
# Name Type Value Default
1 name string ""
2 callback_step function null
3 callback_final function null
Return Values
Type Value Description
$this

createCollation

$this.createCollation(string $name, function $callback): $this
Parameters
# Name Type Value Default
1 name string ""
2 callback function null
Return Values
Type Value Description
$this

createFunction

$this.createFunction(string $name, function $callback): $this
Parameters
# Name Type Value Default
1 name string ""
2 callback function null
Return Values
Type Value Description
$this

SQL.Savepoint Context

object @SQL.SavepointContext(@Base) {
	enter() {}
	exit(mixed $exception) {}
}

Abstract SQL savepoint context prototype.

Prototype

Base

Methods

enter

$this.enter()

exit

$this.exit(mixed $exception)
Parameters
# Name Type Value Default
1 exception mixed null SQL.TransactionContext

SQL.Transaction Context

object @SQL.TransactionContext(@Base) {
	enter() {}
	exit(mixed $exception) {}
}

Abstract SQL transaction context prototype.

Prototype

Base

Methods

enter

$this.enter()

exit

$this.exit(mixed $exception)
Parameters
# Name Type Value Default
1 exception mixed null Statistic

Statistic

object @Statistic() {
	arithmeticMean(object $values, ?object $weights): number {}
	average(object $values): number {}
	averageDeviation(object $values, ?number $center): number {}
	centralMoment(object $values, number $order, ?number $center): number {}
	count(object $values): int {}
	exponentialMovingAverage(object $values, ?number $exponent): number {}
	geometricMean(object $values, ?object $weights): float {}
	harmonicMean(object $values, ?object $weights): number {}
	kurtosisPop(object $values): number {}
	kurtosisSamp(object $values): number {}
	linearMovingAverage(object $values): number {}
	maximum(object $values): number {}
	median(object $values): number {}
	medianDeviation(object $values): number {}
	midrange(object $values): number {}
	minimum(object $values): number {}
	mode(object $values): object {}
	product(object $values): number {}
	quadraticMean(object $values): float {}
	range(object $values): number {}
	rawMoment(object $values, number $order): number {}
	skewnessPop(object $values): float {}
	skewnessSamp(object $values): float {}
	standardDeviationPop(object $values): float {}
	standardDeviationSamp(object $values): float {}
	standardScore(object $values): object {}
	sum(object $values): number {}
	variancePop(object $values): number {}
	varianceSamp(object $values): number {}
}

Static statistical functions.

Functions

arithmeticMean

@Statistic.arithmeticMean(object $values, ?object $weights): number

Calculates the arithmetic mean of a list of values.

Weights may specify the contribution of each value to a weighted mean. If weights are specified and a value does not correspond to a weight, zero will be used as the weight of that particular value.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
2 weights ?object unweighted
Return Values
Type Value Description
number
null if there are no values

average

@Statistic.average(object $values): number

Calculates the average of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

averageDeviation

@Statistic.averageDeviation(object $values, ?number $center): number

Calculates the average absolute deviation of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
2 center ?number arithmetic mean of values
Return Values
Type Value Description
number
null if there are no values

centralMoment

@Statistic.centralMoment(object $values, number $order, ?number $center): number

Calculates the central moment of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
2 order number 2
3 center ?number arithmetic mean of values
Return Values
Type Value Description
number
null if there are no values

count

@Statistic.count(object $values): int

Counts the total number of values.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
int

exponentialMovingAverage

@Statistic.exponentialMovingAverage(object $values, ?number $exponent): number

Calculates the exponential moving average of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
2 exponent ?number (default: 2/(N+1)) null
Return Values
Type Value Description
number
null if there are no values

geometricMean

@Statistic.geometricMean(object $values, ?object $weights): float

Calculates the geometric mean of a list of values.

Weights may specify the contribution of each value to a weighted mean. If weights are specified and a value does not correspond to a weight, zero will be used as the weight of that particular value.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
2 weights ?object unweighted
Return Values
Type Value Description
float
null if there are no values

harmonicMean

@Statistic.harmonicMean(object $values, ?object $weights): number

Calculates the harmonic mean of a list of values.

Weights may specify the contribution of each value to a weighted mean. If weights are specified and a value does not correspond to a weight, zero will be used as the weight of that particular value.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
2 weights ?object unweighted
Return Values
Type Value Description
number
null if there are no values

kurtosisPop

@Statistic.kurtosisPop(object $values): number

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

kurtosisSamp

@Statistic.kurtosisSamp(object $values): number

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are less than four values

linearMovingAverage

@Statistic.linearMovingAverage(object $values): number

Calculates the linear weighted moving average of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

maximum

@Statistic.maximum(object $values): number

Measures the maximum of a list of values.

Values are interpreted as numbers for the purpose of measurement.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

median

@Statistic.median(object $values): number

Measures the median of a list of values.

Values are interpreted as numbers for the purpose of measurement.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

medianDeviation

@Statistic.medianDeviation(object $values): number

Calculates the median absolute deviation of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

midrange

@Statistic.midrange(object $values): number

Measures the mid-range of a list of values.

Values are interpreted as numbers for the purpose of measurement.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

minimum

@Statistic.minimum(object $values): number

Measures the minimum of a list of values.

Values are interpreted as numbers for the purpose of measurement.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

mode

@Statistic.mode(object $values): object

Measures the mode of a list of values.

Values are interpreted as numbers for the purpose of measurement.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
object [number, ...]

product

@Statistic.product(object $values): number

Calculates the product of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

quadraticMean

@Statistic.quadraticMean(object $values): float

Calculates the quadratic mean of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
float
null if there are no values

range

@Statistic.range(object $values): number

Measures the range of a list of values.

Values are interpreted as numbers for the purpose of measurement.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

rawMoment

@Statistic.rawMoment(object $values, number $order): number

Calculates the raw moment of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
2 order number 2
Return Values
Type Value Description
number
null if there are no values

skewnessPop

@Statistic.skewnessPop(object $values): float

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
float
null if there are no values

skewnessSamp

@Statistic.skewnessSamp(object $values): float

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
float
null if there are less than three values

standardDeviationPop

@Statistic.standardDeviationPop(object $values): float

Calculates the population standard deviation of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
float
null if there are no values

standardDeviationSamp

@Statistic.standardDeviationSamp(object $values): float

Calculates the sample standard deviation of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
float
null if there are less than two values

standardScore

@Statistic.standardScore(object $values): object

Calculates the standard scores for a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
object [score, ...]

sum

@Statistic.sum(object $values): number

Sums up a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

variancePop

@Statistic.variancePop(object $values): number

Calculates the population variance of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are no values

varianceSamp

@Statistic.varianceSamp(object $values): number

Calculates the sample variance of a list of values.

Values are interpreted as numbers for the purpose of aggregation.

Parameters
# Name Type Value Default
1 values object [value, ...] []
Return Values
Type Value Description
number
null if there are less than two values

String

object @String() {
	byteAt(string $string, int $offset): string {}
	byteCodeAt(string $string, int $offset): int {}
	byteIndexOf(string $string, string $substring): int {}
	capitalize(string $string): string {}
	capitalizeWords(string $string): string {}
	charAt(string $string, int $offset): string {}
	charCodeAt(string $string, int $offset): int {}
	chop(string $string, int $length, string $delimiter): string {}
	chopOnBytes(string $string, int $length, string $delimiter): string {}
	compare(string $string1, string $string2): int {}
	compareNatural(string $string1, string $string2): int {}
	concat(...$strings): string {}
	contains(string $string, string $substring): bool {}
	containsInsensitive(string $string, string $substring): bool {}
	convert(string $string, string $from, string $to): string {}
	countBytes(string $string): int {}
	countChars(string $string): int {}
	countDistinctBytes(string $string): int {}
	countDistinctChars(string $string): int {}
	countSubstring(string $string, string $substring): int {}
	countUsedBytes(string $string): object {}
	countUsedChars(string $string): object {}
	crc32(string $string): int {}
	distanceBetween(string $string1, string $string2): int {}
	endsWith(string $string, string $substring): bool {}
	endsWithInsensitive(string $string, string $substring): bool {}
	equals(string $string1, string $string2): bool {}
	equalsInsensitive(string $string1, string $string2): bool {}
	foldCase(string $string): string {}
	format(string $string, ...$arguments): string {}
	fromByteCodes(object $codes): string {}
	fromCharCodes(object $codes): string {}
	fromHex(string $string): string {}
	fromLatin1(string $string): string {}
	hasByteIndex(string $string, int $index): bool {}
	hasIndex(string $string, int $index): bool {}
	head(string $string): string {}
	headOnBytes(string $string): string {}
	indexOf(string $string, string $substring): int {}
	indexOfInsensitive(string $string, string $substring): int {}
	insert(string $string, string $substring, int $offset): string {}
	insertOnBytes(string $string, string $substring, int $offset): string {}
	isBinaryDigits(string $string): bool {}
	isDecimalDigits(string $string): bool {}
	isEmpty(string $string): bool {}
	isHexDigits(string $string): bool {}
	isMarkedUTF8(string $string): bool {}
	isOctalDigits(string $string): bool {}
	isPrintable(string $string): bool {}
	isSingleByte(string $string): bool {}
	isSingleChar(string $string): bool {}
	isValidASCII(string $string): bool {}
	isValidUTF8(string $string): bool {}
	isWhiteSpace(string $string): bool {}
	lastByteIndexOf(string $string, string $substring): int {}
	lastIndexOf(string $string, string $substring): int {}
	lastIndexOfInsensitive(string $string, string $substring): int {}
	metaphone(string $string): string {}
	normalizeLineBreaks(string $string): string {}
	normalizeWhiteSpace(string $string): string {}
	pad(string $string, int $length, string $padding): string {}
	padOnBytes(string $string, int $length, string $padding): string {}
	partition(string $string, int $length): object {}
	partitionOnBytes(string $string, int $length): object {}
	quote(string $string, string $delimiter): string {}
	repeat(string $string, int $count): string {}
	replace(string $string, string $substring, string $replacement, int $limit): string {}
	replaceMultiple(string $string, object $replacements): string {}
	reverse(string $string): string {}
	reverseOnBytes(string $string): string {}
	slice(string $string, int $offset, ?int $length): string {}
	sliceOnBytes(string $string, int $offset, ?int $length): string {}
	soundex(string $string): string {}
	split(string $string, string $delimiter, int $limit): object {}
	splitNonEmpty(string $string, string $delimiter, int $limit): object {}
	startsWith(string $string, string $substring): bool {}
	startsWithInsensitive(string $string, string $substring): bool {}
	tail(string $string): string {}
	tailOnBytes(string $string): string {}
	toByteCodes(string $string): object {}
	toCharCodes(string $string): object {}
	toHex(string $string): string {}
	toLatin1(string $string): string {}
	toLower(string $string): string {}
	toUpper(string $string): string {}
	trim(string $string): string {}
	trimLeft(string $string): string {}
	trimRight(string $string): string {}
	truncate(string $string, int $offset, int $length, string $marker): string {}
}

Static string related functions.

Functions

byteAt

@String.byteAt(string $string, int $offset): string

Returns the byte at a specific byte-based offset within a string.

If the offset is negative, it positions at that many bytes from the end of the string.

This function is equivalent to the "[...]" operator on strings.

Parameters
# Name Type Value Default
1 string string ""
2 offset int 0
Return Values
Type Value Description
string
null if the offset is out of range

byteCodeAt

@String.byteCodeAt(string $string, int $offset): int

Returns the US-ASCII code of the byte at a specific byte-based offset within a string.

Parameters
# Name Type Value Default
1 string string ""
2 offset int 0
Return Values
Type Value Description
int
null if the offset is out of range

byteIndexOf

@String.byteIndexOf(string $string, string $substring): int

Returns the byte-based index of the first occurrence of a specific substring within a string.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
int
null if the substring is not found

capitalize

@String.capitalize(string $string): string

Capitalizes the first character within a string.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

capitalizeWords

@String.capitalizeWords(string $string): string

Capitalizes every word within a string.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

charAt

@String.charAt(string $string, int $offset): string

Returns the character at a specific character-based offset within a string.

If the offset is negative, it positions at that many characters from the end of the string.

Parameters
# Name Type Value Default
1 string string ""
2 offset int 0
Return Values
Type Value Description
string
null if the offset is out of range

charCodeAt

@String.charCodeAt(string $string, int $offset): int

Returns the UTF-8 code of the character at a specific character-based offset within a string.

Parameters
# Name Type Value Default
1 string string ""
2 offset int 0
Return Values
Type Value Description
int
null if the offset is out of range

chop

@String.chop(string $string, int $length, string $delimiter): string

Chops a string into substrings of a specific character-based length, rejoined with a specific delimiter.

Parameters
# Name Type Value Default
1 string string ""
2 length int 76
3 delimiter string "\r\n"
Return Values
Type Value Description
string

chopOnBytes

@String.chopOnBytes(string $string, int $length, string $delimiter): string

Chops a string into substrings of a specific byte-based length, rejoined with a specific delimiter.

Parameters
# Name Type Value Default
1 string string ""
2 length int 76
3 delimiter string "\r\n"
Return Values
Type Value Description
string

compare

@String.compare(string $string1, string $string2): int

Compares two strings in a lexicographic manner.

This function is equivalent to the "<=>" operator on strings.

Parameters
# Name Type Value Default
1 string1 string ""
2 string2 string ""
Return Values
Type Value Description
int +1 if the first string is greater than the second string
int -1 if the first string is less than the second string
int 0 if both strings are equal

compareNatural

@String.compareNatural(string $string1, string $string2): int

Compares two strings in a natural and case-insensitive manner (US-ASCII only).

Parameters
# Name Type Value Default
1 string1 string ""
2 string2 string ""
Return Values
Type Value Description
int +1 if the first string is greater than the second string
int -1 if the first string is less than the second string
int 0 if both strings are equal

concat

@String.concat(...$strings): string

Concatenates specific strings and returns the combined end-to-end string.

This function is equivalent to the "." operator.

Parameters
# Name Type Value Default
... strings variadic ...
Return Values
Type Value Description
string

contains

@String.contains(string $string, string $substring): bool

Determines whether a string contains a specific substring.

Strings always contain empty substrings.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
bool

containsInsensitive

@String.containsInsensitive(string $string, string $substring): bool

Determines whether a string contains a specific substring in a case-insensitive manner (UTF-8).

Strings always contain empty substrings.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
bool

convert

@String.convert(string $string, string $from, string $to): string

Converts the character encoding of a string from one character set into another.

Parameters
# Name Type Value Default
1 string string ""
2 from string "UTF-8"
3 to string "UTF-8"
Return Values
Type Value Description
string

countBytes

@String.countBytes(string $string): int

Counts the total number of bytes within a string.

This function is equivalent to the "count" operator on strings.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int

countChars

@String.countChars(string $string): int

Counts the total number of characters within a string.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int

countDistinctBytes

@String.countDistinctBytes(string $string): int

Counts the total number of distinct bytes within a string.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int

countDistinctChars

@String.countDistinctChars(string $string): int

Counts the total number of distinct characters within a string.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int

countSubstring

@String.countSubstring(string $string, string $substring): int

Counts the total number of occurrences of a specific substring within a string.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
int

countUsedBytes

@String.countUsedBytes(string $string): object

Counts the total number of occurrences for each byte within a string.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
object [unique-byte: count, ...]

countUsedChars

@String.countUsedChars(string $string): object

Counts the total number of occurrences for each character within a string.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
object [unique-character: count, ...]

crc32

@String.crc32(string $string): int

Generates the 32-bit cyclic redundancy checksum polynomial of a string as a signed integer.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
int

distanceBetween

@String.distanceBetween(string $string1, string $string2): int

Measures the Levenshtein distance between two strings.

Parameters
# Name Type Value Default
1 string1 string ""
2 string2 string ""
Return Values
Type Value Description
int
null if any string is longer than 255 bytes

endsWith

@String.endsWith(string $string, string $substring): bool

Determines whether a string ends with a specific substring.

Strings always end with empty substrings.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
bool

endsWithInsensitive

@String.endsWithInsensitive(string $string, string $substring): bool

Determines whether a string ends with a specific substring in a case-insensitive manner (UTF-8).

Strings always end with empty substrings.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
bool

equals

@String.equals(string $string1, string $string2): bool

Determines whether two strings are equal.

This function is equivalent to the "===" operator on strings.

Parameters
# Name Type Value Default
1 string1 string ""
2 string2 string ""
Return Values
Type Value Description
bool

equalsInsensitive

@String.equalsInsensitive(string $string1, string $string2): bool

Determines whether two strings are equal in a case-insensitive manner (UTF-8).

This function is equivalent to the "==*" operator on strings.

Parameters
# Name Type Value Default
1 string1 string ""
2 string2 string ""
Return Values
Type Value Description
bool

foldCase

@String.foldCase(string $string): string

Converts a string according to length-preserving case-folding rules (UTF-8).

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

format

@String.format(string $string, ...$arguments): string

Returns a formatted string with "printf"-compatible format specifiers ("%...") substituted with variadic arguments.

Parameters
# Name Type Value Default
1 string string ""
... arguments variadic ...
Return Values
Type Value Description
string

fromByteCodes

@String.fromByteCodes(object $codes): string

Returns the string corresponding to an US-ASCII code sequence.

This function is complementary to "toByteCodes".

Parameters
# Name Type Value Default
1 codes object [code, ...] []
Return Values
Type Value Description
string

fromCharCodes

@String.fromCharCodes(object $codes): string

Returns the string corresponding to an UTF-8 code sequence.

This function is complementary to "toCharCodes".

Parameters
# Name Type Value Default
1 codes object [code, ...] []
Return Values
Type Value Description
string

fromHex

@String.fromHex(string $string): string

This function is complementary to "toHex".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

fromLatin1

@String.fromLatin1(string $string): string

Converts the character encoding of a string from single-byte ISO-8859-1 into multi-byte UTF-8.

This function is complementary to "toLatin1".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

hasByteIndex

@String.hasByteIndex(string $string, int $index): bool

Determines whether a string has a specific byte-based index.

Parameters
# Name Type Value Default
1 string string ""
2 index int 0
Return Values
Type Value Description
bool

hasIndex

@String.hasIndex(string $string, int $index): bool

Determines whether a string has a specific character-based index.

Parameters
# Name Type Value Default
1 string string ""
2 index int 0
Return Values
Type Value Description
bool

head

@String.head(string $string): string

Returns the character-based head of a string, meaning only the first character.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

headOnBytes

@String.headOnBytes(string $string): string

Returns the byte-based head of a string, meaning only the first byte.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

indexOf

@String.indexOf(string $string, string $substring): int

Returns the character-based index of the first occurrence of a specific substring within a string.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
int
null if the substring is not found

indexOfInsensitive

@String.indexOfInsensitive(string $string, string $substring): int

Returns the character-based index of the first occurrence of a specific substring within a string, searching in a case-insensitive manner (UTF-8).

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
int
null if the substring is not found

insert

@String.insert(string $string, string $substring, int $offset): string

Inserts a specific substring into a string at a specific character-based offset.

If the offset is negative, it inserts at that many characters from the end of the string.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
3 offset int 0
Return Values
Type Value Description
string

insertOnBytes

@String.insertOnBytes(string $string, string $substring, int $offset): string

Inserts a specific substring into a string at a specific byte-based offset.

If the offset is negative, it inserts at that many bytes from the end of the string.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
3 offset int 0
Return Values
Type Value Description
string

isBinaryDigits

@String.isBinaryDigits(string $string): bool

Determines whether a string consists only of characters representing binary digits.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isDecimalDigits

@String.isDecimalDigits(string $string): bool

Determines whether a string consists only of characters representing decimal digits.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isEmpty

@String.isEmpty(string $string): bool

Determines whether a string is empty, meaning it does not contain any bytes or characters.

This function is equivalent to the "empty" operator on strings.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isHexDigits

@String.isHexDigits(string $string): bool

Determines whether a string consists only of characters representing hexadecimal digits.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isMarkedUTF8

@String.isMarkedUTF8(string $string): bool

Determines whether a string has an UTF-8 byte order mark (BOM).

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isOctalDigits

@String.isOctalDigits(string $string): bool

Determines whether a string consists only of characters representing octal digits.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isPrintable

@String.isPrintable(string $string): bool

Determines whether a string represents a valid sequence of printable US-ASCII characters.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isSingleByte

@String.isSingleByte(string $string): bool

Determines whether a string consists only of a single byte.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isSingleChar

@String.isSingleChar(string $string): bool

Determines whether a string consists only of a single character.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isValidASCII

@String.isValidASCII(string $string): bool

Determines whether a string represents a valid sequence of US-ASCII characters.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isValidUTF8

@String.isValidUTF8(string $string): bool

Determines whether a string represents a valid sequence of UTF-8 characters.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

isWhiteSpace

@String.isWhiteSpace(string $string): bool

Determines whether a string consists only of US-ASCII white space characters.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
bool

lastByteIndexOf

@String.lastByteIndexOf(string $string, string $substring): int

Returns the byte-based index of the last occurrence of a specific substring within a string.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
int
null if the substring is not found

lastIndexOf

@String.lastIndexOf(string $string, string $substring): int

Returns the character-based index of the last occurrence of a specific substring within a string.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
int
null if the substring is not found

lastIndexOfInsensitive

@String.lastIndexOfInsensitive(string $string, string $substring): int

Returns the character-based index of the last occurrence of a specific substring within a string, searching in a case-insensitive manner (UTF-8).

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
int
null if the substring is not found

metaphone

@String.metaphone(string $string): string

Generates the metaphone key of a string.

Metaphone keys have the property that words pronounced similarly produce the same metaphone key.

This function is more accurate than "soundex" as it knows the basic rules of English pronunciation.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

normalizeLineBreaks

@String.normalizeLineBreaks(string $string): string

Normalizes line breaks by replacing all end-of-line markers (line feed and/or carriage return) with single line feeds.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

normalizeWhiteSpace

@String.normalizeWhiteSpace(string $string): string

Normalizes white space by replacing all consecutive sequences of US-ASCII white space characters with single blank spaces.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

pad

@String.pad(string $string, int $length, string $padding): string

Pads a string to a specific character-based length by repeatedly filling it with a specific padding string.

If the length is positive, the string is padded right-sidedly at its end, if it is negative, the string is padded left-sidedly at its beginning.

Parameters
# Name Type Value Default
1 string string ""
2 length int 0
3 padding string " "
Return Values
Type Value Description
string

padOnBytes

@String.padOnBytes(string $string, int $length, string $padding): string

Pads a string to a specific byte-based length by repeatedly filling it with a specific padding string.

If the length is positive, the string is padded right-sidedly at its end, if it is negative, the string is padded left-sidedly at its beginning.

Parameters
# Name Type Value Default
1 string string ""
2 length int 0
3 padding string " "
Return Values
Type Value Description
string

partition

@String.partition(string $string, int $length): object

Partitions a string into isolated substrings of a specific character-based length.

Parameters
# Name Type Value Default
1 string string ""
2 length int 1
Return Values
Type Value Description
object [substring, ...]

partitionOnBytes

@String.partitionOnBytes(string $string, int $length): object

Partitions a string into isolated substrings of a specific byte-based length.

Parameters
# Name Type Value Default
1 string string ""
2 length int 1
Return Values
Type Value Description
object [substring, ...]

quote

@String.quote(string $string, string $delimiter): string

Quotes a string by wrapping it with a specific delimiter.

Parameters
# Name Type Value Default
1 string string ""
2 delimiter string "'"
Return Values
Type Value Description
string

repeat

@String.repeat(string $string, int $count): string

Repeatedly concatenates a specific string to itself and returns the aligned end-to-end string.

Parameters
# Name Type Value Default
1 string string ""
2 count int 1
Return Values
Type Value Description
string

replace

@String.replace(string $string, string $substring, string $replacement, int $limit): string

Replaces all occurrences of a specific substring within a string with a specific replacement.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
3 replacement string ""
4 limit int 0
Return Values
Type Value Description
string

replaceMultiple

@String.replaceMultiple(string $string, object $replacements): string
Parameters
# Name Type Value Default
1 string string ""
2 replacements object [substring: replacement, ...] []
Return Values
Type Value Description
string

reverse

@String.reverse(string $string): string

Reverses the sequence of characters within a string.

This function is its own inverse.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

reverseOnBytes

@String.reverseOnBytes(string $string): string

Reverses the sequence of bytes within a string.

This function is its own inverse.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

slice

@String.slice(string $string, int $offset, ?int $length): string

Slices a string by retrieving a specific character-based portion.

If the offset is negative, it starts that many characters from the end of the string. If the length is null, every character from the offset until the end of the string is returned, if it is negative, it stops that many characters from the end of the string.

Parameters
# Name Type Value Default
1 string string ""
2 offset int 0
3 length ?int maximum length
Return Values
Type Value Description
string

sliceOnBytes

@String.sliceOnBytes(string $string, int $offset, ?int $length): string

Slices a string by retrieving a specific byte-based portion.

If the offset is negative, it starts that many bytes from the end of the string. If the length is null, every byte from the offset until the end of the string is returned, if it is negative, it stops that many bytes from the end of the string.

This function is equivalent to the "[..., ...]" operator on strings.

Parameters
# Name Type Value Default
1 string string ""
2 offset int 0
3 length ?int maximum length
Return Values
Type Value Description
string

soundex

@String.soundex(string $string): string

Generates the 4-character soundex key of a string.

Soundex keys have the property that words pronounced similarly produce the same soundex key.

This function is less accurate than "metaphone" as the latter knows the basic rules of English pronunciation.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

split

@String.split(string $string, string $delimiter, int $limit): object

Splits a string into isolated substrings on boundaries formed by a specific delimiter, whereas empty substrings are retained.

Parameters
# Name Type Value Default
1 string string ""
2 delimiter string " "
3 limit int 0
Return Values
Type Value Description
object [substring, ...]

splitNonEmpty

@String.splitNonEmpty(string $string, string $delimiter, int $limit): object

Splits a string into isolated substrings on boundaries formed by a specific delimiter, whereas empty substrings are discarded.

Parameters
# Name Type Value Default
1 string string ""
2 delimiter string " "
3 limit int 0
Return Values
Type Value Description
object [substring, ...]

startsWith

@String.startsWith(string $string, string $substring): bool

Determines whether a string starts with a specific substring.

Strings always start with empty substrings.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
bool

startsWithInsensitive

@String.startsWithInsensitive(string $string, string $substring): bool

Determines whether a string starts with a specific substring in a case-insensitive manner (UTF-8).

Strings always start with empty substrings.

Parameters
# Name Type Value Default
1 string string ""
2 substring string ""
Return Values
Type Value Description
bool

tail

@String.tail(string $string): string

Returns the character-based tail of a string, meaning all characters except the first.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

tailOnBytes

@String.tailOnBytes(string $string): string

Returns the byte-based tail of a string, meaning all bytes except the first.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

toByteCodes

@String.toByteCodes(string $string): object

Returns the US-ASCII code sequence of all bytes within a string.

This function is complementary to "fromByteCodes".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
object [code, ...]

toCharCodes

@String.toCharCodes(string $string): object

Returns the UTF-8 code sequence of all characters within a string.

This function is complementary to "fromCharCodes".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
object [code, ...]

toHex

@String.toHex(string $string): string

This function is complementary to "fromHex".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

toLatin1

@String.toLatin1(string $string): string

Converts the character encoding of a string from multi-byte UTF-8 to single-byte ISO-8859-1.

This function is complementary to "fromLatin1".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

toLower

@String.toLower(string $string): string

Converts a string to lower case (UTF-8).

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

toUpper

@String.toUpper(string $string): string

Converts a string to upper case (UTF-8).

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

trim

@String.trim(string $string): string

Trims a string by stripping all US-ASCII white space characters from its beginning and end.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

trimLeft

@String.trimLeft(string $string): string

Trims a string left-sidedly by stripping all US-ASCII white space characters from its beginning.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

trimRight

@String.trimRight(string $string): string

Trims a string right-sidedly by stripping all US-ASCII white space characters from its end.

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

truncate

@String.truncate(string $string, int $offset, int $length, string $marker): string

Truncates a string to a specific character-based length.

Parameters
# Name Type Value Default
1 string string ""
2 offset int 0
3 length int 255
4 marker string ""
Return Values
Type Value Description
string

System

object @System() {
	OS;
	PHPVERSION;
	SAPI;
	getCurrentMemoryUsage(): int {}
	getHost(): string {}
	getPeakMemoryUsage(): int {}
	getProcessID(): int {}
	listCommandLineArguments(): object {}
	sleep(number $duration) {}
}

Static system related constants and functions.

Consts

Name Type Description
OS string Operating system identifier
PHPVERSION string PHP version number
SAPI string Server API identifier

Functions

getCurrentMemoryUsage

@System.getCurrentMemoryUsage(): int

Gets the current memory usage of the underlying runtime environment in number of bytes.

Return Values
Type Value Description
int

getHost

@System.getHost(): string

Gets the host name of the system.

Return Values
Type Value Description
string

getPeakMemoryUsage

@System.getPeakMemoryUsage(): int

Gets the peak memory usage of the underlying runtime environment in number of bytes.

Return Values
Type Value Description
int

getProcessID

@System.getProcessID(): int

Gets the process ID of the underlying runtime environment.

Return Values
Type Value Description
int

listCommandLineArguments

@System.listCommandLineArguments(): object

Lists all command line arguments passed to the underlying runtime environment.

Return Values
Type Value Description
object [argument, ...]

sleep

@System.sleep(number $duration)

Delays execution for a specific duration in number of seconds.

The duration may include micro seconds in the fractional part.

Parameters
# Name Type Value Default
1 duration number 1 URI

URI

object @URI() {
	createDataURI(string $string, string $type, string $charset): string {}
	createQuery(object $attributes): string {}
	decode(string $string): string {}
	encode(string $string): string {}
	getAuthority(string $uri): string {}
	getFragment(string $uri): string {}
	getHierarchy(string $uri): string {}
	getHost(string $uri): string {}
	getPassword(string $uri): string {}
	getPath(string $uri): string {}
	getPort(string $uri): string {}
	getQuery(string $uri): string {}
	getScheme(string $uri): string {}
	getUser(string $uri): string {}
	isAbsolute(string $uri): bool {}
	isFile(string $path): bool {}
	isValid(string $uri): bool {}
	normalize(string $uri): string {}
	parse(string $uri): object {}
	parseQuery(string $query): object {}
}

Static URI related functions.

Functions

createDataURI

@URI.createDataURI(string $string, string $type, string $charset): string

Creates a data URI according to RFC 2397.

Parameters
# Name Type Value Default
1 string string ""
2 type string "text/plain"
3 charset string ""
Return Values
Type Value Description
string

createQuery

@URI.createQuery(object $attributes): string

Creates the URI query component out of specific attribute name and value pairs according to RFC 3986.

Parameters
# Name Type Value Default
1 attributes object [name: value, ...] []
Return Values
Type Value Description
string

decode

@URI.decode(string $string): string

Decodes a string according to RFC 3986 by replacing sequences incipient with a percent sign ("%") followed by a 2-character hexadecimal number with their applicable characters.

This function is complementary to "encode".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

encode

@URI.encode(string $string): string

Encodes a string according to RFC 3986 by replacing non-alphanumeric characters except "-", "_", "." and "~" with a percent sign ("%") followed by a 2-character hexadecimal number.

This function is complementary to "decode".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

getAuthority

@URI.getAuthority(string $uri): string

Gets the authority component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getFragment

@URI.getFragment(string $uri): string

Gets the fragment component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getHierarchy

@URI.getHierarchy(string $uri): string

Gets the hierarchy component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getHost

@URI.getHost(string $uri): string

Gets the host name component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getPassword

@URI.getPassword(string $uri): string

Gets the password component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getPath

@URI.getPath(string $uri): string

Gets the path name component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getPort

@URI.getPort(string $uri): string

Gets the port number component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getQuery

@URI.getQuery(string $uri): string

Gets the query component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getScheme

@URI.getScheme(string $uri): string

Gets the scheme component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

getUser

@URI.getUser(string $uri): string

Gets the username component of an URI.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

isAbsolute

@URI.isAbsolute(string $uri): bool

Determines whether an URI is absolute, meaning it has a scheme component.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
bool

isFile

@URI.isFile(string $path): bool

Determines whether an URI is of the file URI scheme.

Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
bool

isValid

@URI.isValid(string $uri): bool

Determines whether an URI is valid.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
bool

normalize

@URI.normalize(string $uri): string

Normalizes an URI to its canonicalized representation according to RFC 3986 and the comparison rules of RFC2616.

Converts scheme and host components to lower case, omits default port for HTTP (80) and HTTPS (443), capitalizes hexadecimal letters in percent-encoded sequences, and removes dot-segments from path component.

Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
string

parse

@URI.parse(string $uri): object
Parameters
# Name Type Value Default
1 uri string ""
Return Values
Type Value Description
object ["scheme": ..., "user": ..., "password": ..., "host": ..., "port": ..., "path": ..., "query": ..., "fragment": ...]

parseQuery

@URI.parseQuery(string $query): object
Parameters
# Name Type Value Default
1 query string ""
Return Values
Type Value Description
object [name: value, ...]

Var

object @Var() {
	clone(mixed $value): mixed {}
	compare(mixed $value1, mixed $value2): int {}
	count(mixed $value): int {}
	countGlobalVariables(): int {}
	deepClone(mixed $value): mixed {}
	exists(mixed $value): bool {}
	fromJSON(string $string): mixed {}
	fromSerializedPHP(string $string): mixed {}
	isBool(mixed $value): bool {}
	isComplex(mixed $value): bool {}
	isEmpty(mixed $value): bool {}
	isFloat(mixed $value): bool {}
	isFunction(mixed $value): bool {}
	isInt(mixed $value): bool {}
	isNull(mixed $value): bool {}
	isNumber(mixed $value): bool {}
	isNumeric(mixed $value): bool {}
	isObject(mixed $value): bool {}
	isScalar(mixed $value): bool {}
	isString(mixed $value): bool {}
	listGlobalVariables(): object {}
	listGlobalVariableNames(): object {}
	pack(string $format, ...$arguments): string {}
	toJSON(mixed $value): string {}
	toPrettyJSON(mixed $value): string {}
	toSerializedPHP(mixed $value): string {}
	typeOf(mixed $value): string {}
	unpack(string $format, string $string): object {}
}

Static variable related functions.

Functions

clone

@Var.clone(mixed $value): mixed

Clones the value by creating a shallow copy.

This function is equivalent to the "clone" operator.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
mixed

compare

@Var.compare(mixed $value1, mixed $value2): int

Compares two values.

This function is equivalent to the "<=>" operator.

Parameters
# Name Type Value Default
1 value1 mixed null
2 value2 mixed null
Return Values
Type Value Description
int +1 if the first value is greater than the second value
int -1 if the first value is less than the second value
int 0 if both values are equal

count

@Var.count(mixed $value): int

Counts the total number of intrinsic constituents of a value.

This function is equivalent to the "count" operator.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
int

countGlobalVariables

@Var.countGlobalVariables(): int

Counts the total number of global variables.

Return Values
Type Value Description
int

deepClone

@Var.deepClone(mixed $value): mixed

Clones the value by creating a deep copy.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
mixed

exists

@Var.exists(mixed $value): bool

Determines whether a value exists, meaning is not null.

This function is equivalent to the "exists" operator.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

fromJSON

@Var.fromJSON(string $string): mixed

Returns the value corresponding to a JavaScript Object Notation (JSON) representation according to RFC 4627.

This function is complementary to "toJSON".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
mixed

fromSerializedPHP

@Var.fromSerializedPHP(string $string): mixed

Returns the value corresponding to a serialized PHP representation.

This function is complementary to "toSerializedPHP".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
mixed

isBool

@Var.isBool(mixed $value): bool

Determines whether a value is of type "bool", meaning either true or false.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isComplex

@Var.isComplex(mixed $value): bool

Determines whether a value is of a complex type.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isEmpty

@Var.isEmpty(mixed $value): bool

Determines whether a value is empty, meaning either null, an empty string or an empty object.

This function is equivalent to the "empty" operator.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isFloat

@Var.isFloat(mixed $value): bool

Determines whether a value is of type "float".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isFunction

@Var.isFunction(mixed $value): bool

Determines whether a value is of type "function".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isInt

@Var.isInt(mixed $value): bool

Determines whether a value is of type "int".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isNull

@Var.isNull(mixed $value): bool

Determines whether a value is null.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isNumber

@Var.isNumber(mixed $value): bool

Determines whether a value is a number, meaning of type "int" or "float".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isNumeric

@Var.isNumeric(mixed $value): bool

Determines whether a value is numeric, meaning a number or the string representation thereof.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isObject

@Var.isObject(mixed $value): bool

Determines whether a value is of type "object".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isScalar

@Var.isScalar(mixed $value): bool

Determines whether a value is of a scalar type, meaning all primitive non-composite types.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

isString

@Var.isString(mixed $value): bool

Determines whether a value is of type "string".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
bool

listGlobalVariables

@Var.listGlobalVariables(): object

Lists all variables of global scope.

Return Values
Type Value Description
object [name: value, ...]

listGlobalVariableNames

@Var.listGlobalVariableNames(): object

Lists all variable names of global scope.

Return Values
Type Value Description
object [name, ...]

pack

@Var.pack(string $format, ...$arguments): string

Packs variadic arguments into binary data according to a specific Perl/PHP-compatible format.

Complex arguments are interpreted as strings for the purpose of packing.

This function is complementary to "unpack".

Parameters
# Name Type Value Default
1 format string ""
... arguments variadic ...
Return Values
Type Value Description
string

toJSON

@Var.toJSON(mixed $value): string

Returns the JavaScript Object Notation (JSON) representation of a value according to RFC 4627.

This function is complementary to "fromJSON".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
string

toPrettyJSON

@Var.toPrettyJSON(mixed $value): string

Returns the JavaScript Object Notation (JSON) representation of a value according to RFC 4627 in human-readable form.

This function is complementary to "fromJSON".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
string

toSerializedPHP

@Var.toSerializedPHP(mixed $value): string

Returns the serialized PHP representation of a value.

This function is complementary to "fromSerializedPHP".

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
string

typeOf

@Var.typeOf(mixed $value): string

Returns the type of a value.

This function is equivalent to the "typeof" operator.

Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
string

unpack

@Var.unpack(string $format, string $string): object

Unpacks values from binary data according to a specific Perl/PHP-compatible format.

This function is complementary to "pack".

Parameters
# Name Type Value Default
1 format string ""
2 string string ""
Return Values
Type Value Description
object [value, ...]

XML

object @XML() {
	createFromTree(object $tree): string {}
	escape(string $string): string {}
	parse(string $document, ?function $callback_open, ?function $callback_close, ?function $callback_cdata, ?object $bind) {}
	parseToTree(string $document): object {}
	unescape(string $string): string {}
}

Static XML related functions.

Functions

createFromTree

@XML.createFromTree(object $tree): string
Parameters
# Name Type Value Default
1 tree object []
Return Values
Type Value Description
string

escape

@XML.escape(string $string): string
Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

parse

@XML.parse(string $document, ?function $callback_open, ?function $callback_close, ?function $callback_cdata, ?object $bind)
Parameters
# Name Type Value Default
1 document string ""
2 callback_open ?function null
3 callback_close ?function null
4 callback_cdata ?function null
5 bind ?object null

parseToTree

@XML.parseToTree(string $document): object
Parameters
# Name Type Value Default
1 document string ""
Return Values
Type Value Description
object

unescape

@XML.unescape(string $string): string
Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

ZIP

object @ZIP() {}

Static ZIP prototypes.

.Archive

ZIP.Archive

object @ZIP.Archive(@Base) {
	construct(string $path, bool $readonly, string $password) {}
	addDirectory(string $path, string $prefix): $this {}
	addFile(string $path, string $name): $this {}
	close() {}
	countEntries(): int {}
	crc32(string $name): int {}
	createDirectory(string $name): $this {}
	delete(string $name): $this {}
	exists(string $name): bool {}
	exit(mixed $exception) {}
	extract(object $entries, string $path): $this {}
	extractAll(string $path): $this {}
	getComment(string $name): string {}
	getLastModified(string $name): int {}
	getMethod(string $name): int {}
	getSize(string $name): int {}
	getSizeRaw(string $name): int {}
	listEntries(): object {}
	move(string $name, string $target): $this {}
	read(string $name): string {}
	readRaw(string $name): string {}
	restore(string $name): $this {}
	rollback(): $this {}
	setComment(string $name, string $comment): $this {}
	write(string $name, string $string): $this {}
}

ZIP archive prototype.

Prototype

Base

Methods

construct

new @ZIP.Archive(string $path, bool $readonly, string $password)
Parameters
# Name Type Value Default
1 path string ""
2 readonly bool true
3 password string ""

addDirectory

$this.addDirectory(string $path, string $prefix): $this
Parameters
# Name Type Value Default
1 path string ""
2 prefix string ""
Return Values
Type Value Description
$this

addFile

$this.addFile(string $path, string $name): $this
Parameters
# Name Type Value Default
1 path string ""
2 name string derived from path
Return Values
Type Value Description
$this

close

$this.close()

Closes this archive and frees its associated resources.

countEntries

$this.countEntries(): int
Return Values
Type Value Description
int

crc32

$this.crc32(string $name): int
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
int

createDirectory

$this.createDirectory(string $name): $this
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
$this

delete

$this.delete(string $name): $this
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
$this

exists

$this.exists(string $name): bool
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
bool

exit

$this.exit(mixed $exception)

Closes this archive, rolls it back on failure and frees its associated resources for the purpose of contextualization.

Parameters
# Name Type Value Default
1 exception mixed null

extract

$this.extract(object $entries, string $path): $this
Parameters
# Name Type Value Default
1 entries object [name, ...] []
2 path string ""
Return Values
Type Value Description
$this

extractAll

$this.extractAll(string $path): $this
Parameters
# Name Type Value Default
1 path string ""
Return Values
Type Value Description
$this

getComment

$this.getComment(string $name): string
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string

getLastModified

$this.getLastModified(string $name): int

Timestamps are based on Unix time, defined as the number of seconds elapsed since midnight proleptic Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
int

getMethod

$this.getMethod(string $name): int
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
int

getSize

$this.getSize(string $name): int
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
int

getSizeRaw

$this.getSizeRaw(string $name): int
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
int

listEntries

$this.listEntries(): object
Return Values
Type Value Description
object [name, ...]

move

$this.move(string $name, string $target): $this
Parameters
# Name Type Value Default
1 name string ""
2 target string ""
Return Values
Type Value Description
$this

read

$this.read(string $name): string
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string

readRaw

$this.readRaw(string $name): string
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string

restore

$this.restore(string $name): $this
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
$this

rollback

$this.rollback(): $this

Rolls back this archive by discarding all changes.

Return Values
Type Value Description
$this

setComment

$this.setComment(string $name, string $comment): $this
Parameters
# Name Type Value Default
1 name string ""
2 comment string ""
Return Values
Type Value Description
$this

write

$this.write(string $name, string $string): $this
Parameters
# Name Type Value Default
1 name string ""
2 string string ""
Return Values
Type Value Description
$this

ZLIB

object @ZLIB() {
	deflate(string $string): string {}
	deflateRaw(string $string): string {}
	gunzip(string $string): string {}
	gzip(string $string): string {}
	inflate(string $string): string {}
	inflateRaw(string $string): string {}
}

Static ZLIB related functions.

Functions

deflate

@ZLIB.deflate(string $string): string

Deflates a string using ZLIB compression according to RFC 1950.

This function is complementary to "inflate".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

deflateRaw

@ZLIB.deflateRaw(string $string): string

Deflates a string using DEFLATE compression in raw format according to RFC 1951.

This function is complementary to "inflateRaw".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

gunzip

@ZLIB.gunzip(string $string): string

Unzips a string using GZIP decompression according to RFC 1952.

This function is complementary to "gzip".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

gzip

@ZLIB.gzip(string $string): string

Zips a string using GZIP compression according to RFC 1952.

This function is complementary to "gunzip".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

inflate

@ZLIB.inflate(string $string): string

Inflates a string using ZLIB decompression according to RFC 1950.

This function is complementary to "deflate".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

inflateRaw

@ZLIB.inflateRaw(string $string): string

Inflates a string using DEFLATE decompression in raw format according to RFC 1951.

This function is complementary to "deflateRaw".

Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
string

Zey OS

object @ZeyOS() {
	BASEURL;
	EXTURL;
	VERSION;
	authenticateUser(string $name, string $password, string $otp): object {}
	getSessionVariable(string $name): string {}
	getTempPath(): string {}
	initializeItems(object $items): object {}
	listSessionVariables(): object {}
	log(string $message, string $type, string $severity) {}
	queueMail(string $message, ?int $senddate, ?int $mailserver): ?int {}
	readConfig(): object {}
	resetCron(string $name) {}
	selectDatabase(): object {}
	selectSession(): object {}
	sendMail(string $message) {}
	writeConfig(object $config) {}
}

Consts

Name Type Description
BASEURL string ZeyOS base URL
EXTURL string ZeyOS external URL
VERSION int ZeyOS version number

Functions

authenticateUser

@ZeyOS.authenticateUser(string $name, string $password, string $otp): object
Parameters
# Name Type Value Default
1 name string ""
2 password string ""
3 otp string ""
Return Values
Type Value Description
@ZeyOS.ObjectUser
null if authentication failed

getSessionVariable

@ZeyOS.getSessionVariable(string $name): string

Gets the value of a session variable.

Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string
null if the variable is not found

getTempPath

@ZeyOS.getTempPath(): string
Return Values
Type Value Description
string

initializeItems

@ZeyOS.initializeItems(object $items): object
Parameters
# Name Type Value Default
1 items object []
Return Values
Type Value Description
object

listSessionVariables

@ZeyOS.listSessionVariables(): object

Lists all session variables.

Return Values
Type Value Description
object [name: value, ...]

log

@ZeyOS.log(string $message, string $type, string $severity)
Parameters
# Name Type Value Default
1 message string ""
2 type string ""
3 severity string ""

queueMail

@ZeyOS.queueMail(string $message, ?int $senddate, ?int $mailserver): ?int
Parameters
# Name Type Value Default
1 message string ""
2 senddate ?int null
3 mailserver ?int null
Return Values
Type Value Description
?int

readConfig

@ZeyOS.readConfig(): object
Return Values
Type Value Description
object

resetCron

@ZeyOS.resetCron(string $name)
Parameters
# Name Type Value Default
1 name string ""

selectDatabase

@ZeyOS.selectDatabase(): object
Return Values
Type Value Description
@SQL.PostgreSQL

selectSession

@ZeyOS.selectSession(): object
Return Values
Type Value Description
@ZeyOS.ObjectUser
null if there is no session

sendMail

@ZeyOS.sendMail(string $message)
Parameters
# Name Type Value Default
1 message string ""

writeConfig

@ZeyOS.writeConfig(object $config)
Parameters
# Name Type Value Default
1 config object

.AuditIterator

Zey OS.Audit Iterator

object @ZeyOS.AuditIterator(@Base) {
	construct(?int $timestamp) {}
	close() {}
	exit() {}
	hasMore(): bool {}
	next(): object {}
	reset(): $this {}
}

Prototype

Base

Methods

construct

new @ZeyOS.AuditIterator(?int $timestamp)
Parameters
# Name Type Value Default
1 timestamp ?int now

close

$this.close()

exit

$this.exit()

hasMore

$this.hasMore(): bool
Return Values
Type Value Description
bool

next

$this.next(): object
Return Values
Type Value Description
object
null if there are no more transactions

reset

$this.reset(): $this
Return Values
Type Value Description
$this

Zey OS.Bin File

object @ZeyOS.BinFile(@Base) {
	construct(?int $id) {}
	exists(): bool {}
	getID(): int {}
	read(): string {}
	readOut(): $this {}
	write(string $string): $this {}
}

Prototype

Base

Methods

construct

new @ZeyOS.BinFile(?int $id)
Parameters
# Name Type Value Default
1 id ?int new

exists

$this.exists(): bool
Return Values
Type Value Description
bool

getID

$this.getID(): int
Return Values
Type Value Description
int
null if the file does not exist

read

$this.read(): string
Return Values
Type Value Description
string

readOut

$this.readOut(): $this
Return Values
Type Value Description
$this

write

$this.write(string $string): $this
Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
$this

Zey OS.Ext Data

object @ZeyOS.ExtData(@Base) {
	construct(string $entity, int $id) {}
	clear(): $this {}
	getEntity(): string {}
	getField(string $name): ?string {}
	getID(): int {}
	hasField(string $name): bool {}
	listFieldNames(): object {}
	listFields(): object {}
	removeFields(object $names): $this {}
	setField(string $name, ?string $value): $this {}
	setFields(object $fields, string $prefix): $this {}
}

Prototype

Base

Methods

construct

new @ZeyOS.ExtData(string $entity, int $id)
Parameters
# Name Type Value Default
1 entity string ""
2 id int 0

clear

$this.clear(): $this
Return Values
Type Value Description
$this

getEntity

$this.getEntity(): string
Return Values
Type Value Description
string

getField

$this.getField(string $name): ?string
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
?string

getID

$this.getID(): int
Return Values
Type Value Description
int

hasField

$this.hasField(string $name): bool
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
bool

listFieldNames

$this.listFieldNames(): object
Return Values
Type Value Description
object [name, ...]

listFields

$this.listFields(): object
Return Values
Type Value Description
object [name: value, ...]

removeFields

$this.removeFields(object $names): $this
Parameters
# Name Type Value Default
1 names object [name, ...] []
Return Values
Type Value Description
$this

setField

$this.setField(string $name, ?string $value): $this
Parameters
# Name Type Value Default
1 name string ""
2 value ?string null
Return Values
Type Value Description
$this

setFields

$this.setFields(object $fields, string $prefix): $this
Parameters
# Name Type Value Default
1 fields object [name: value, ...] []
2 prefix string ""
Return Values
Type Value Description
$this

Zey OS.Key Auth

object @ZeyOS.KeyAuth() {
	create(string $key): string {}
	createSigned(string $key, string $path, string $content, string $method): string {}
	validate(string $key): bool {}
}

Functions

create

@ZeyOS.KeyAuth.create(string $key): string
Parameters
# Name Type Value Default
1 key string ""
Return Values
Type Value Description
string

createSigned

@ZeyOS.KeyAuth.createSigned(string $key, string $path, string $content, string $method): string
Parameters
# Name Type Value Default
1 key string ""
2 path string ""
3 content string ""
4 method string "POST"
Return Values
Type Value Description
string

validate

@ZeyOS.KeyAuth.validate(string $key): bool
Parameters
# Name Type Value Default
1 key string ""
Return Values
Type Value Description
bool
null if there is no proper authorization header

Zey OS.Num Format

object @ZeyOS.NumFormat(@Base) {
	construct(string $name) {}
	getFormat(): string {}
	getName(): string {}
	getNumber(): string {}
	incrementCounter(int $offset): int {}
	nextNumber(): string {}
}

Prototype

Base

Methods

construct

new @ZeyOS.NumFormat(string $name)
Parameters
# Name Type Value Default
1 name string ""

getFormat

$this.getFormat(): string
Return Values
Type Value Description
string

getName

$this.getName(): string
Return Values
Type Value Description
string

getNumber

$this.getNumber(): string
Return Values
Type Value Description
string

incrementCounter

$this.incrementCounter(int $offset): int
Parameters
# Name Type Value Default
1 offset int 1
Return Values
Type Value Description
int

nextNumber

$this.nextNumber(): string
Return Values
Type Value Description
string

Zey OS.Object

object @ZeyOS.Object(@Base) {
	construct(string $entity, ?int $id) {}
	clear(): $this {}
	delete(): $this {}
	deleteRaw(): $this {}
	exists(): bool {}
	getEntity(): string {}
	getField(string $name): ?string {}
	getFieldArray(string $name): ?object {}
	getFieldJSON(string $name): ?object {}
	getID(): int {}
	hasField(string $name): bool {}
	listFieldNames(): object {}
	listFields(): object {}
	load(): $this {}
	readBinFile(string $name): string {}
	removeFields(object $names): $this {}
	save(?function $callback, object $extdata, object $tags): $this {}
	saveRaw(): $this {}
	selectExtData(): object {}
	selectTags(): object {}
	setField(string $name, ?string $value): $this {}
	setFieldArray(string $name, ?object $array): $this {}
	setFieldEncrypted(string $name, ?string $value): $this {}
	setFieldJSON(string $name, ?object $array): $this {}
	setFields(object $fields, string $prefix): $this {}
	writeBinFile(string $name, string $data): $this {}
}

Prototype

Base

Methods

construct

new @ZeyOS.Object(string $entity, ?int $id)
Parameters
# Name Type Value Default
1 entity string ""
2 id ?int new

clear

$this.clear(): $this
Return Values
Type Value Description
$this

delete

$this.delete(): $this
Return Values
Type Value Description
$this

deleteRaw

$this.deleteRaw(): $this
Return Values
Type Value Description
$this

exists

$this.exists(): bool
Return Values
Type Value Description
bool

getEntity

$this.getEntity(): string
Return Values
Type Value Description
string

getField

$this.getField(string $name): ?string
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
?string

getFieldArray

$this.getFieldArray(string $name): ?object
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
?object

getFieldJSON

$this.getFieldJSON(string $name): ?object
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
?object

getID

$this.getID(): int
Return Values
Type Value Description
int
null if the object is not persistent

hasField

$this.hasField(string $name): bool
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
bool

listFieldNames

$this.listFieldNames(): object
Return Values
Type Value Description
object [name, ...]

listFields

$this.listFields(): object
Return Values
Type Value Description
object [name: value, ...]

load

$this.load(): $this
Return Values
Type Value Description
$this

readBinFile

$this.readBinFile(string $name): string
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
string

removeFields

$this.removeFields(object $names): $this
Parameters
# Name Type Value Default
1 names object [name, ...] []
Return Values
Type Value Description
$this

save

$this.save(?function $callback, object $extdata, object $tags): $this
Parameters
# Name Type Value Default
1 callback ?function no callback
2 extdata object [name: value, ...] []
3 tags object [name, ...] []
Return Values
Type Value Description
$this

saveRaw

$this.saveRaw(): $this
Return Values
Type Value Description
$this

selectExtData

$this.selectExtData(): object
Return Values
Type Value Description
@ZeyOS.ExtData
null if the object is not persistent

selectTags

$this.selectTags(): object
Return Values
Type Value Description
@ZeyOS.Tags
null if the object is not persistent

setField

$this.setField(string $name, ?string $value): $this
Parameters
# Name Type Value Default
1 name string ""
2 value ?string null
Return Values
Type Value Description
$this

setFieldArray

$this.setFieldArray(string $name, ?object $array): $this
Parameters
# Name Type Value Default
1 name string ""
2 array ?object [value, ...] null
Return Values
Type Value Description
$this

setFieldEncrypted

$this.setFieldEncrypted(string $name, ?string $value): $this
Parameters
# Name Type Value Default
1 name string ""
2 value ?string null
Return Values
Type Value Description
$this

setFieldJSON

$this.setFieldJSON(string $name, ?object $array): $this
Parameters
# Name Type Value Default
1 name string ""
2 array ?object null
Return Values
Type Value Description
$this

setFields

$this.setFields(object $fields, string $prefix): $this
Parameters
# Name Type Value Default
1 fields object [name: value, ...] []
2 prefix string ""
Return Values
Type Value Description
$this

writeBinFile

$this.writeBinFile(string $name, string $data): $this
Parameters
# Name Type Value Default
1 name string ""
2 data string ""
Return Values
Type Value Description
$this

Transaction

Zey OS.Object Transaction

object @ZeyOS.ObjectTransaction(@ZeyOS.Object) {
	construct(?int $id) {}
	book(): bool {}
	cancel(): bool {}
	close(): bool {}
	getItems(): object {}
	process(object $fields, object $serials): bool {}
	setItems(object $items): $this {}
}

Prototype

ZeyOS.Object

Methods

construct

new @ZeyOS.ObjectTransaction(?int $id)
Parameters
# Name Type Value Default
1 id ?int new

book

$this.book(): bool
Return Values
Type Value Description
bool

cancel

$this.cancel(): bool
Return Values
Type Value Description
bool

close

$this.close(): bool
Return Values
Type Value Description
bool

getItems

$this.getItems(): object
Return Values
Type Value Description
object

process

$this.process(object $fields, object $serials): bool
Parameters
# Name Type Value Default
1 fields object [name: value, ...] []
2 serials object [serialnum, ...] []
Return Values
Type Value Description
bool

setItems

$this.setItems(object $items): $this
Parameters
# Name Type Value Default
1 items object []
Return Values
Type Value Description
$this

Zey OS.Object User

object @ZeyOS.ObjectUser(@ZeyOS.Object) {
	construct(?int $id) {}
	getLang(): string {}
	getSettings(): object {}
	hasPermission(string $identifier, bool $writable): bool {}
	inGroup(int $id, bool $writable): bool {}
	isAdmin(): bool {}
	listGroups(): object {}
	listPermissions(): object {}
	setPassword(string $password): $this {}
	setSettings(object $settings): $this {}
}

Prototype

ZeyOS.Object

Methods

construct

new @ZeyOS.ObjectUser(?int $id)
Parameters
# Name Type Value Default
1 id ?int new

getLang

$this.getLang(): string
Return Values
Type Value Description
string

getSettings

$this.getSettings(): object
Return Values
Type Value Description
object

hasPermission

$this.hasPermission(string $identifier, bool $writable): bool
Parameters
# Name Type Value Default
1 identifier string ""
2 writable bool false
Return Values
Type Value Description
bool

inGroup

$this.inGroup(int $id, bool $writable): bool
Parameters
# Name Type Value Default
1 id int 0
2 writable bool false
Return Values
Type Value Description
bool

isAdmin

$this.isAdmin(): bool
Return Values
Type Value Description
bool

listGroups

$this.listGroups(): object
Return Values
Type Value Description
object [id: writable, ...]

listPermissions

$this.listPermissions(): object
Return Values
Type Value Description
object [identifier: writable, ...]

setPassword

$this.setPassword(string $password): $this
Parameters
# Name Type Value Default
1 password string ""
Return Values
Type Value Description
$this

setSettings

$this.setSettings(object $settings): $this
Parameters
# Name Type Value Default
1 settings object []
Return Values
Type Value Description
$this

Zey OS.Tags

object @ZeyOS.Tags(@Base) {
	construct(string $entity, int $id) {}
	addTags(object $names): $this {}
	clear(): $this {}
	getEntity(): string {}
	getID(): int {}
	hasTag(string $name): bool {}
	listTags(): object {}
	removeTags(object $names): $this {}
	resetTags(object $names): $this {}
}

Prototype

Base

Methods

construct

new @ZeyOS.Tags(string $entity, int $id)
Parameters
# Name Type Value Default
1 entity string ""
2 id int 0

addTags

$this.addTags(object $names): $this
Parameters
# Name Type Value Default
1 names object [name, ...] []
Return Values
Type Value Description
$this

clear

$this.clear(): $this
Return Values
Type Value Description
$this

getEntity

$this.getEntity(): string
Return Values
Type Value Description
string

getID

$this.getID(): int
Return Values
Type Value Description
int

hasTag

$this.hasTag(string $name): bool
Parameters
# Name Type Value Default
1 name string ""
Return Values
Type Value Description
bool

listTags

$this.listTags(): object
Return Values
Type Value Description
object [name, ...]

removeTags

$this.removeTags(object $names): $this
Parameters
# Name Type Value Default
1 names object [name, ...] []
Return Values
Type Value Description
$this

resetTags

$this.resetTags(object $names): $this
Parameters
# Name Type Value Default
1 names object [name, ...] []
Return Values
Type Value Description
$this

Zey OS.Temp File

object @ZeyOS.TempFile(@Base) {
	construct(string $name) {}
	delete(): $this {}
	getName(): string {}
	getPath(): string {}
	read(): string {}
	readJSON(): mixed {}
	reserve(): string {}
	toString(): string {}
	write(string $string): $this {}
	writeJSON(mixed $value): $this {}
}

Prototype

Base

Methods

construct

new @ZeyOS.TempFile(string $name)
Parameters
# Name Type Value Default
1 name string ""

delete

$this.delete(): $this
Return Values
Type Value Description
$this

getName

$this.getName(): string
Return Values
Type Value Description
string

getPath

$this.getPath(): string
Return Values
Type Value Description
string

read

$this.read(): string
Return Values
Type Value Description
string

readJSON

$this.readJSON(): mixed
Return Values
Type Value Description
mixed

reserve

$this.reserve(): string
Return Values
Type Value Description
string

toString

$this.toString(): string
Return Values
Type Value Description
string

write

$this.write(string $string): $this
Parameters
# Name Type Value Default
1 string string ""
Return Values
Type Value Description
$this

writeJSON

$this.writeJSON(mixed $value): $this
Parameters
# Name Type Value Default
1 value mixed null
Return Values
Type Value Description
$this

Zey OS.Token Auth

object @ZeyOS.TokenAuth() {
	login(string $name, string $password, string $identifier, string $appsecret, string $otp, ?int $expdate): object {}
	logout(string $token): bool {}
	validate(string $token): object {}
}

Functions

login

@ZeyOS.TokenAuth.login(string $name, string $password, string $identifier, string $appsecret, string $otp, ?int $expdate): object
Parameters
# Name Type Value Default
1 name string ""
2 password string ""
3 identifier string ""
4 appsecret string ""
5 otp string ""
6 expdate ?int (no expiration) null
Return Values
Type Value Description
object
int status code if login failed

logout

@ZeyOS.TokenAuth.logout(string $token): bool
Parameters
# Name Type Value Default
1 token string ""
Return Values
Type Value Description
bool

validate

@ZeyOS.TokenAuth.validate(string $token): object
Parameters
# Name Type Value Default
1 token string ""
Return Values
Type Value Description
object
null if validation failed

Zey OS.Transaction Context

object @ZeyOS.TransactionContext(@Base) {
	construct() {}
	enter() {}
	exit(mixed $exception) {}
}

ZeyOS transaction context prototype.

Prototype

Base

Methods

construct

new @ZeyOS.TransactionContext()

enter

$this.enter()

exit

$this.exit(mixed $exception)
Parameters
# Name Type Value Default
1 exception mixed null ZeyOS.Warning

Zey OS.Warning

object @ZeyOS.Warning(@Exception) {
	construct(string $message) {}
}

Prototype

Exception

Methods

construct

new @ZeyOS.Warning(string $message)
Parameters
# Name Type Value Default
1 message string