@@ -1034,26 +1034,31 @@ public function process($data, Context $options, $path = '#', $result = null)
10341034 });
10351035 }
10361036
1037- if ('# ' !== $ path && $ refs = $ data ->getFromRefs ()) {
1038- $ ref = $ refs [0 ];
1039- if (!array_key_exists ($ ref , $ options ->exportedDefinitions )) {
1040- $ exported = null ;
1041- $ options ->exportedDefinitions [$ ref ] = &$ exported ;
1042- $ exported = $ this ->process ($ data , $ options /*, $ref*/ );
1043- unset($ exported );
1044- }
1037+ if ($ options ->isRef ) {
1038+ $ options ->isRef = false ;
1039+ } else {
1040+ if ('# ' !== $ path && $ refs = $ data ->getFromRefs ()) {
1041+ $ ref = $ refs [0 ];
1042+ if (!array_key_exists ($ ref , $ options ->exportedDefinitions ) && strpos ($ ref , ':// ' ) === false ) {
1043+ $ exported = null ;
1044+ $ options ->exportedDefinitions [$ ref ] = &$ exported ;
1045+ $ options ->isRef = true ;
1046+ $ exported = $ this ->process ($ data , $ options , $ ref );
1047+ unset($ exported );
1048+ }
10451049
1046- for ($ i = 1 ; $ i < count ($ refs ); $ i ++) {
1047- $ ref = $ refs [$ i ];
1048- if (!array_key_exists ($ ref , $ options ->exportedDefinitions )) {
1049- $ exported = new \stdClass ();
1050- $ exported ->{self ::PROP_REF } = $ refs [$ i -1 ];
1051- $ options ->exportedDefinitions [$ ref ] = $ exported ;
1050+ for ($ i = 1 ; $ i < count ($ refs ); $ i ++) {
1051+ $ ref = $ refs [$ i ];
1052+ if (!array_key_exists ($ ref , $ options ->exportedDefinitions ) && strpos ($ ref , ':// ' ) === false ) {
1053+ $ exported = new \stdClass ();
1054+ $ exported ->{self ::PROP_REF } = $ refs [$ i - 1 ];
1055+ $ options ->exportedDefinitions [$ ref ] = $ exported ;
1056+ }
10521057 }
1053- }
10541058
1055- $ result ->{self ::PROP_REF } = $ refs [count ($ refs ) - 1 ];
1056- return $ result ;
1059+ $ result ->{self ::PROP_REF } = $ refs [count ($ refs ) - 1 ];
1060+ return $ result ;
1061+ }
10571062 }
10581063
10591064 if ($ options ->circularReferences ->contains ($ data )) {
0 commit comments