@param string $value
@param array $context

@return bool
495998
public function validateCaptchaResult($value, $context) {
		$captcha = $this->_getCaptcha($context['data']);
		if (!$captcha) {
			return false;
		}
		if ((string)$value !== $captcha->result) {
			return false;
		}

		$this->_captchasTable->markUsed($captcha);
		return true;
	}
623888
public static function execute($value, ContextInterface $context): array
    {
        return is_numeric($value) === true ?
            static::createSuccessReply($value) :
            static::createErrorReply($context, $value, ErrorCodes::IS_NUMERIC, Messages::IS_NUMERIC, []);
    }
113694
public function debug($value, array $context = array())
	{
		// If we were given anything other than a string,
		// we'll get readable format of the value.
		if( ! is_string($value))
		{
			$value = print_r($value, true);
		}

		$this->log(LogLevel::DEBUG, $value, $context);
	}
389529
protected function isMatchAnyInArray($value, $contextValue, $name)
    {
        if (!\is_array($value)) {
            return $this->isMatchScalarInArray($value, $contextValue, $name);
        }

        switch (\key($value)) {
            case self::OPERATOR_NOT:
                return !$this->isMatchScalarInArray(\current($value), $contextValue, $name);
            case self::OPERATOR_AND:
                $result = true;
                foreach (\current($value) as $val) {
                    if (!$this->isMatchScalarWithArray($val, $contextValue, $name)) {
                        $result = false;
                        break;
                    }
                }

                return $result;
            case self::OPERATOR_OR:
                $result = false;
                foreach (\current($value) as $val) {
                    if ($this->isMatchScalarWithArray($val, $contextValue, $name)) {
                        $result = true;
                        break;
                    }
                }

                return $result;
        }

        return false;
    }
351786
public static function execute($value, ContextInterface $context): array
    {
        return $value instanceof DateTimeInterface ?
            static::createSuccessReply($value) :
            static::createErrorReply($context, $value, ErrorCodes::IS_DATE_TIME, Messages::IS_DATE_TIME, []);
    }
1111792
public function isValid($value, array $context = null)
    {
        $this->setValue($value);

        $token = $this->getToken();

        if (!$this->getLiteral() && $context !== null) {
            if (is_array($token)) {
                while (is_array($token)) {
                    $key = key($token);
                    if (!isset($context[$key])) {
                        break;
                    }
                    $context = $context[$key];
                    $token   = $token[$key];
                }
            }

            // if $token is an array it means the above loop didn't went all the way down to the leaf,
            // so the $token structure doesn't match the $context structure
            if (is_array($token) || !isset($context[$token])) {
                $token = $this->getToken();
            } else {
                $token = $context[$token];
            }
        }

        if ($token === null) {
            $this->error(self::MISSING_TOKEN);
            return false;
        }

        $strict = $this->getStrict();
        if (!($strict && ($value !== $token)) || (!$strict && ($value != $token))) {
            $this->error(self::SAME);
            return false;
        }

        return true;
    }
544971
public static function execute($value, ContextInterface $context): array
    {
        // parser guarantees that input will be an array of [$type => $id] where type and id are scalars

        // we will check the type of every pair and send further identities only
        $indexes          = [];
        $foundInvalidType = null;
        $expectedType     = $context->getProperties()->getProperty(static::PROPERTY_RESOURCE_TYPE);
        foreach ($value as $typeAndId) {
            assert(is_array($typeAndId) === true && count($typeAndId) === 1);
            $index = reset($typeAndId);
            $type  = key($typeAndId);
            assert(is_scalar($index) === true && is_scalar($type) === true);
            if ($type === $expectedType) {
                $indexes[] = $index;
            } else {
                $foundInvalidType = $type;
                break;
            }
        }

        $reply = $foundInvalidType === null ?
            static::createSuccessReply($indexes) :
            static::createErrorReply(
                $context,
                $foundInvalidType,
                ErrorCodes::INVALID_RELATIONSHIP_TYPE,
                Messages::INVALID_RELATIONSHIP_TYPE,
                []
            );

        return $reply;
    }
566457
public function validateCount($value, array $context) {
		$maxWorkers = Config::maxworkers();
		if (!$value || !$maxWorkers) {
			return true;
		}

		$currentWorkers = $this->find()->where(['server' => $value])->count();
		if ($currentWorkers >= $maxWorkers) {
			return false;
		}

		return true;
	}
568539
public static function execute($value, ContextInterface $context): array
    {
        $properties = $context->getProperties();

        return static::createErrorReply(
            $context,
            $value,
            $properties->getProperty(self::PROPERTY_ERROR_CODE),
            $properties->getProperty(self::PROPERTY_ERROR_MESSAGE_TEMPLATE),
            $properties->getProperty(self::PROPERTY_ERROR_MESSAGE_PARAMETERS)
        );
    }
1210403
public function isValid($value, $context = null) {
        $frontController = \Zend_Controller_Front::getInstance();
        $request = $frontController->getRequest();
        $value = $request->getParam('g-recaptcha-response');
        if (empty($value)) {
            $this->_error(self::CAPTCHA_EMPTY);
            return false;
        }
        $this->_value = $value;

        if (!$this->_verify($value)) {
            $this->_error(self::INVALID_CAPTCHA);
            return false;
        }

        return true;
    }
1178742
public function validFormat(string $value, array $context): bool
    {
        // one or more letter in upper case
        if ($this->getConfig('upperCase') && !preg_match('/[A-Z]/', $value)) {
            return false;
        }
        // one or more letter in lower case
        if ($this->getConfig('lowerCase') && !preg_match('/[a-z]/', $value)) {
            return false;
        }
        // one or more numeric value
        if ($this->getConfig('numericValue') && !preg_match('/[0-9]/', $value)) {
            return false;
        }
        // one ore more special char (no digit or letter)
        if ($this->getConfig('specialChars') && !preg_match('/[^äüößÄÜÖA-Za-z0-9]/', $value)) {
            return false;
        }

        return true;
    }
1253108
public function set($attributeCode, $value, array $context = null)
    {
        $attribute = $this->getAttribute($attributeCode);

        $method = 'set'.ucfirst($attributeCode);
        if (method_exists($this, $method)) {
            return $this->$method($value, $context);
        }

        if ($attribute->isCollection()) {
            return $this->setValuesData($attribute, $value, $context);
        }

        return $this->setValueData($attribute, $value, $context);
    }
860731
public function isValid($value, $context = null)
    {
        $context = array_change_key_case($context, CASE_LOWER);

        switch ($this->hashAlgorithm) {
            case WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_HMAC_SHA512:
            case WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_SHA512:
                $stringLength = 128;
                break;
            case WirecardCEE_Stdlib_Fingerprint::HASH_ALGORITHM_MD5:
                $stringLength = 32;
                break;
            default:
                throw new WirecardCEE_Stdlib_Exception_UnexpectedValueException(sprintf("Used hash algorithm '%s' is not supported. MD5, SHA512, or HMAC_SHA512 are currently supported.",
                    $this->hashAlgorithm));
                break;
        }

        if (strlen($value) != $stringLength) {
            return false;
        }

        if ($this->fingerprintOrderType == self::TYPE_FIXED) {
            $fingerprintOrder = $this->fingerprintOrder;
        } else {
            if (array_key_exists($this->fingerprintOrderField, $context)) {
                $fingerprintOrder = new WirecardCEE_Stdlib_FingerprintOrder(strtolower($context[$this->fingerprintOrderField]));
            } else {
                $this->_error(self::FINGERPRINTORDER_MISSING);

                return false;
            }
        }

        $fingerprintOrder->setOrder(array_map('strtolower', $this->fingerprintOrder->__toArray()));
        if (!in_array('secret', $fingerprintOrder->__toArray())) {
            throw new WirecardCEE_Stdlib_Exception_UnexpectedValueException();
        }

        $fingerprintFields = Array();
        foreach ($fingerprintOrder as $fingerprintFieldKey) {
            if ($fingerprintFieldKey == 'secret') {
                $fingerprintFields[$fingerprintFieldKey] = $this->secret;
            } else {
                $fingerprintFields[$fingerprintFieldKey] = isset( $context[$fingerprintFieldKey] ) ? $context[$fingerprintFieldKey] : '';
            }
        }

        if (!WirecardCEE_Stdlib_Fingerprint::compare($fingerprintFields, $fingerprintOrder, $value)) {
            $this->_error(self::INVALID);

            return false;
        }

        return true;
    }
531826
public function check($value, array $context = [])
    {
        $count = 0;

        foreach ($context as $field => $value) {
            if (in_array($field, $this->fields)) {
                $count++;
            }
        }

        return ($count === 1);
    }
662223
public function setContext(array $context)
    {
        $this->clearContext();
        foreach ($context as $key => $value) {
            $this->setContextValue($key, $value);
        }
    }
389848
protected function resolveValue($value, Mustache_Context $context)
    {
        if (($this->strictCallables ? is_object($value) : !is_string($value)) && is_callable($value)) {
            return $this->mustache
                ->loadLambda((string) call_user_func($value))
                ->renderInternal($context);
        }

        return $value;
    }
1359754
public static function execute($value, ContextInterface $context): array
    {
        $reply = null;

        $result = [];
        if (is_string($value) === true) {
            $properties = $context->getProperties();
            $delimiter  = $properties->getProperty(static::PROPERTY_DELIMITER);
            $limit      = $properties->getProperty(static::PROPERTY_LIMIT);
            $result     = explode($delimiter, $value, $limit);
        } else {
            $reply = static::createErrorReply($context, $value, ErrorCodes::IS_STRING, Messages::IS_STRING, []);
        }

        return $reply !== null ? $reply : static::createSuccessReply($result);
    }