File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 7
7
class Ref implements Constraint
8
8
{
9
9
public $ ref ;
10
- public function __construct ($ ref , Schema $ schema )
10
+ public function __construct ($ ref , Schema $ schema = null )
11
11
{
12
12
$ this ->ref = $ ref ;
13
13
$ this ->schema = $ schema ;
@@ -16,6 +16,15 @@ public function __construct($ref, Schema $schema)
16
16
/** @var Schema */
17
17
private $ schema ;
18
18
19
+ /**
20
+ * @param Schema $schema
21
+ * @return Ref
22
+ */
23
+ public function setSchema ($ schema )
24
+ {
25
+ $ this ->schema = $ schema ;
26
+ return $ this ;
27
+ }
19
28
20
29
/**
21
30
* @return Schema
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ public function dumpSchema(Schema $schema)
91
91
return $ contents ;
92
92
}
93
93
94
- public function dumpSchemaDeeper (Schema $ schema , $ path )
94
+ private function dumpSchemaDeeper (Schema $ schema , $ path )
95
95
{
96
96
$ result = new \stdClass ();
97
97
@@ -324,6 +324,7 @@ private function resolveReference($referencePath)
324
324
if ($ referencePath === '# ' ) {
325
325
$ ref = new Ref ($ referencePath , $ this ->rootSchema );
326
326
} else {
327
+ $ ref = new Ref ($ referencePath );
327
328
$ path = explode ('/ ' , trim ($ referencePath , '#/ ' ));
328
329
$ branch = &$ this ->rootData ;
329
330
while (!empty ($ path )) {
@@ -342,7 +343,7 @@ private function resolveReference($referencePath)
342
343
throw new \Exception ('Could not resolve ' . $ referencePath . ': ' . $ folder );
343
344
}
344
345
}
345
- $ ref = new Ref ( $ referencePath , $ this ->readSchema ($ branch ));
346
+ $ ref-> setSchema ( $ this ->readSchema ($ branch ));
346
347
}
347
348
} else {
348
349
$ refParts = explode ('# ' , $ referencePath );
You can’t perform that action at this time.
0 commit comments