1<?php 2 3declare(strict_types=1); 4 5namespace JMS\Serializer; 6 7use JMS\Serializer\Exclusion\ExclusionStrategyInterface; 8 9/** 10 * Handles traversal along the object graph. 11 * 12 * This class handles traversal along the graph, and calls different methods 13 * on visitors, or custom handlers to process its nodes. 14 * 15 * @internal 16 * 17 * @author Asmir Mustafic <goetas@gmail.com> 18 * @author Johannes M. Schmitt <schmittjoh@gmail.com> 19 */ 20abstract class GraphNavigator implements GraphNavigatorInterface 21{ 22 /** 23 * @var VisitorInterface 24 */ 25 protected $visitor; 26 /** 27 * @var Context 28 */ 29 protected $context; 30 /*** 31 * @var string 32 */ 33 protected $format; 34 /** 35 * @var ExclusionStrategyInterface 36 */ 37 protected $exclusionStrategy; 38 39 public function initialize(VisitorInterface $visitor, Context $context): void 40 { 41 $this->visitor = $visitor; 42 $this->context = $context; 43 44 // cache value 45 $this->format = $context->getFormat(); 46 $this->exclusionStrategy = $context->getExclusionStrategy(); 47 } 48} 49