/** * @param $field * @param $context * * @return array * @throws \RuntimeException */ protected function resolveContext($field, $context) { $result = null; if ($context instanceof ContextInterface) { $result = array($field, $context); } else { if (is_string($field) && is_string($context)) { $result = array($field, new ValueContext($context, $this->factory->getPropertyAccessEngine())); } else { if (is_numeric($field) && is_string($context)) { $result = array($context, new ValueContext($context, $this->factory->getPropertyAccessEngine())); } else { throw new \RuntimeException('Can not determine context'); } } } return $result; }
/** * @param $accessor * * @return UnwindArrayContext */ public function unwindArray($accessor) { $context = new UnwindArrayContext($accessor, $this->factory->getPropertyAccessEngine()); return $context; }