/* (non-PHPdoc)
@see \CrudGenerator\Generators\Parser\Lexical\ParserInterface::evaluate()
359999
public function evaluate(array $process, PhpStringParser $parser, GeneratorDataObject $generator, $firstIteration)
    {
        if (isset($process['environnement']) === true && is_array($process['environnement']) === true) {
            foreach ($process['environnement'] as $environnementName => $question) {
                if (is_array($question) === false) {
                    throw new MalformedGeneratorException(
                        sprintf('Questions excepts to be an array "%s" given', gettype($question))
                    );
                }

                $generator = $this->evaluateQuestions(
                    $environnementName,
                    $question,
                    $parser,
                    $generator,
                    $firstIteration
                );
            }
        }

        return $generator;
    }
766642
public function evaluate($values)
    {
        $returnValue = (bool) false;

        
		$value = trim($values);
		
		try{
			$dateTime = new DateTime($value);
			
    		// if no date given no need to go further. To check if not empty, use the NotEmpty validator
			if(!empty($value) && !empty($this->getOption('comparator')) && $this->getOption('datetime2_ref') instanceof tao_helpers_form_FormElement){
                
			    //try comparison:
				try{
					$dateTime2 = new DateTime($this->getOption('datetime2_ref')->getRawValue());
				}catch(Exception $e){}
				
				if($dateTime2 instanceof DateTimeInterface){
					
					switch ($this->getOption('comparator')){
						case 'after':
						case 'later':
						case 'sup':
						case '>':{
							if ($dateTime > $dateTime2) {
                                    $returnValue = true;
							} else {
							    $this->setMessage(__('Invalid date range (must be after: %s)',$dateTime2->format('Y-m-d')));
							}
							break;
						}
                        case '>=':{
                            if ($dateTime >= $dateTime2) {
                                $returnValue = true;
                            } else {
                                $this->setMessage(__('Invalid date range (must be after or the same as: %s)',$dateTime2->format('Y-m-d')));
                            }
                            break;
                        }
						case 'before':
						case 'earlier':
						case 'inf':
						case '<':{
							if ($dateTime < $dateTime2) {
								$returnValue = true;
							} else {
							    $this->setMessage(__('Invalid date range (must be before: %s)',$dateTime2->format('Y-m-d')));
							}
							break;
						}
                        case '<=':{
                            if ($dateTime <= $dateTime2) {
                                $returnValue = true;
                            } else {
                                $this->setMessage(__('Invalid date range (must be before or the same as: %s)',$dateTime2->format('Y-m-d')));
                            }
                            break;
                        }
						default:
							throw new common_Exception('Usuported comparator in DateTime Validator: '.$this->getOption('comparator'));
					}
				}
			
			}else{
				$returnValue = true; 
			}
		}catch(Exception $e){
			$this->setMessage(__('The value of this field must be a valide date format, e.g. YYYY-MM-DD'));
			$returnValue = false;
		}
		
        

        return (bool) $returnValue;
    }
332289
protected function evaluateOperator($value, $operator, $operand)
    {
        switch ($operator) {
            case '=':
                return $value === $operand;
            case '!=':
                return $value !== $operand;
            case '<':
                return $value < $operand;
            case '<=':
                return $value <= $operand;
            case '>':
                return $value > $operand;
            case '>=':
                return $value >= $operand;
            case '$=':
                if (is_array($value)) {
                    if ($this->evaluateOperator(end($value), '=', $operand)) {
                        return true;
                    }
                    return false;
                } else {
                    return strrpos($value, (string)$operand) === strlen($value) - strlen($operand);
                }
            case '^=':
                if (is_array($value)) {
                    if ($this->evaluateOperator(reset($value), '=', $operand)) {
                        return true;
                    }
                    return false;
                } else {
                    return strpos($value, (string)$operand) === 0;
                }
            case '*=':
                if (is_array($value)) {
                    foreach ($value as $item) {
                        if ($this->evaluateOperator($item, '=', $operand)) {
                            return true;
                        }
                    }
                    return false;
                } else {
                    return strpos($value, (string)$operand) !== false;
                }
            case 'instanceof':
                if ($this->operandIsSimpleType($operand)) {
                    return $this->handleSimpleTypeOperand($operand, $value);
                } else {
                    return ($value instanceof $operand);
                }
            case '!instanceof':
                if ($this->operandIsSimpleType($operand)) {
                    return !$this->handleSimpleTypeOperand($operand, $value);
                } else {
                    return !($value instanceof $operand);
                }
            default:
                return ($value !== null);
        }
    }
1127462
protected function evaluate($condition)
    {
        if (null === $condition || false === $condition) {
            return false;
        }

        if (!is_string($condition)) {
            return false;
        }

        $condition = trim($condition);

        if (!strlen($condition)) {
            return false;
        }

        $config = $this->getConfig();

        if (0 < preg_match_all('/\$\\{\\s*([a-z0-9_\.]+)\\s*\\}/', $condition, $matches)) {
            foreach ($matches[0] as $i => $match) {
                $v = $config->get($matches[1][$i], null);
                $condition = str_replace($match, null === $v ? '""' : (is_numeric($v) ? $v : ('"'.str_replace('"', '\\"', (string) $v).'"')), $condition);
            }
        }

        $condition = trim($condition);

        if (0 < preg_match_all('/\%\\{\\s*([a-z0-9_]+)\\s*\\}/i', $condition, $matches)) {
            foreach ($matches[0] as $i => $match) {
                $v = getenv($matches[1][$i]);
                switch (true) {
                    case 'false' === ((string) $v):
                        $v = false;
                        break;
                    case 'true' === ((string) $v):
                        $v = true;
                        break;
                    case '1' === ((string) $v):
                        $v = 1;
                        break;
                    case false === $v:
                        $v = null;
                        break;
                    case null === $v:
                        $v = null;
                        break;
                    default:
                        if (!is_numeric($v)) {
                            $v = trim((string) $v);
                        }
                        break;
                }
                $condition = str_replace($match, null === $v ? '""' : (is_numeric($v) ? $v : ('"'.str_replace('"', '\\"', (string) $v).'"')), $condition);
            }
        }

        return $this->getExpressionService()->evaluate($condition, ['cfg' => $config]);
    }
117307
public function evaluate($method, $arguments)
    {
        $this->validate($method, $arguments);
        return $this->evaluator->evaluate($method, $arguments);
    }
325579
public function evaluate()
    {
        $content = $this->getValue();

        /** @var $node NodeInterface */
        $node = $this->fusionValue('node');
        if (!$node instanceof NodeInterface) {
            return $content;
        }

        /** @var $property string */
        $property = $this->fusionValue('property');

        /** @var $contentContext ContentContext */
        $contentContext = $node->getContext();
        if ($contentContext->getWorkspaceName() === 'live') {
            return $content;
        }

        if (!$this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess')) {
            return $content;
        }

        if ($node->isRemoved()) {
            $content = '';
        }
        return $this->contentElementEditableService->wrapContentProperty($node, $property, $content);
    }
1084417
public function evaluate(array $process, PhpStringParser $parser, GeneratorDataObject $generator, $firstIteration)
    {
        if (isset($process['directories']) === true && is_array($process['directories']) === true) {
            foreach ($process['directories'] as $directory) {
                if (is_string($directory) === false) {
                    throw new MalformedGeneratorException(
                        sprintf('Directory excepts to be an string "%s" given', gettype($directory))
                    );
                }

                $generator->addDirectories($directory, $parser->parse($directory));
            }
        }

        return $generator;
    }
588497
public function evaluate($values)
    {
        $returnValue = false;

        $mimeType = '';
        if (is_array($values)) {
            /** @var UploadService $uploadService */
            $uploadService = ServiceManager::getServiceManager()->get(UploadService::SERVICE_ID);
            if ($uploadService->isUploadedFile($values['uploaded_file'])) {
                $file = $uploadService->getUploadedFlyFile($values['uploaded_file']);
                $mimeType = $file->getMimeType();
            } elseif (file_exists($values['uploaded_file'])) {
                common_Logger::w('Deprecated use of uploaded_file');
                $mimeType = tao_helpers_File::getMimeType($values['uploaded_file']);
            }

            if (!empty($mimeType) ) {
                common_Logger::d($mimeType);

                if (in_array($mimeType, $this->getOption('mimetype'))) {
                    $returnValue = true;
                } else {
                    $this->setMessage(__('%1$s expected but %2$s detected', implode(', ', $this->getOption('mimetype')), $mimeType));
                }
            } else {
                common_Logger::i('mimetype empty');
            }
        }


        return $returnValue;
    }
853966
public Object evaluate(Object pContext,
                           VariableResolver pResolver,
                           Map functions,
                           String defaultPrefix,
                           Logger pLogger)
            throws ELException {
        Object value = mExpression.evaluate(pContext, pResolver, functions,
                defaultPrefix, pLogger);
        for (int i = 0; i < mOperators.size(); i++) {
            BinaryOperator operator = (BinaryOperator) mOperators.get(i);

            // For the And/Or operators, we need to coerce to a boolean
            // before testing if we shouldEvaluate
            if (operator.shouldCoerceToBoolean()) {
                value = Coercions.coerceToBoolean(value, pLogger);
            }

            if (operator.shouldEvaluate(value)) {
                Expression expression = (Expression) mExpressions.get(i);
                Object nextValue = expression.evaluate(pContext, pResolver,
                        functions, defaultPrefix,
                        pLogger);

                value = operator.apply(value, nextValue, pContext, pLogger);
            }
        }
        return value;
    }
599009
public function evaluate(array $values, Context $context, Token $token)
    {
        if (count($values) !== $this->getOperands()) {
            throw new ExpressionException('Invalid number of operands for operator.',
              $this, $values);
        }
        $evaluator = $this->evaluator;
        return (string)$evaluator($values, $context, $token);
    }
1153594
public Object evaluate(Object pContext,
                           VariableResolver pResolver,
                           Map functions,
                           String defaultPrefix,
                           Logger pLogger)
            throws ELException {
        return mValue;
    }
691942
public function evaluate()
    {
        $currentContext = $this->runtime->getCurrentContext();
        $this->node = $currentContext['node'];
        $this->documentNode = $currentContext['documentNode'];
        /** @var $parentResponse Response */
        $parentResponse = $this->runtime->getControllerContext()->getResponse();
        $pluginResponse = new ActionResponse($parentResponse);

        $this->dispatcher->dispatch($this->buildPluginRequest(), $pluginResponse);

        foreach ($pluginResponse->getHeaders()->getAll() as $key => $value) {
            $parentResponse->getHeaders()->set($key, $value, true);
        }

        return $pluginResponse->getContent();
    }
1186847
public function evaluate($values)
    {
        $returnValue = (bool) false;
        
		if ($values == intval($values)) {
			$returnValue = parent::evaluate($values);
		} else {
			$returnValue = false;
			$this->setMessage(__('The value of this field must be an integer'));
		}
        

        return (bool) $returnValue;
    }
475601
public function evaluate( Context $context ) {
		/**
		 * Extracts variables.
		 *
		 * @var \Ruler\Variable $left
		 * @var \Ruler\Variable $right
		 */
		list( $left, $right ) = $this->getOperands();

		$left  = $left->prepareValue( $context )->getValue();
		$right = $right->prepareValue( $context )->getValue();

		return in_array( $left, is_array( $right ) ? $right : [ $right ] );
	}
1301251
private function evaluateAll()
    {
        if($this->isEvaluated) {
            return;
        }
        foreach($this->rules as $key => $rule) {
            $this->evaluateAndGet($key);
        }
    }
415921
protected function evalExpression()
    {
        $this->log("Evaluating PHP expression: " . $this->expression, $this->logLevel);
        if (!StringHelper::endsWith(';', trim($this->expression))) {
            $this->expression .= ';';
        }

        if ($this->returnProperty !== null) {
            $retval = null;
            eval('$retval = ' . $this->expression);
            $this->project->setProperty($this->returnProperty, $retval);
        } else {
            eval($this->expression);
        }
    }
1112237
public function evaluate(Context $context)
    {
        /** @var VariableOperand $left */
        /** @var VariableOperand $right */
        list($left, $right) = $this->getOperands();

        $left = $left->prepareValue($context);

        if (is_array($left->getValue())) {
            trigger_error('Contains operator is deprecated, please use SetContains', E_USER_DEPRECATED);

            return $left->getSet()->setContains($right->prepareValue($context));
        } else {
            trigger_error('Contains operator is deprecated, please use StringContains', E_USER_DEPRECATED);

            return $left->stringContains($right->prepareValue($context));
        }
    }