예제 #1
0
 /**
  * @throws \Twig_Error_Loader
  */
 public function testLoad()
 {
     $loader = new JsonLdFrameLoader();
     $loader->addPath(__DIR__ . '/Fixtures', 'namespace');
     $expected = array('@id' => 'http://example.org/test#example');
     // Twig-style
     $this->assertEquals($expected, $loader->load('@namespace/frame.jsonld'));
 }
예제 #2
0
 /**
  * Load the frame.
  * @param string|null $frame
  * @param string|null $parentClass
  * @return array
  */
 protected function loadFrame($frame = null, $type, $includeParentClassFrames)
 {
     // load the frame
     if ($frame) {
         $frame = $this->loader->load($frame, $type, $includeParentClassFrames);
     } else {
         $frame = array();
     }
     // merge context from namespace registry
     $namespaces = $this->nsRegistry->namespaces();
     if (isset($frame['@context'])) {
         $frame['@context'] = array_merge($frame['@context'], $namespaces);
     } else {
         $frame['@context'] = $namespaces;
     }
     return $frame;
 }
예제 #3
0
 /**
  * @param $name
  * @param null $parentClass
  * @param bool $includeSubFrames
  * @param bool $assoc
  * @param bool $getTypeFromFrame
  */
 public function load($name, $type = null, $includeSubFrames = true, $assoc = true, $findTypeInFrames = false)
 {
     $frame = parent::load($name, $type, $includeSubFrames, $assoc, $findTypeInFrames);
     return $this->addMissingProperties($frame);
 }