7ef91a82318c6c84f3192eece22404f776d471ca
[yaffs-website] / vendor / symfony / serializer / Mapping / Factory / ClassMetadataFactoryInterface.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Serializer\Mapping\Factory;
13
14 use Symfony\Component\Serializer\Exception\InvalidArgumentException;
15 use Symfony\Component\Serializer\Mapping\ClassMetadataInterface;
16
17 /**
18  * Returns a {@see ClassMetadataInterface}.
19  *
20  * @author Kévin Dunglas <dunglas@gmail.com>
21  */
22 interface ClassMetadataFactoryInterface
23 {
24     /**
25      * If the method was called with the same class name (or an object of that
26      * class) before, the same metadata instance is returned.
27      *
28      * If the factory was configured with a cache, this method will first look
29      * for an existing metadata instance in the cache. If an existing instance
30      * is found, it will be returned without further ado.
31      *
32      * Otherwise, a new metadata instance is created. If the factory was
33      * configured with a loader, the metadata is passed to the
34      * {@link \Symfony\Component\Serializer\Mapping\Loader\LoaderInterface::loadClassMetadata()} method for further
35      * configuration. At last, the new object is returned.
36      *
37      * @param string|object $value
38      *
39      * @return ClassMetadataInterface
40      *
41      * @throws InvalidArgumentException
42      */
43     public function getMetadataFor($value);
44
45     /**
46      * Checks if class has metadata.
47      *
48      * @param mixed $value
49      *
50      * @return bool
51      */
52     public function hasMetadataFor($value);
53 }