<?php class ErrorList { private array $errors; public function add(string $fieldName, ValidationError $validationError): void { $this->errors[$fieldName][] = $validationError; } public function getListOfFieldErrors(string $fieldName): array { $result = $this->errors[$fieldName] ?? []; if (!$result) { return $result; } foreach ($result as $key => $error) { $result [$key] = $error->get("text"); } return $result; } public function isEmpty(): bool { return empty($this->errors); } }
You have javascript disabled. You will not be able to edit any code.