1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Swaggest\JsonSchema; |
4
|
|
|
|
5
|
|
|
class Context extends MagicMap |
6
|
|
|
{ |
7
|
|
|
public $import = true; |
8
|
|
|
|
9
|
|
|
/** @var DataPreProcessor */ |
10
|
|
|
public $dataPreProcessor; |
11
|
|
|
|
12
|
|
|
/** @var RefResolver */ |
13
|
|
|
public $refResolver; |
14
|
|
|
|
15
|
|
|
/** @var RemoteRefProvider|null */ |
16
|
|
|
public $remoteRefProvider; |
17
|
|
|
|
18
|
|
|
/** @var bool Skip result mapping, only validate data */ |
19
|
|
|
public $validateOnly = false; |
20
|
|
|
|
21
|
|
|
/** @var bool Apply default values */ |
22
|
|
|
public $applyDefaults = true; |
23
|
|
|
|
24
|
|
|
/** @var string */ |
25
|
|
|
public $propagateObjectItemClass; |
26
|
|
|
|
27
|
|
|
/** @var \SplObjectStorage */ |
28
|
|
|
public $circularReferences; |
29
|
|
|
|
30
|
|
|
/** @var bool */ |
31
|
|
|
public $skipValidation = false; |
32
|
|
|
|
33
|
|
|
/** @var string[] map of from -> to class names */ |
34
|
|
|
public $objectItemClassMapping; |
35
|
|
|
|
36
|
|
|
/** @var bool allow soft cast from to/strings */ |
37
|
|
|
public $tolerateStrings = false; |
38
|
|
|
|
39
|
|
|
/** @var bool do not tolerate special symbols even if base64_decode accepts string */ |
40
|
|
|
public $strictBase64Validation = false; |
41
|
|
|
|
42
|
|
|
/** @var bool pack/unpack application/json in string content */ |
43
|
|
|
public $unpackContentMediaType = true; |
44
|
|
|
|
45
|
|
|
/** @var \SplObjectStorage optional schemas cache */ |
46
|
|
|
public $schemasCache; |
47
|
|
|
|
48
|
|
|
/** @var string property mapping set name */ |
49
|
|
|
public $mapping = Schema::DEFAULT_MAPPING; |
50
|
|
|
|
51
|
|
|
public $version = Schema::VERSION_AUTO; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @param boolean $skipValidation |
55
|
|
|
* @return Context |
56
|
|
|
*/ |
57
|
|
|
public function setSkipValidation($skipValidation = true) |
58
|
|
|
{ |
59
|
|
|
$this->skipValidation = $skipValidation; |
60
|
|
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* ProcessingOptions constructor. |
66
|
|
|
* @param RemoteRefProvider $remoteRefProvider |
67
|
|
|
*/ |
68
|
3197 |
|
public function __construct(RemoteRefProvider $remoteRefProvider = null) |
69
|
|
|
{ |
70
|
3197 |
|
$this->remoteRefProvider = $remoteRefProvider; |
71
|
3197 |
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return DataPreProcessor |
75
|
|
|
*/ |
76
|
|
|
public function getDataPreProcessor() |
77
|
|
|
{ |
78
|
|
|
return $this->dataPreProcessor; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @param DataPreProcessor $dataPreProcessor |
83
|
|
|
* @return Context |
84
|
|
|
*/ |
85
|
|
|
public function setDataPreProcessor($dataPreProcessor) |
86
|
|
|
{ |
87
|
|
|
$this->dataPreProcessor = $dataPreProcessor; |
88
|
|
|
return $this; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* @return RemoteRefProvider|null |
93
|
|
|
*/ |
94
|
|
|
public function getRemoteRefProvider() |
95
|
|
|
{ |
96
|
|
|
return $this->remoteRefProvider; |
97
|
|
|
} |
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @param RemoteRefProvider $remoteRefProvider |
101
|
|
|
* @return Context |
102
|
|
|
*/ |
103
|
3141 |
|
public function setRemoteRefProvider($remoteRefProvider) |
104
|
|
|
{ |
105
|
3141 |
|
$this->remoteRefProvider = $remoteRefProvider; |
106
|
3141 |
|
return $this; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** @var self */ |
110
|
|
|
private $withSkipValidation; |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* @return Context |
114
|
|
|
*/ |
115
|
11 |
|
public function withSkipValidation() |
116
|
|
|
{ |
117
|
11 |
|
if (null === $this->withSkipValidation) { |
118
|
11 |
|
if ($this->skipValidation) { |
119
|
|
|
$this->withSkipValidation = $this; |
120
|
|
|
} else { |
121
|
11 |
|
$this->withSkipValidation = clone $this; |
122
|
11 |
|
$this->withSkipValidation->skipValidation = true; |
123
|
|
|
} |
124
|
|
|
} |
125
|
|
|
|
126
|
11 |
|
return $this->withSkipValidation; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
|
130
|
|
|
} |