/** * Create a new expression context factory, passing an existing factory instance will register all resolvers / functions with the new factory. * * @param ExpressionContextFactoryInterface $factory */ public function __construct(ExpressionContextFactoryInterface $factory = NULL) { if ($factory === NULL) { $this->resolvers = new ExpressionResolverCache(); } else { $this->defaultAccessPolicy = $factory->getDefaultAccessPolicy(); $this->resolvers = clone $factory->getResolvers(); } }
/** * Create a new expression context wrapping the given data. * * @param ExpressionContextFactoryInterface $factory The context factory being used. * @param string $data The data to be wrapped by this context. * @param mixed $bind Bound scope being used during member access. */ public function __construct(ExpressionContextFactoryInterface $factory, $data = NULL) { $this->factory = $factory; $this->resolvers = $factory->getResolvers(); $this->data = $data === NULL ? [] : $data; }