示例#1
0
 private function resolveReferences()
 {
     if (!empty($this->references)) {
         foreach (array_keys($this->references) as $ref) {
             $keys = Utils::pathDecode($ref);
             if ($schema = $this->find($this->data, $keys)) {
                 $this->references[$ref] = $schema;
             } else {
                 throw new \RuntimeException('Unable to find ref ' . $ref);
             }
         }
         foreach ($this->references as $ref => $schema) {
             $this->references[$ref] = $this->resolve($schema);
         }
         $this->data = Utils::dataCopy($this->data, array($this, 'resolveCallback'));
         $this->references = array();
     }
 }
示例#2
0
 public function testDecodePathEncoded()
 {
     $value = '/key~01/key~02~1sub';
     $expected = array('key~1', 'key~2/sub');
     $this->assertEquals($expected, Utils::pathDecode($value));
 }