forked from FriendsOfSymfony/FOSRestBundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXmlDecoder.php
More file actions
44 lines (38 loc) · 991 Bytes
/
Copy pathXmlDecoder.php
File metadata and controls
44 lines (38 loc) · 991 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*
* This file is part of the FOSRestBundle package.
*
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FOS\RestBundle\Decoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
/**
* Decodes XML data.
*
* @author Jordi Boggiano <[email protected]>
* @author John Wards <[email protected]>
* @author Fabian Vogler <[email protected]>
*/
class XmlDecoder implements DecoderInterface
{
private $encoder;
public function __construct()
{
$this->encoder = new XmlEncoder();
}
/**
* {@inheritdoc}
*/
public function decode($data)
{
try {
return $this->encoder->decode($data, 'xml');
} catch (UnexpectedValueException $e) {
return;
}
}
}