forked from Respect/Validation
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPropertyException.php
35 lines (29 loc) · 985 Bytes
/
PropertyException.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <[email protected]>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
namespace Respect\Validation\Exceptions;
final class PropertyException extends NestedValidationException implements NonOmissibleException
{
public const NOT_PRESENT = 'not_present';
public const INVALID = 'invalid';
/**
* @var array<string, array<string, string>>
*/
protected array $defaultTemplates = [
self::MODE_DEFAULT => [
self::NOT_PRESENT => 'Property {{name}} must be present',
self::INVALID => 'Property {{name}} must be valid',
],
self::MODE_NEGATIVE => [
self::NOT_PRESENT => 'Property {{name}} must not be present',
self::INVALID => 'Property {{name}} must not validate',
],
];
protected function chooseTemplate(): string
{
return $this->getParam('hasReference') ? self::INVALID : self::NOT_PRESENT;
}
}