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
41 lines (33 loc) · 1.12 KB
/
Address.php
File metadata and controls
41 lines (33 loc) · 1.12 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
<?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 function __construct(public string $service = AddressValidator::class, public string $message = 'Address {{ address }} is not valid.', ?array $groups = null, $payload = null)
{
parent::__construct(null, $groups, $payload);
}
public function validatedBy(): string
{
return $this->service;
}
}