1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer;
6
7use JMS\Serializer\Exception\NotAcceptableException;
8
9interface GraphNavigatorInterface
10{
11    public const DIRECTION_SERIALIZATION = 1;
12    public const DIRECTION_DESERIALIZATION = 2;
13
14    /**
15     * Called at the beginning of the serialization process. The navigator should use the traverse the object graph
16     * and pass to the $visitor the value of found nodes (following the rules obtained from $context).
17     */
18    public function initialize(VisitorInterface $visitor, Context $context): void;
19
20    /**
21     * Called for each node of the graph that is being traversed.
22     *
23     * @param mixed $data the data depends on the direction, and type of visitor
24     * @param array|null $type array has the format ["name" => string, "params" => array]
25     *
26     * @return mixed the return value depends on the direction, and type of visitor
27     *
28     * @throws NotAcceptableException
29     */
30    public function accept($data, ?array $type = null);
31}
32