Context::getRemoteRefProvider()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nop 0
crap 1
nc 1
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 \SplObjectStorage */
25
    public $circularReferences;
26
27
    /** @var bool */
28
    public $skipValidation = false;
29
30
    /** @var string[]|null map of from -> to class names */
31
    public $objectItemClassMapping;
32
33
    /** @var bool allow soft cast from to/strings */
34
    public $tolerateStrings = false;
35
36
    /** @var bool do not tolerate special symbols even if base64_decode accepts string */
37
    public $strictBase64Validation = false;
38
39
    /** @var bool pack/unpack application/json in string content */
40
    public $unpackContentMediaType = true;
41
42
    /** @var \SplObjectStorage optional schemas cache */
43
    public $schemasCache;
44
45
    /** @var string property mapping set name */
46
    public $mapping = Schema::DEFAULT_MAPPING;
47
48
    public $version = Schema::VERSION_AUTO;
49
50
    public $exportedDefinitions = [];
51
52
    public $isRef = false;
53
54
    /**
55
     * Dereference $ref unless there is a $ref property defined with format not equal to `uri-reference`.
56
     * Default JSON Schema behavior is to dereference only if there is a $ref property defined with format
57
     * equal to `uri-reference`.
58
     *
59
     * @var bool
60
     */
61
    public $dereference = false;
62
63
    /**
64
     * @param boolean $skipValidation
65
     * @return Context
66
     */
67
    public function setSkipValidation($skipValidation = true)
68
    {
69 3336
        $this->skipValidation = $skipValidation;
70
        return $this;
71 3336
    }
72 3336
73
74
    /**
75
     * ProcessingOptions constructor.
76
     * @param RemoteRefProvider $remoteRefProvider
77
     */
78
    public function __construct(RemoteRefProvider $remoteRefProvider = null)
79
    {
80
        $this->remoteRefProvider = $remoteRefProvider;
81
    }
82
83
    /**
84
     * @return DataPreProcessor
85
     */
86
    public function getDataPreProcessor()
87
    {
88
        return $this->dataPreProcessor;
89
    }
90
91
    /**
92
     * @param DataPreProcessor $dataPreProcessor
93
     * @return Context
94
     */
95
    public function setDataPreProcessor($dataPreProcessor)
96
    {
97
        $this->dataPreProcessor = $dataPreProcessor;
98
        return $this;
99
    }
100
101
    /**
102
     * @return RemoteRefProvider|null
103
     */
104 3253
    public function getRemoteRefProvider()
105
    {
106 3253
        return $this->remoteRefProvider;
107 3253
    }
108
109
    /**
110
     * @param RemoteRefProvider $remoteRefProvider
111
     * @return Context
112
     */
113
    public function setRemoteRefProvider($remoteRefProvider)
114
    {
115
        $this->remoteRefProvider = $remoteRefProvider;
116 5
        return $this;
117
    }
118 5
119 5
    /** @var self */
120 5
    private $withDefault;
121 5
122
    /**
123
     * @return Context
124 5
     */
125
    public function withDefault()
126
    {
127
        if (null === $this->withDefault) {
128
            $this->withDefault = clone $this;
129
            $this->withDefault->skipValidation = true;
130
            $this->withDefault->applyDefaults = false;
131
        }
132
133
        return $this->withDefault;
134
    }
135
136
137
}