Class used to handle translation errors.

since 4.0.0
package GlotPress

 Methods

Adds a callback for a new error.

add(string $id, callable $callback) 
since 4.0.0
access public

Parameters

$id

string

Unique ID of the callback.

$callback

callable

The callback.

Checks translations for any error.

check(\GP_Original $gp_original, array<mixed,string> $translations, \GP_Locale $locale) : array | null
since 4.0.0
access public

Parameters

$gp_original

\GP_Original

The original object.

$translations

array<mixed,string>

The translations.

$locale

\GP_Locale

The locale.

Returns

arraynullNull if no issues have been found, otherwise an array with errors.

Checks whether a callback exists for an ID.

has(string $id) : boolean
since 4.0.0
access public

Parameters

$id

string

Unique ID of the callback.

Returns

booleanTrue if exists, false if not.

Removes an existing callback for an error.

remove(string $id) 
since 4.0.0
access public

Parameters

$id

string

Unique ID of the callback.

 Properties

 

List of callbacks.

$callbacks : array<mixed,callable>

Default

array()
since 4.0.0
access public