Cake\View\Helper\FormHelper::_getContext PHP Method

_getContext() protected method

If no type can be matched a NullContext will be returned.
protected _getContext ( mixed $data = [] ) : mixed
$data mixed The data to get a context provider for.
return mixed Context provider.
    protected function _getContext($data = [])
    {
        if (isset($this->_context) && empty($data)) {
            return $this->_context;
        }
        $data += ['entity' => null];
        foreach ($this->_contextProviders as $provider) {
            $check = $provider['callable'];
            $context = $check($this->request, $data);
            if ($context) {
                break;
            }
        }
        if (!isset($context)) {
            $context = new NullContext($this->request, $data);
        }
        if (!$context instanceof ContextInterface) {
            throw new RuntimeException('Context objects must implement Cake\\View\\Form\\ContextInterface');
        }
        return $this->_context = $context;
    }