LocalizationResult implements JsonSerializable
Read onlyYes
FinalYes
Result object for localization operations
Contains the outcome of a localization operation and optional finisher that tells the frontend what to do next (e.g., redirect, load a module, reload).
Table of Contents
Interfaces
- JsonSerializable
Properties
- $errors : array<string|int, mixed>
- $finisher : LocalizationFinisherInterface|null
- $success : bool
Methods
- __construct() : mixed
- error() : self
- Create a failed result with error messages
- hasErrors() : bool
- Check if the result has errors
- isSuccess() : bool
- Check if the result is successful
- jsonSerialize() : array<string|int, mixed>
- Convert to array for JSON serialization
- success() : self
- Create a successful result
Properties
$errors
public
array<string|int, mixed>
$errors
= []
$finisher
public
LocalizationFinisherInterface|null
$finisher
= null
$success
public
bool
$success
= true
Methods
__construct()
public
__construct([bool $success = true ][, LocalizationFinisherInterface|null $finisher = null ][, array<string|int, string> $errors = [] ]) : mixed
Parameters
- $success : bool = true
-
Whether the localization was successful
- $finisher : LocalizationFinisherInterface|null = null
-
Finisher to execute after localization (required for success)
- $errors : array<string|int, string> = []
-
Array of error messages (if any)
error()
Create a failed result with error messages
public
static error(array<string|int, string> $errors) : self
Parameters
- $errors : array<string|int, string>
Return values
selfhasErrors()
Check if the result has errors
public
hasErrors() : bool
Return values
boolisSuccess()
Check if the result is successful
public
isSuccess() : bool
Return values
booljsonSerialize()
Convert to array for JSON serialization
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed>success()
Create a successful result
public
static success(LocalizationFinisherInterface $finisher) : self
Parameters
- $finisher : LocalizationFinisherInterface