1<?php
2
3declare(strict_types=1);
4
5namespace JMS\Serializer;
6
7/**
8 * @internal
9 */
10abstract class AbstractVisitor implements VisitorInterface
11{
12    /**
13     * @var GraphNavigatorInterface
14     */
15    protected $navigator;
16
17    public function setNavigator(GraphNavigatorInterface $navigator): void
18    {
19        $this->navigator = $navigator;
20    }
21
22    /**
23     * {@inheritdoc}
24     */
25    public function prepare($data)
26    {
27        return $data;
28    }
29
30    protected function getElementType(array $typeArray): ?array
31    {
32        if (false === isset($typeArray['params'][0])) {
33            return null;
34        }
35
36        if (isset($typeArray['params'][1]) && \is_array($typeArray['params'][1])) {
37            return $typeArray['params'][1];
38        } else {
39            return $typeArray['params'][0];
40        }
41    }
42}
43