forked from geocoder-php/BazingaGeocoderBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddress.php
More file actions
50 lines (39 loc) · 1.29 KB
/
Address.php
File metadata and controls
50 lines (39 loc) · 1.29 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
declare(strict_types=1);
/*
* This file is part of the BazingaGeocoderBundle package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Bazinga\GeocoderBundle\Validator\Constraint;
use Symfony\Component\Validator\Constraint;
/**
* @Annotation
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
*
* @author Tomas Norkūnas <norkunas.tom@gmail.com>
*/
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
class Address extends Constraint
{
public const INVALID_ADDRESS_ERROR = '2243aa07-2ea7-4eb7-962c-6a9586593f2c';
protected const ERROR_NAMES = [
self::INVALID_ADDRESS_ERROR => 'INVALID_ADDRESS_ERROR',
];
public string $service = AddressValidator::class;
public string $message = 'Address {{ address }} is not valid.';
/**
* @param string[]|null $options
*/
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, $payload = null)
{
parent::__construct($options, $groups, $payload);
$this->message = $message ?? $this->message;
}
public function validatedBy(): string
{
return $this->service;
}
}