Chris@0
|
1 <?php
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@0
|
4 * This file is part of the Symfony package.
|
Chris@0
|
5 *
|
Chris@0
|
6 * (c) Fabien Potencier <fabien@symfony.com>
|
Chris@0
|
7 *
|
Chris@0
|
8 * For the full copyright and license information, please view the LICENSE
|
Chris@0
|
9 * file that was distributed with this source code.
|
Chris@0
|
10 */
|
Chris@0
|
11
|
Chris@0
|
12 namespace Symfony\Component\Validator\Constraints;
|
Chris@0
|
13
|
Chris@0
|
14 use Symfony\Component\Validator\Constraint;
|
Chris@0
|
15
|
Chris@0
|
16 /**
|
Chris@0
|
17 * @Annotation
|
Chris@0
|
18 * @Target({"PROPERTY", "METHOD", "ANNOTATION"})
|
Chris@0
|
19 *
|
Chris@0
|
20 * @author The Whole Life To Learn <thewholelifetolearn@gmail.com>
|
Chris@0
|
21 * @author Manuel Reinhard <manu@sprain.ch>
|
Chris@0
|
22 * @author Bernhard Schussek <bschussek@gmail.com>
|
Chris@0
|
23 */
|
Chris@0
|
24 class Isbn extends Constraint
|
Chris@0
|
25 {
|
Chris@0
|
26 const TOO_SHORT_ERROR = '949acbb0-8ef5-43ed-a0e9-032dfd08ae45';
|
Chris@0
|
27 const TOO_LONG_ERROR = '3171387d-f80a-47b3-bd6e-60598545316a';
|
Chris@0
|
28 const INVALID_CHARACTERS_ERROR = '23d21cea-da99-453d-98b1-a7d916fbb339';
|
Chris@0
|
29 const CHECKSUM_FAILED_ERROR = '2881c032-660f-46b6-8153-d352d9706640';
|
Chris@0
|
30 const TYPE_NOT_RECOGNIZED_ERROR = 'fa54a457-f042-441f-89c4-066ee5bdd3e1';
|
Chris@0
|
31
|
Chris@17
|
32 protected static $errorNames = [
|
Chris@0
|
33 self::TOO_SHORT_ERROR => 'TOO_SHORT_ERROR',
|
Chris@0
|
34 self::TOO_LONG_ERROR => 'TOO_LONG_ERROR',
|
Chris@0
|
35 self::INVALID_CHARACTERS_ERROR => 'INVALID_CHARACTERS_ERROR',
|
Chris@0
|
36 self::CHECKSUM_FAILED_ERROR => 'CHECKSUM_FAILED_ERROR',
|
Chris@0
|
37 self::TYPE_NOT_RECOGNIZED_ERROR => 'TYPE_NOT_RECOGNIZED_ERROR',
|
Chris@17
|
38 ];
|
Chris@0
|
39
|
Chris@0
|
40 public $isbn10Message = 'This value is not a valid ISBN-10.';
|
Chris@0
|
41 public $isbn13Message = 'This value is not a valid ISBN-13.';
|
Chris@0
|
42 public $bothIsbnMessage = 'This value is neither a valid ISBN-10 nor a valid ISBN-13.';
|
Chris@0
|
43 public $type;
|
Chris@0
|
44 public $message;
|
Chris@0
|
45
|
Chris@0
|
46 /**
|
Chris@0
|
47 * {@inheritdoc}
|
Chris@0
|
48 */
|
Chris@0
|
49 public function getDefaultOption()
|
Chris@0
|
50 {
|
Chris@0
|
51 return 'type';
|
Chris@0
|
52 }
|
Chris@0
|
53 }
|