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 SerializationVisitorInterface extends VisitorInterface
21{
22    /**
23     * @param mixed $data
24     * @param array $type
25     *
26     * @return mixed
27     */
28    public function visitNull($data, array $type);
29
30    /**
31     * @param mixed $data
32     * @param array $type
33     *
34     * @return mixed
35     */
36    public function visitString(string $data, array $type);
37
38    /**
39     * @param mixed $data
40     * @param array $type
41     *
42     * @return mixed
43     */
44    public function visitBoolean(bool $data, array $type);
45
46    /**
47     * @param mixed $data
48     * @param array $type
49     *
50     * @return mixed
51     */
52    public function visitDouble(float $data, array $type);
53
54    /**
55     * @param mixed $data
56     * @param array $type
57     *
58     * @return mixed
59     */
60    public function visitInteger(int $data, array $type);
61
62    /**
63     * @param mixed $data
64     * @param array $type
65     *
66     * @return array|\ArrayObject
67     */
68    public function visitArray(array $data, array $type);
69
70    /**
71     * Called before the properties of the object are being visited.
72     *
73     * @param mixed $data
74     * @param array $type
75     */
76    public function startVisitingObject(ClassMetadata $metadata, object $data, array $type): void;
77
78    /**
79     * @param mixed $data
80     */
81    public function visitProperty(PropertyMetadata $metadata, $data): void;
82
83    /**
84     * Called after all properties of the object have been visited.
85     *
86     * @param mixed $data
87     * @param array $type
88     *
89     * @return array|\ArrayObject
90     */
91    public function endVisitingObject(ClassMetadata $metadata, object $data, array $type);
92}
93