* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Tests\Fixtures; use Symfony\Component\Validator\Exception\NoSuchMetadataException; use Symfony\Component\Validator\Mapping\Factory\MetadataFactoryInterface; use Symfony\Component\Validator\MetadataInterface; class FakeMetadataFactory implements MetadataFactoryInterface { protected $metadatas = array(); public function getMetadataFor($class) { $hash = null; if (is_object($class)) { $hash = spl_object_hash($class); $class = get_class($class); } if (!is_string($class)) { throw new NoSuchMetadataException(sprintf('No metadata for type %s', gettype($class))); } if (!isset($this->metadatas[$class])) { if (isset($this->metadatas[$hash])) { return $this->metadatas[$hash]; } throw new NoSuchMetadataException(sprintf('No metadata for "%s"', $class)); } return $this->metadatas[$class]; } public function hasMetadataFor($class) { $hash = null; if (is_object($class)) { $hash = spl_object_hash($class); $class = get_class($class); } if (!is_string($class)) { return false; } return isset($this->metadatas[$class]) || isset($this->metadatas[$hash]); } public function addMetadata($metadata) { $this->metadatas[$metadata->getClassName()] = $metadata; } public function addMetadataForValue($value, MetadataInterface $metadata) { $key = is_object($value) ? spl_object_hash($value) : $value; $this->metadatas[$key] = $metadata; } } __halt_compiler();----SIGNATURE:----tR9zbJFfAxjbuKuRMtCqAkk/0n/sDJGlZno8MIjxqJdY0WVbBENfHxvFSxqvSt0s4JfpXAqogIHGwcZC8aK2KMgthjxYvISS84lES9en0rB1Ug395aucQrsYneRY47/v1o9S3/ae2Pca0PeSn/pk50e8wFL6Y6V1d7nbcWd2J7XMOdyyw+uL4dZ1wjbiV8no8kBhtuZWr/EyGTWY7m8yp6X4USy8foLy24VqNQUuEPCPWRZGe0lSKl5r/Eo6RMGoldtu7tmn4LWMW1Yij6GgBM3TMS1lEGLOwiT9ZrWFyRLiq/8AYUMYUZaj9IUp0w5SofWGpwYe+HaRf1hGkOQT5ThtyYs0QZsVYGkwmNJSObIVp+7FDKNfCYQWF3d9Pax43iJVq7qD7LZukK2d8Tou6tn/uPbCLjTP+6lubHGZF7nO+dljd/E3/NEOiS0TYpsq/YfWfZ7mYKBCB3RBdfBqZdDPDl55qhVnaYCTMRtRKhAQcPvAX94XBP1ZUlDvH5+XTkNbGpNHGY7A/lj9+nmeEy5F0ROKA4FciNReaxlulSV9r9x0hWfMkaD14uC0nggAO0PbbkZ0k3rWHl0aygr8x6untUaypr3LD53VMmmQ41m52Vdo8sAEmaoSGHcYRwfPF06UgGSdXwkMDDW6he9IB7AyAJ1d24xpl0Xlss9KnMY=----ATTACHMENT:----ODgyMDYwMjY0NTA1MTYxMiA2ODIxNTkyMDA3NTQ3NDc2IDkzNTMxODI2MzE4MzQ0MTU=