1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer\Visitor;
6
7use JMS\Serializer\Metadata\ClassMetadata;
8use JMS\Serializer\Metadata\PropertyMetadata;
9use JMS\Serializer\VisitorInterface;
10
11/**
12 * Interface for visitors.
13 *
14 * This contains the minimal set of values that must be supported for any
15 * output format.
16 *
17 * @author Johannes M. Schmitt <schmittjoh@gmail.com>
18 * @author Asmir Mustafic <goetas@gmail.com>
19 */
20interface DeserializationVisitorInterface extends VisitorInterface
21{
22    /**
23     * @param mixed $data
24     * @param array $type
25     *
26     * @return mixed
27     */
28    public function visitNull($data, array $type): void;
29
30    /**
31     * @param mixed $data
32     * @param array $type
33     *
34     * @return mixed
35     */
36    public function visitString($data, array $type): string;
37
38    /**
39     * @param mixed $data
40     * @param array $type
41     *
42     * @return mixed
43     */
44    public function visitBoolean($data, array $type): bool;
45
46    /**
47     * @param mixed $data
48     * @param array $type
49     *
50     * @return mixed
51     */
52    public function visitDouble($data, array $type): float;
53
54    /**
55     * @param mixed $data
56     * @param array $type
57     *
58     * @return mixed
59     */
60    public function visitInteger($data, array $type): int;
61
62    /**
63     * Returns the class name based on the type of the discriminator map value
64     *
65     * @param mixed $data
66     */
67    public function visitDiscriminatorMapProperty($data, ClassMetadata $metadata): string;
68
69    /**
70     * @param mixed $data
71     * @param array $type
72     *
73     * @return mixed
74     */
75    public function visitArray($data, array $type): array;
76
77    /**
78     * Called before the properties of the object are being visited.
79     *
80     * @param array $type
81     */
82    public function startVisitingObject(ClassMetadata $metadata, object $data, array $type): void;
83
84    /**
85     * @param mixed $data
86     *
87     * @return mixed
88     */
89    public function visitProperty(PropertyMetadata $metadata, $data);
90
91    /**
92     * Called after all properties of the object have been visited.
93     *
94     * @param mixed $data
95     * @param array $type
96     */
97    public function endVisitingObject(ClassMetadata $metadata, $data, array $type): object;
98
99    /**
100     * @param mixed $data
101     *
102     * @return mixed
103     */
104    public function getResult($data);
105}
106