Completed
Push — master ( a8cf27...ed6ab4 )
by Eric
02:36
created

Context::getExclusionStrategy()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Ivory Serializer package.
5
 *
6
 * (c) Eric GELOEN <[email protected]>
7
 *
8
 * For the full copyright and license information, please read the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Ivory\Serializer\Context;
13
14
use Ivory\Serializer\Exclusion\ExclusionStrategy;
15
use Ivory\Serializer\Exclusion\ExclusionStrategyInterface;
16
use Ivory\Serializer\Naming\IdenticalNamingStrategy;
17
use Ivory\Serializer\Naming\NamingStrategyInterface;
18
use Ivory\Serializer\Navigator\NavigatorInterface;
19
use Ivory\Serializer\Visitor\VisitorInterface;
20
21
/**
22
 * @author GeLo <[email protected]>
23
 */
24
class Context implements ContextInterface
25
{
26
    /**
27
     * @var NavigatorInterface
28
     */
29
    private $navigator;
30
31
    /**
32
     * @var VisitorInterface
33
     */
34
    private $visitor;
35
36
    /**
37
     * @var int
38
     */
39
    private $direction;
40
41
    /**
42
     * @var \SplStack
43
     */
44
    private $dataStack;
45
46
    /**
47
     * @var \SplStack
48
     */
49
    private $metadataStack;
50
51
    /**
52
     * @var ExclusionStrategyInterface
53
     */
54
    private $exclusionStrategy;
55
56
    /**
57
     * @var NamingStrategyInterface
58
     */
59
    private $namingStrategy;
60
61
    /**
62
     * @param ExclusionStrategyInterface|null $exclusionStrategy
63
     * @param NamingStrategyInterface|null    $namingStrategy
64
     */
65
    public function __construct(
66
        ExclusionStrategyInterface $exclusionStrategy = null,
67
        NamingStrategyInterface $namingStrategy = null
68
    ) {
69
        $this->exclusionStrategy = $exclusionStrategy ?: new ExclusionStrategy();
70
        $this->namingStrategy = $namingStrategy ?: new IdenticalNamingStrategy();
71
    }
72
73
    /**
74
     * {@inheritdoc}
75
     */
76
    public function getNavigator()
77
    {
78
        return $this->navigator;
79
    }
80
81
    /**
82
     * {@inheritdoc}
83
     */
84
    public function setNavigator(NavigatorInterface $navigator)
85
    {
86
        $this->navigator = $navigator;
87
88
        return $this;
89
    }
90
91
    /**
92
     * {@inheritdoc}
93
     */
94
    public function getVisitor()
95
    {
96
        return $this->visitor;
97
    }
98
99
    /**
100
     * {@inheritdoc}
101
     */
102
    public function setVisitor(VisitorInterface $visitor)
103
    {
104
        $this->visitor = $visitor;
105
106
        return $this;
107
    }
108
109
    /**
110
     * {@inheritdoc}
111
     */
112
    public function getDirection()
113
    {
114
        return $this->direction;
115
    }
116
117
    /**
118
     * {@inheritdoc}
119
     */
120
    public function setDirection($direction)
121
    {
122
        $this->direction = $direction;
123
124
        return $this;
125
    }
126
127
    /**
128
     * {@inheritdoc}
129
     */
130
    public function getDataStack()
131
    {
132
        return $this->dataStack;
133
    }
134
135
    /**
136
     * {@inheritdoc}
137
     */
138
    public function setDataStack(\SplStack $dataStack)
139
    {
140
        $this->dataStack = $dataStack;
141
142
        return $this;
143
    }
144
145
    /**
146
     * {@inheritdoc}
147
     */
148
    public function getMetadataStack()
149
    {
150
        return $this->metadataStack;
151
    }
152
153
    /**
154
     * {@inheritdoc}
155
     */
156
    public function setMetadataStack(\SplStack $metadataStack)
157
    {
158
        $this->metadataStack = $metadataStack;
159
160
        return $this;
161
    }
162
163
    /**
164
     * {@inheritdoc}
165
     */
166
    public function getExclusionStrategy()
167
    {
168
        return $this->exclusionStrategy;
169
    }
170
171
    /**
172
     * {@inheritdoc}
173
     */
174
    public function setExclusionStrategy(ExclusionStrategyInterface $exclusionStrategy)
175
    {
176
        $this->exclusionStrategy = $exclusionStrategy;
177
178
        return $this;
179
    }
180
181
    /**
182
     * {@inheritdoc}
183
     */
184
    public function getNamingStrategy()
185
    {
186
        return $this->namingStrategy;
187
    }
188
189
    /**
190
     * {@inheritdoc}
191
     */
192
    public function setNamingStrategy(NamingStrategyInterface $namingStrategy)
193
    {
194
        $this->namingStrategy = $namingStrategy;
195
196
        return $this;
197
    }
198
}
199