Process a context vocabulary

@param array $context Context
497437
protected function processContext(array $context)
    {
        $prefices        = [];
        $vocabularyCache = Cache::getAdapter()->getItem(self::SLOT_VOCABS);
        $vocabularies    = $vocabularyCache->isHit() ? $vocabularyCache->get() : [];

        // Run through all vocabulary terms
        foreach ($context as $name => $definition) {
            // Skip JSON-LD reserved terms
            if ($this->isReservedTokens($name, $definition)) {
                continue;
            }

            // Process this prefix / vocabulary term
            $this->processPrefixVocabularyTerm($name, $definition, $prefices, $vocabularies);
        }

        $vocabularyCache->set($vocabularies);
        Cache::getAdapter()->save($vocabularyCache);
    }
639737
protected function _setContext($context)
    {
        $this->context = ($context !== null)
            ? $this->_normalizeContainer($context)
            : null;
    }
1067102
public static function toSerializationContext(array $context): SerializationContext
    {
        $ctx = new SerializationContext();

        if (isset($context['groups'])) {
            $ctx->setGroups($context['groups']);
        }

        return $ctx;
    }
43965
protected function getData(array $context)
    {
        $data = [];
        switch ($context['action']) {
            case 'UPDATE':
                $diff = $this->diff($context['old'], $context['new']);
                foreach ($diff as $item) {
                    list($k, $old, $new) = $item;
                    if (isset($context['new'][$k])) {
                        $data[$k] = [$old, $new];
                    }
                }
                break;
            case 'INSERT':
                foreach ($context['new'] as $k => $val) {
                    $data[$k] = [null, $val];
                }
                break;
            case 'DELETE':
                foreach ($context['old'] as $k => $val) {
                    $data[$k] = [$val, null];
                }
                break;
        }

        return $data;
    }
373419
public function render($context)
    {
        if (count($this->class) > 0 && is_array($this->class)) {
            foreach ($this->class as $class) {
                $this->getCell()->addClass($class);
            }
        }
        return $context;
    }
1329085
protected function loadCategories(ContextInterface $context)
    {
        if (\array_key_exists($context->getId(), $this->categories)) {
            return;
        }

        $class = $this->getClass();

        $categories = $this->getObjectManager()->createQuery(sprintf('SELECT c FROM %s c WHERE c.context = :context ORDER BY c.parent ASC', $class))
            ->setParameter('context', $context->getId())
            ->execute();

        if (0 === \count($categories)) {
            // no category, create one for the provided context
            $category = $this->create();
            $category->setName($context->getName());
            $category->setEnabled(true);
            $category->setContext($context);
            $category->setDescription($context->getName());

            $this->save($category);

            $categories = [$category];
        }

        $rootCategories = [];
        foreach ($categories as $pos => $category) {
            if (null === $category->getParent()) {
                $rootCategories[] = $category;
            }

            $this->categories[$context->getId()][$category->getId()] = $category;

            $parent = $category->getParent();

            $category->disableChildrenLazyLoading();

            if ($parent) {
                $parent->addChild($category);
            }
        }

        $this->categories[$context->getId()] = $rootCategories;
    }
150746
public function setContext(RequestContext $context)
    {
        foreach ($this->matchers as $matcher) {
            $matcher->setContext($context);
        }

        $this->context = $context;
    }
583194
public static function normalize(array $context)
    {
        $diff = array_diff_key($context, self::$defaults);
        if (!empty($diff)) {
            $errorMessage = 'unknown index '.implode(', ', array_keys($diff));
            throw new InvalidContext($errorMessage);
        }
        if (!empty($context['namespace'])) {
            if (preg_match('/^\\\\?(.*?)\\\\?$/s', $context['namespace'], $ns)) {
                $context['namespace'] = $ns[1] ? $ns[1].'\\' : null;
            }
        } else {
            $context['namespace'] = null;
        }
        return array_replace(self::$defaults, $context);
    }
1324871
public function addContext(array $context)
    {
        if ($context) {
            $this->context = array_merge($this->context, $context);
        }

        return $this;
    }
636425
public function process($context)
    {
        $contents = $context->getContents();
        $contents = preg_replace_callback('/<\?=((?!\?>).)*\?>/s', function ($match) use ($context) {
            return $context->getPlaceholderContainer()->createPlaceholder($match[0]);
        }, $contents);
        $contents = preg_replace_callback('/<\?php((?!\?>).)*(\?>)?/s', function ($match) use ($context) {
            return $context->getPlaceholderContainer()->createPlaceholder($match[0]);
        }, $contents);

        return $context->setContents($contents);
    }
400232
protected function processPrefix($name, $definition, array &$prefices, array &$vocabularies)
    {
        $prefices[$name] = $definition;

        // Register the vocabulary
        if (!isset($vocabularies[$definition])) {
            $vocabularies[$definition] = [];
        }
    }
962230
public static function handleDynamic(&$context) {
        if ($context['usedFeature']['dynpartial'] == 0) {
            return;
        }

        foreach ($context['partials'] as $name => $code) {
            static::read($context, $name);
        }
    }
669920
public function filter(Context $context)
    {
        $this->index++;
        if(empty($this->m_filters) || $this->index >= count($this->m_filters))
            return;
        $filter=$this->m_filters[$this->index];
        return $filter->filter($context,$this);
    }
1261748
public function setContextLocale($context, $locale)
    {
        if (isset($this->contextLocales[$context]) && $this->contextLocales[$context] == $locale) {
            return;
        }
        $this->contextLocales[$context] = $locale;
        if ($context === $this->activeContext) {
            $this->currentLocaleChanged($locale);
        }
    }
993480
protected function setContext($context = null)
    {
        if ($context) {
            $this->context = new LogContext($this->parser, $context);
        }
    }
245369
private function getExtraWithContextMerged(array $context = [])
    {
        $extra = $this->getExtra();
        if (!empty($context)) {
            $extra = array_merge($extra, $context);
        }

        return $extra;
    }
189588
public function runFilter( array $context )
    {
        foreach ( $context as $element )
        {
            $element->translation = self::leetify( $element->translation );
        }
    }