|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
/* |
|
6
|
|
|
* Copyright 2016 Johannes M. Schmitt <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
9
|
|
|
* you may not use this file except in compliance with the License. |
|
10
|
|
|
* You may obtain a copy of the License at |
|
11
|
|
|
* |
|
12
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
13
|
|
|
* |
|
14
|
|
|
* Unless required by applicable law or agreed to in writing, software |
|
15
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
16
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
17
|
|
|
* See the License for the specific language governing permissions and |
|
18
|
|
|
* limitations under the License. |
|
19
|
|
|
*/ |
|
20
|
|
|
|
|
21
|
|
|
namespace JMS\Serializer; |
|
22
|
|
|
use JMS\Serializer\Exclusion\ExclusionStrategyInterface; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Handles traversal along the object graph. |
|
26
|
|
|
* |
|
27
|
|
|
* This class handles traversal along the graph, and calls different methods |
|
28
|
|
|
* on visitors, or custom handlers to process its nodes. |
|
29
|
|
|
* |
|
30
|
|
|
* @author Johannes M. Schmitt <[email protected]> |
|
31
|
|
|
*/ |
|
32
|
|
|
abstract class GraphNavigator implements GraphNavigatorInterface |
|
33
|
|
|
{ |
|
34
|
|
|
/** |
|
35
|
|
|
* @var VisitorInterface |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $visitor; |
|
38
|
|
|
/** |
|
39
|
|
|
* @var Context |
|
40
|
|
|
*/ |
|
41
|
|
|
protected $context; |
|
42
|
|
|
/*** |
|
43
|
|
|
* @var string |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $format; |
|
46
|
|
|
/** |
|
47
|
|
|
* @var ExclusionStrategyInterface |
|
48
|
|
|
*/ |
|
49
|
|
|
protected $exclusionStrategy; |
|
50
|
|
|
|
|
51
|
300 |
|
public function initialize(VisitorInterface $visitor, Context $context):void |
|
52
|
|
|
{ |
|
53
|
300 |
|
$this->visitor = $visitor; |
|
54
|
300 |
|
$this->context = $context; |
|
55
|
|
|
|
|
56
|
|
|
// cache value |
|
57
|
300 |
|
$this->format = $context->getFormat(); |
|
58
|
300 |
|
$this->exclusionStrategy = $context->getExclusionStrategy(); |
|
59
|
300 |
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
|