Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

Base/Exceptions/InvalidArgumentValue.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Base\Exceptions;
8
9 use Exception;
10
16 class InvalidArgumentValue extends InvalidArgumentException
17 {
26 public function __construct($argumentName, $value, $className = null, Exception $previous = null)
27 {
28 $valueStr = is_string($value) ? $value : var_export($value, true);
29 $parameters = ['%actualValue%' => $valueStr];
30 $this->setMessageTemplate("'%actualValue%' is wrong value");
31 if ($className) {
32 $this->setMessageTemplate("'%actualValue%' is wrong value in class '%className%'");
33 $parameters['%className%'] = $className;
34 }
35 $whatIsWrong = $this->getMessageTemplate();
36
37 parent::__construct($argumentName, $whatIsWrong, $previous);
38
39 // Alter the message template & inject new parameters.
41 $this->setMessageTemplate(str_replace('%whatIsWrong%', $whatIsWrong, $this->getMessageTemplate()));
42 $this->addParameters($parameters);
43 $this->message = $this->getBaseTranslation();
44 }
45 }
eZ\Publish\Core\Base\$parameters
$parameters
Definition: TranslatableBase.php:16
eZ\Publish\Core\Base\Exceptions\InvalidArgumentException
Invalid Argument Type Exception implementation.
Definition: Core/Base/Exceptions/InvalidArgumentException.php:20
eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue
Invalid Argument Type Exception implementation.
Definition: Base/Exceptions/InvalidArgumentValue.php:17
eZ\Publish\Core\Base\Exceptions\InvalidArgumentValue\__construct
__construct($argumentName, $value, $className=null, Exception $previous=null)
Generates: "Argument '{$argumentName}' is invalid: '{$value}' is wrong value[ in class '{$className}'...
Definition: Base/Exceptions/InvalidArgumentValue.php:26
eZ\Publish\Core\Base\Translatable\setMessageTemplate
setMessageTemplate($messageTemplate)
Injects the message template.
eZ\Publish\Core\Base\Translatable\getBaseTranslation
getBaseTranslation()
Returns base translation, computed with message template and parameters.
eZ\Publish\Core\Base\Translatable\getMessageTemplate
getMessageTemplate()
Returns the message template, with placeholders for parameters.
eZ\Publish\Core\Base\Translatable\addParameters
addParameters(array $parameters)
Adds $parameters to existing hash map.
eZ\Publish\Core\Base\Exceptions
Definition: Core/Base/Exceptions/BadStateException.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.