ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ConstraintViolationException.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
3
8namespace ILIAS\Refinery;
9
10/***
11 * Signals the violation of some constraint on a value in a way that can be subject
12 * to i18n.
13 */
15{
19 private $languageId;
20
25
33 public function __construct(
34 string $message,
35 string $languageId,
37 ) {
39
40 $this->languageId = $languageId;
41 $this->languageValues = $languageValues;
42 }
43
48 public function getTranslatedMessage(callable $txt)
49 {
50 return vsprintf($txt($this->languageId), $this->languageValues);
51 }
52}
An exception for terminatinating execution or to throw for unit testing.
__construct(string $message, string $languageId,... $languageValues)
Construct a violation on a constraint.
$txt
Definition: error.php:13
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$message
Definition: xapiexit.php:14