1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer\Tests\Fixtures;
6
7use JMS\Serializer\Annotation\Groups;
8use JMS\Serializer\Annotation\SerializedName;
9use JMS\Serializer\Annotation\Since;
10use JMS\Serializer\Annotation\Until;
11use JMS\Serializer\Annotation\VirtualProperty;
12use JMS\Serializer\Annotation\XmlAttribute;
13use JMS\Serializer\Annotation\XmlList;
14use JMS\Serializer\Annotation\XmlMap;
15use JMS\Serializer\Annotation\XmlValue;
16
17class ObjectWithVirtualXmlProperties
18{
19    /**
20     * @VirtualProperty
21     * @SerializedName("foo")
22     * @Groups({"attributes"})
23     * @XmlAttribute
24     */
25    public function getVirualXmlAttributeValue()
26    {
27        return 'bar';
28    }
29
30    /**
31     * @VirtualProperty
32     * @SerializedName("xml-value")
33     * @Groups({"values"})
34     * @XmlValue
35     */
36    public function getVirualXmlValue()
37    {
38        return 'xml-value';
39    }
40
41    /**
42     * @VirtualProperty
43     * @SerializedName("list")
44     * @Groups({"list"})
45     * @XmlList(inline = true, entry = "val")
46     */
47    public function getVirualXmlList()
48    {
49        return ['One', 'Two'];
50    }
51
52    /**
53     * @VirtualProperty
54     * @SerializedName("map")
55     * @Groups({"map"})
56     * @XmlMap(keyAttribute = "key")
57     */
58    public function getVirualXmlMap()
59    {
60        return [
61            'key-one' => 'One',
62            'key-two' => 'Two',
63        ];
64    }
65
66    /**
67     * @VirtualProperty
68     * @SerializedName("low")
69     * @Groups({"versions"})
70     * @Until("8")
71     */
72    public function getVirualLowValue()
73    {
74        return 1;
75    }
76
77    /**
78     * @VirtualProperty
79     * @SerializedName("hight")
80     * @Groups({"versions"})
81     * @Since("8")
82     */
83    public function getVirualHighValue()
84    {
85        return 8;
86    }
87}
88