1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer\Tests\Fixtures;
6
7use JMS\Serializer\Annotation\Type;
8use JMS\Serializer\Annotation\XmlAttribute;
9use JMS\Serializer\Annotation\XmlElement;
10use JMS\Serializer\Annotation\XmlNamespace;
11use JMS\Serializer\Annotation\XmlRoot;
12
13/**
14 * @XmlRoot("test-object", namespace="http://example.com/namespace", prefix="ex")
15 * @XmlNamespace(uri="http://example.com/namespace")
16 * @XmlNamespace(uri="http://schemas.google.com/g/2005", prefix="gd")
17 * @XmlNamespace(uri="http://www.w3.org/2005/Atom", prefix="atom")
18 */
19class ObjectWithXmlNamespaces
20{
21    /**
22     * @Type("string")
23     * @XmlElement(namespace="http://purl.org/dc/elements/1.1/");
24     */
25    private $title;
26
27    /**
28     * @Type("DateTime")
29     * @XmlAttribute
30     */
31    private $createdAt;
32
33    /**
34     * @Type("string")
35     * @XmlAttribute(namespace="http://schemas.google.com/g/2005")
36     */
37    private $etag;
38
39    /**
40     * @Type("string")
41     * @XmlElement(namespace="http://www.w3.org/2005/Atom")
42     */
43    private $author;
44
45    /**
46     * @Type("string")
47     * @XmlAttribute(namespace="http://purl.org/dc/elements/1.1/");
48     */
49    private $language;
50
51    public function __construct($title, $author, \DateTime $createdAt, $language)
52    {
53        $this->title = $title;
54        $this->author = $author;
55        $this->createdAt = $createdAt;
56        $this->language = $language;
57        $this->etag = sha1($this->createdAt->format(\DateTime::ATOM));
58    }
59}
60