/** * @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')); }
/** * 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; }
/** * @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); }