Yaffs site version 1.1
[yaffs-website] / vendor / symfony / serializer / Encoder / DecoderInterface.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\Encoder;
13
14 use Symfony\Component\Serializer\Exception\UnexpectedValueException;
15
16 /**
17  * Defines the interface of decoders.
18  *
19  * @author Jordi Boggiano <j.boggiano@seld.be>
20  */
21 interface DecoderInterface
22 {
23     /**
24      * Decodes a string into PHP data.
25      *
26      * @param string $data    Data to decode
27      * @param string $format  Format name
28      * @param array  $context options that decoders have access to
29      *
30      * The format parameter specifies which format the data is in; valid values
31      * depend on the specific implementation. Authors implementing this interface
32      * are encouraged to document which formats they support in a non-inherited
33      * phpdoc comment.
34      *
35      * @return mixed
36      *
37      * @throws UnexpectedValueException
38      */
39     public function decode($data, $format, array $context = array());
40
41     /**
42      * Checks whether the deserializer can decode from given format.
43      *
44      * @param string $format format name
45      *
46      * @return bool
47      */
48     public function supportsDecoding($format);
49 }