Author: Elliot Levin (elliotlevin@hotmail.com)
Esempio n. 1
0
 public function __construct(ITypeSystem $typeSystem, O\IEvaluationContext $evaluationContext)
 {
     parent::__construct($typeSystem);
     $this->evaluationContext = $evaluationContext;
     foreach ($evaluationContext->getVariableTable() as $variable => $value) {
         $this->setExpressionType(O\Expression::variable(O\Expression::value($variable)), $typeSystem->getTypeFromValue($value));
     }
 }
Esempio n. 2
0
 protected function getVariableTable(array $customVariableTable = null)
 {
     //Loose equality: order is irrelevant
     if ($customVariableTable !== null && count(array_diff(array_keys($customVariableTable), $this->requiredVariables)) > 0) {
         throw new PinqException('Cannot evaluate expression: supplied variable table is invalid, variable names do not match the required variable names');
     }
     $contextVariableTable = $this->context->getVariableTable() ?: [];
     $customVariableTable = $customVariableTable ?: [];
     return $customVariableTable + $contextVariableTable;
 }