Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/Constraints/Count.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
23 class Count extends Constraint | 23 class Count extends Constraint |
24 { | 24 { |
25 const TOO_FEW_ERROR = 'bef8e338-6ae5-4caf-b8e2-50e7b0579e69'; | 25 const TOO_FEW_ERROR = 'bef8e338-6ae5-4caf-b8e2-50e7b0579e69'; |
26 const TOO_MANY_ERROR = '756b1212-697c-468d-a9ad-50dd783bb169'; | 26 const TOO_MANY_ERROR = '756b1212-697c-468d-a9ad-50dd783bb169'; |
27 | 27 |
28 protected static $errorNames = array( | 28 protected static $errorNames = [ |
29 self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', | 29 self::TOO_FEW_ERROR => 'TOO_FEW_ERROR', |
30 self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', | 30 self::TOO_MANY_ERROR => 'TOO_MANY_ERROR', |
31 ); | 31 ]; |
32 | 32 |
33 public $minMessage = 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.'; | 33 public $minMessage = 'This collection should contain {{ limit }} element or more.|This collection should contain {{ limit }} elements or more.'; |
34 public $maxMessage = 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.'; | 34 public $maxMessage = 'This collection should contain {{ limit }} element or less.|This collection should contain {{ limit }} elements or less.'; |
35 public $exactMessage = 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.'; | 35 public $exactMessage = 'This collection should contain exactly {{ limit }} element.|This collection should contain exactly {{ limit }} elements.'; |
36 public $min; | 36 public $min; |
37 public $max; | 37 public $max; |
38 | 38 |
39 public function __construct($options = null) | 39 public function __construct($options = null) |
40 { | 40 { |
41 if (null !== $options && !is_array($options)) { | 41 if (null !== $options && !\is_array($options)) { |
42 $options = array( | 42 $options = [ |
43 'min' => $options, | 43 'min' => $options, |
44 'max' => $options, | 44 'max' => $options, |
45 ); | 45 ]; |
46 } | 46 } |
47 | 47 |
48 parent::__construct($options); | 48 parent::__construct($options); |
49 | 49 |
50 if (null === $this->min && null === $this->max) { | 50 if (null === $this->min && null === $this->max) { |
51 throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), array('min', 'max')); | 51 throw new MissingOptionsException(sprintf('Either option "min" or "max" must be given for constraint %s', __CLASS__), ['min', 'max']); |
52 } | 52 } |
53 } | 53 } |
54 } | 54 } |