예제 #1
0
 /**
  * @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;
 }
예제 #2
0
 /**
  * @param $accessor
  *
  * @return UnwindArrayContext
  */
 public function unwindArray($accessor)
 {
     $context = new UnwindArrayContext($accessor, $this->factory->getPropertyAccessEngine());
     return $context;
 }