Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/ValidatorBuilder.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
35 * | 35 * |
36 * @author Bernhard Schussek <bschussek@gmail.com> | 36 * @author Bernhard Schussek <bschussek@gmail.com> |
37 */ | 37 */ |
38 class ValidatorBuilder implements ValidatorBuilderInterface | 38 class ValidatorBuilder implements ValidatorBuilderInterface |
39 { | 39 { |
40 private $initializers = array(); | 40 private $initializers = []; |
41 private $xmlMappings = array(); | 41 private $xmlMappings = []; |
42 private $yamlMappings = array(); | 42 private $yamlMappings = []; |
43 private $methodMappings = array(); | 43 private $methodMappings = []; |
44 | 44 |
45 /** | 45 /** |
46 * @var Reader|null | 46 * @var Reader|null |
47 */ | 47 */ |
48 private $annotationReader; | 48 private $annotationReader; |
66 * @var TranslatorInterface|null | 66 * @var TranslatorInterface|null |
67 */ | 67 */ |
68 private $translator; | 68 private $translator; |
69 | 69 |
70 /** | 70 /** |
71 * @var null|string | 71 * @var string|null |
72 */ | 72 */ |
73 private $translationDomain; | 73 private $translationDomain; |
74 | 74 |
75 /** | 75 /** |
76 * {@inheritdoc} | 76 * {@inheritdoc} |
211 /** | 211 /** |
212 * {@inheritdoc} | 212 * {@inheritdoc} |
213 */ | 213 */ |
214 public function setMetadataFactory(MetadataFactoryInterface $metadataFactory) | 214 public function setMetadataFactory(MetadataFactoryInterface $metadataFactory) |
215 { | 215 { |
216 if (count($this->xmlMappings) > 0 || count($this->yamlMappings) > 0 || count($this->methodMappings) > 0 || null !== $this->annotationReader) { | 216 if (\count($this->xmlMappings) > 0 || \count($this->yamlMappings) > 0 || \count($this->methodMappings) > 0 || null !== $this->annotationReader) { |
217 throw new ValidatorException('You cannot set a custom metadata factory after adding custom mappings. You should do either of both.'); | 217 throw new ValidatorException('You cannot set a custom metadata factory after adding custom mappings. You should do either of both.'); |
218 } | 218 } |
219 | 219 |
220 $this->metadataFactory = $metadataFactory; | 220 $this->metadataFactory = $metadataFactory; |
221 | 221 |
269 /** | 269 /** |
270 * @return LoaderInterface[] | 270 * @return LoaderInterface[] |
271 */ | 271 */ |
272 public function getLoaders() | 272 public function getLoaders() |
273 { | 273 { |
274 $loaders = array(); | 274 $loaders = []; |
275 | 275 |
276 foreach ($this->xmlMappings as $xmlMapping) { | 276 foreach ($this->xmlMappings as $xmlMapping) { |
277 $loaders[] = new XmlFileLoader($xmlMapping); | 277 $loaders[] = new XmlFileLoader($xmlMapping); |
278 } | 278 } |
279 | 279 |
301 | 301 |
302 if (!$metadataFactory) { | 302 if (!$metadataFactory) { |
303 $loaders = $this->getLoaders(); | 303 $loaders = $this->getLoaders(); |
304 $loader = null; | 304 $loader = null; |
305 | 305 |
306 if (count($loaders) > 1) { | 306 if (\count($loaders) > 1) { |
307 $loader = new LoaderChain($loaders); | 307 $loader = new LoaderChain($loaders); |
308 } elseif (1 === count($loaders)) { | 308 } elseif (1 === \count($loaders)) { |
309 $loader = $loaders[0]; | 309 $loader = $loaders[0]; |
310 } | 310 } |
311 | 311 |
312 $metadataFactory = new LazyLoadingMetadataFactory($loader, $this->metadataCache); | 312 $metadataFactory = new LazyLoadingMetadataFactory($loader, $this->metadataCache); |
313 } | 313 } |