Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/validator/Mapping/Factory/LazyLoadingMetadataFactory.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | c2387f117808 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
44 /** | 44 /** |
45 * The loaded metadata, indexed by class name. | 45 * The loaded metadata, indexed by class name. |
46 * | 46 * |
47 * @var ClassMetadata[] | 47 * @var ClassMetadata[] |
48 */ | 48 */ |
49 protected $loadedClasses = array(); | 49 protected $loadedClasses = []; |
50 | 50 |
51 /** | 51 /** |
52 * Creates a new metadata factory. | 52 * Creates a new metadata factory. |
53 * | 53 * |
54 * @param LoaderInterface|null $loader The loader for configuring new metadata | 54 * @param LoaderInterface|null $loader The loader for configuring new metadata |
76 * {@link LoaderInterface::loadClassMetadata()} method for further | 76 * {@link LoaderInterface::loadClassMetadata()} method for further |
77 * configuration. At last, the new object is returned. | 77 * configuration. At last, the new object is returned. |
78 */ | 78 */ |
79 public function getMetadataFor($value) | 79 public function getMetadataFor($value) |
80 { | 80 { |
81 if (!is_object($value) && !is_string($value)) { | 81 if (!\is_object($value) && !\is_string($value)) { |
82 throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: %s', gettype($value))); | 82 throw new NoSuchMetadataException(sprintf('Cannot create metadata for non-objects. Got: %s', \gettype($value))); |
83 } | 83 } |
84 | 84 |
85 $class = ltrim(is_object($value) ? get_class($value) : $value, '\\'); | 85 $class = ltrim(\is_object($value) ? \get_class($value) : $value, '\\'); |
86 | 86 |
87 if (isset($this->loadedClasses[$class])) { | 87 if (isset($this->loadedClasses[$class])) { |
88 return $this->loadedClasses[$class]; | 88 return $this->loadedClasses[$class]; |
89 } | 89 } |
90 | 90 |
152 /** | 152 /** |
153 * {@inheritdoc} | 153 * {@inheritdoc} |
154 */ | 154 */ |
155 public function hasMetadataFor($value) | 155 public function hasMetadataFor($value) |
156 { | 156 { |
157 if (!is_object($value) && !is_string($value)) { | 157 if (!\is_object($value) && !\is_string($value)) { |
158 return false; | 158 return false; |
159 } | 159 } |
160 | 160 |
161 $class = ltrim(is_object($value) ? get_class($value) : $value, '\\'); | 161 $class = ltrim(\is_object($value) ? \get_class($value) : $value, '\\'); |
162 | 162 |
163 return class_exists($class) || interface_exists($class, false); | 163 return class_exists($class) || interface_exists($class, false); |
164 } | 164 } |
165 } | 165 } |