src/JsonLd/Serializer/JsonLdContextTrait.php
private function addJsonLdContext(ContextBuilderInterface $contextBuilder, string $resourceClass, array &$context, array $data = []): array
    {
        if (isset($context['jsonld_has_context'])) {
            return $data;
        }

        $context['jsonld_has_context'] = true;

        if (isset($context['jsonld_embed_context'])) {
            $data['@context'] = $contextBuilder->getResourceContext($resourceClass);

            return $data;
        }

        $data['@context'] = $contextBuilder->getResourceContextUri($resourceClass);

        return $data;
    }
private function addJsonLdContext(ContextBuilderInterface $contextBuilder, string $resourceClass, array &$context, array $data = []): array
    {
        if (isset($context['jsonld_has_context'])) {
            return $data;
        }

        $context['jsonld_has_context'] = true;

        if (isset($context['jsonld_embed_context'])) {
            $data['@context'] = $contextBuilder->getResourceContext($resourceClass);

            return $data;
        }

        $data['@context'] = $contextBuilder->getResourceContextUri($resourceClass);

        return $data;
    }
private function addJsonLdContext ( ContextBuilderInterface $ contextBuilder , string $ resourceClass , array & $ context , array $ data = [ ] ) : array { if ( isset ( $ context [ 'jsonld_has_context' ] ) ) { return $ data ; } $ context [ 'jsonld_has_context' ] = true ; if ( isset ( $ context [ 'jsonld_embed_context' ] ) ) { $ data [ '@context' ] = $ contextBuilder -> getResourceContext ( $ resourceClass ) ; return $ data ; } $ data [ '@context' ] = $ contextBuilder -> getResourceContextUri ( $ resourceClass ) ; return $ data ; }
Updates the given JSON-LD document to add its @context key.
Updates the given JSON - LD document to add its