Programming Language PHP

Namespace Oro\Component\Layout

Class ContextInterface

Method/Function remove

Total Examples 1

1 code examples of PHP Oro\Component\Layout\ContextInterface::remove extracted from open source projects

Was this example useful?
0
                                                    /**
     * @inheritdoc
     */
    public function configureContext(ContextInterface $context)
    {
        if (!$context->has('data')) {
            return;
        }
        $data = $context->get('data');
        if (!is_array($data)) {
            return;
        }

        foreach ($data as $key => $val) {
            if (!is_string($key)) {
                throw new \InvalidArgumentException(
                    sprintf('The data key "%s" must be a string, but "%s" given.', $key, gettype($key))
                );
            }
            if (is_array($val)) {
                $context->data()->set($key, $this->getData($key, $val));
            } else {
                $context->data()->set($key, $val);
            }
        }

        $context->remove('data');
    }
                                            
ContextInterface's Other Methods