Completed
Push — master ( bd1396...8457c9 )
by Viacheslav
9s
created

Context::setRemoteRefProvider()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
c 0
b 0
f 0
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 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 string */
25
    public $propagateObjectItemClass;
26
27
    /** @var \SplObjectStorage */
28
    public $circularReferences;
29
30
    /** @var bool */
31
    public $skipValidation = false;
32
33
    /** @var string[]|null 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 $withDefault;
111
112
    /**
113
     * @return Context
114
     */
115 5
    public function withDefault()
116
    {
117 5
        if (null === $this->withDefault) {
118 5
            $this->withDefault = clone $this;
119 5
            $this->withDefault->skipValidation = true;
120 5
            $this->withDefault->applyDefaults = false;
121
        }
122
123 5
        return $this->withDefault;
124
    }
125
126
127
}