Match a value against expected docblock comment
@param mixed  $value
@param string $expectedString
@return bool
779851
protected function __isValueMatchAsExpected($value, $expectedString)
    {
        $match = false;

        if ($expectedString === null)
            ## undefined expected values must not be NULL
            ## except when it write down on docblock "@return void"
            return $value === null;

        $valueType = strtolower(gettype($value));

        /**
         * @return string|null|object|\Stdclass|void
         */
        $expectedString = explode('|', $expectedString);
        foreach($expectedString as $ext) {
            $ext = strtolower(trim($ext));
            if ($ext == '') continue;

            if ($value === VOID && $ext == 'void')
                $match = true;
            elseif ($valueType === $ext && $value != null)
                $match = true;
            elseif ($valueType === 'object') {
                if (is_a($value, $ext))
                    $match = true;
            }

            if ($match) break;
        }

        return $match;
    }
1009261
protected function checkStringValue($value)
    {
        if (is_string($value)) {
            $pos = strpos($value, '=');
            if ($pos === 0) {
                // expression
                return self::STRING_IS_EXPRESSION;
            } elseif ($pos === 1 && $value[0] === '\\') {
                // the backslash (\) at the begin of the array key should be removed
                return self::STRING_IS_EXPRESSION_STARTED_WITH_BACKSLASH;
            }
        }

        // regular string
        return self::STRING_IS_REGULAR;
    }
538303
private function requestHeadersMatchExpectation(ServerRequestInterface $httpRequest, Request $expectedRequest)
    {
        foreach ($expectedRequest->getHeaders() as $header => $headerCondition) {
            $inputSource = $this->inputSourceFactory->createFromConfig([
                'header' => $header,
            ]);
            $matcher = $this->matcherFactory->createFromConfig([
                $headerCondition->getMatcher() => $headerCondition->getValue(),
            ]);

            if (!$this->evaluate($inputSource, $matcher, $httpRequest)) {
                return false;
            }
        }

        return true;
    }
306682
private function syntaxError( $expected, $token = null )
	{
		if ( $token === null )
			$token = $this->lexer->lookahead;

		$message = sprintf( 'Expected %s, got ', $expected );
		$message .= ( $this->lexer->lookahead === null ) ? 'end of string' : sprintf( "'%s' at position %s", $token['value'], $token['position'] );

		if ( strlen( $this->context ) )
			$message .= ' in ' . $this->context;

		$message .= '.';

		throw AnnotationException::syntaxError( $message );
	}
3403
protected function isExpected($value)
    {
        if ($expected = $this->getValue()) {
            $this->setActualValue($value);

            return $this->getActualValue() === $expected;
        }

        return true;
    }
471562
protected function matchType($value, &$filtered)
    {
        $o = $this->options;
        $min = $o['min_range'] ?? null;
        $max = $o['max_range'] ?? null;
        $strict = !($o['unstrict'] ?? false);

        switch ($this->type)
        {
            case Type::BOOL:
                if ($strict && !is_bool($value))
                    return false;
                $filtered = WF::parse_bool($value);
                return true;
            case Type::NUMERIC:
                if (!is_numeric($value))
                    return false;
                $filtered = WF::is_int_val($value) ? (int)$value : (float)$value;
                return $this->numRangeCheck($filtered, $min, $max);
            case Type::FLOAT:
                if ($strict && !is_float($value) && !is_int($value))
                    return false;
                $filtered = filter_var($value, FILTER_VALIDATE_FLOAT);
                return ($filtered !== false) && $this->numRangeCheck($filtered, $min, $max);
            case Type::INT:
                if (!is_int($value) && ($strict || !WF::is_int_val($value)))
                    return false;
                $filtered = (int)$value;
                return $this->numRangeCheck($filtered, $min, $max);
            case Type::STRING:
                if (!is_string($value) && ($strict || !is_scalar($value)))
                    return false;
                $filtered = (string)$value;
                if ($min !== null && strlen($value) < $min)
                    return false;
                if ($max !== null && strlen($value) > $max)
                    return false;
                if (isset($o['regex']) && !preg_match($o['regex'], $value))
                    return false;
                return true;
            case Type::SCALAR:
                return is_scalar($value);
            case Type::RESOURCE:
                return is_resource($value);
            case Type::DATE:
                // Attempt conversion
                if ($value instanceof \IntlCalendar)
                {
                    $value = $value->toDateTime();
                    $filtered = $value;
                }

                if (!($value instanceof \DateTimeInterface))
                {
                    if (!$strict && is_string($value) && !empty($value))
                    {
                        try
                        {
                            $value = new \DateTime($value);
                        }
                        catch (\Exception $e)
                        {
                            return false;
                        }
                    }
                    else
                        return false;

                    $filtered = $value;
                }

                if ($min instanceof \DateTimeInterface && $value < $min)
                    return false;
                if ($max instanceof \DateTimeInterface && $value > $max)
                    return false;
                return true;
            case Type::ARRAY:
                if (!WF::is_array_like($value))
                    return false;
                $filtered = WF::to_array($value);
                return true;
            case Validator::VALIDATE_FILTER:
                $ft = $o['filter'];
                unset($o['filter']);
                if ($ft === FILTER_VALIDATE_BOOLEAN)
                    $o['flags'] = FILTER_NULL_ON_FAILURE;

                $filtered = filter_var($value, $ft, $o);
                if ($ft === FILTER_VALIDATE_BOOLEAN)
                    return !($filtered === null);
                return $filtered !== false;
            case Type::OBJECT:
                if (!is_object($value))
                    return false;

                // Class, subclass or interface?
                if (isset($o['instanceof']) && !is_a($value, $o['instanceof']))
                    return false;

                // Specific class?
                if (isset($o['class']) && get_class($value) !== $o['class'])
                    return false;

                return true;
            default:
                // @codeCoverageIgnoreStart
                return false;
                // @codeCoverageIgnoreEnd
        }
    }
769856
public function hiddenFieldValueEquals($field, $value)
    {
        $node = $this->findHiddenField($field);
        $actual = $node->getValue();
        $regex = '/^' . preg_quote($value, '/') . '/ui';

        if (!preg_match($regex, $actual)) {
            $message = sprintf('The hidden field "%s" value is "%s", but "%s" expected.', $field, $actual, $value);

            throw new ExpectationException($message, $this->getSession());
        }
    }
1316769
protected function _parseBindValue($value, $preservedStrLength)
    {
        if (is_string($value)) {
            $quoted = $this->_quote($value);
            if ($preservedStrLength > 0 && strlen($quoted) >= $preservedStrLength) {
                return substr($quoted, 0, $preservedStrLength) . '...';
            } else {
                return $quoted;
            }
        } elseif (is_int($value)) {
            return $value;
        } elseif ($value === null) {
            return 'NULL';
        } elseif (is_bool($value)) {
            return (int)$value;
        } else {
            return $value;
        }
    }
33846
public function checkPlain($value)
    {
        if (!Type::isStringable($value)) {
            return false;
        }

        $string = "$value";

        return $string == strip_tags($string);
    }
353656
public function checkHtml($value)
    {
        if (!Type::isStringLike($value)) {
            return false;
        }

        $string = "$value";

        return $string != strip_tags($string);
    }
617038
protected function containsBadComments($value)
    {
        foreach (token_get_all($value) as $token) {
            if (!is_array($token) || !isset($token[0]) || $token[0] !== T_COMMENT) {
                continue;
            }

            if (substr($token[1], 0, 2) === '//') {
                return true;
            }
        }

        return false;
    }
862006
public boolean textContains(String value, String expectedSubstring) {
        boolean result = false;
        if (value != null) {
            result = value.contains(expectedSubstring);
        }
        return result;
    }
78323
public static function match($value, $expect, $strict = true)
    {
        if ($strict) {
            if (!array_search((string)$expect, (new static)->getConstList())) {
                return false;
            }
        }

        return (string)$value === (string)$expect;
    }
504136
public function check($value, array $context = [])
    {
        $hound = new TypeHound($value);

        return $this->expectedType === $hound->resolve();
    }
994773
function match(value) {
        var token = lookahead();
        return token.type === Token.Punctuator && token.value === value;
    }
1108836
public function transform($value)
    {
        if (null === $value) {
            return null;
        }

        if (!is_string($value)) {
            throw new UnexpectedTypeException($value, 'string');
        }

        return true;
    }
689070
public function match($document, $field, $operator, $value)
    {
        $d_value = $document->{$field};
        switch (true)
        {
            case ($operator === '=' && $d_value == $value):
                return true;
            case ($operator === '==' && $d_value == $value):
                return true;
            case ($operator === '===' && $d_value === $value):
                return true;
            case ($operator === '!=' && $d_value != $value):
                return true;
            case ($operator === '!==' && $d_value !== $value):
                return true;
            case (strtoupper($operator) === 'NOT' && $d_value != $value):
                return true;
            case ($operator === '>'  && $d_value >  $value):
                return true;
            case ($operator === '>=' && $d_value >= $value):
                return true;
            case ($operator === '<'  && $d_value <  $value):
                return true;
            case ($operator === '<=' && $d_value <= $value):
                return true;
            case (strtoupper($operator) === 'LIKE' && preg_match('/'.$value.'/is',$d_value)):
                return true;
            case (strtoupper($operator) === 'NOT LIKE' && !preg_match('/'.$value.'/is',$d_value)):
                return true;
            case (strtoupper($operator) === 'IN' && in_array($d_value, (array) $value)):
                return true;
            case (strtoupper($operator) === 'IN' && in_array($value, (array) $d_value)):
                return true;
            case (strtoupper($operator) === 'REGEX' && preg_match($value, $d_value)):
                return true;
            default:
                return false;
        }
    }