Ensure the current token is not a string and optionally is of the given value.

@param mixed      $value    Optional the value.

@param bool|mixed $expected The expected token type/value or false if unknown which one was expected.

@return void
547953
public function checkIsNotString($value = false, $expected = false)
    {
        if (is_string($this->token) || ($value && ($this->token[0] != $value))) {
            $this->bailUnexpectedToken($expected);
        }
    }
1250224
public function setExpand($value)
    {
        $expand = StringHelper::booleanValue($value);
        if ($expand) {
            $this->flags = str_replace(' --style ' . $this->style, '', $this->flags);
            $this->flags .= ' --style expanded';
            $this->style = 'expanded';
        }
    }
836559
private function check($value) {

		if(true === is_string($value)) {
			
			@json_decode($value);

	 		return true === (json_last_error() == JSON_ERROR_NONE);
	 	}

	 	return false;
	}
461000
static function ensureValue($value)
    {
        if (!self::hasValue($value)) {
            throw new InvalidValueException(sprintf(
                'The value %s is not defined in enum class "%s", known values: %s',
                self::dumpValue($value),
                static::class,
                implode(', ', array_map([static::class, 'dumpValue'], self::getValues()))
            ));
        }
    }
880422
public function setValue($value)
    {
        if (is_array($value)) {
            $value = implode(', ', $value);
        }

        if (!is_null($value)) {
            $this->_value = $value;
            $this->appendChild($value);
        }
    }
317736
function setValue($value)
    {
        $this->setChecked(isset($this->_values[1]) && $value == $this->_values[1]);
        $this->_currentValue = $value;
    }
407938
public function checkRequired($value)
    {
        if (is_null($value)) {
            return false;
        }

        if (is_string($value) && trim($value) === '') {
            return false;
        }

        if ((is_array($value) || $value instanceof Countable) && count($value) < 1) {
            return false;
        }

        return true;
    }
91537
public function consumeAnnotationToken(string $value): void
    {
        if ($this->currentAnnotation === null) {
            // We are not in an annotation, build a new one.
            $this->currentAnnotation = $this->annotationFactory
                ->invoke($value, $this->currentLine);
        } else {
            if ($this->currentAnnotationContent === null) {
                // It is an annotation without content, save it and create the new one.
                $this->parsedAnnotations[] = $this->currentAnnotation;
                $this->reset();
                $this->currentAnnotation = $this->annotationFactory
                    ->invoke($value, $this->currentLine);
            } else {
                // An annotation content parsing is not finished.
                throw new AnnotationParseException(
                    'An annotation content is not closed (you probably forget to close a parenthesis or a quote)'
                );
            }
        }
    }
864359
public function isValid($value, $context = null) {
        $this->_setValue((string) $value);

        $token = $this->getToken();
        $pos = strrpos($token, '[');
        if ($pos !== false) {
            $token = rtrim($token, ']');
            $token = substr($token, $pos+1);
        }

        if (($context !== null) && isset($context) && array_key_exists($token, $context)) {
            $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::NOT_SAME);
            return false;
        }

        return true;
    }
253849
private function check($value) {

		if(true === is_string($value)) {
			return false !== filter_var(trim($value), \FILTER_VALIDATE_EMAIL);
		}

		return false;
	}
779225
private function resolveComponent(&$value)
    {
        if (\is_string($value) && strpos($value, '@') === 0) {
            $value = $this->getComponent(substr($value, 1));
        }
    }
261697
private static function expect($expected, $token)
    {
        if (!in_array($token['type'], $expected)) {
            if (count($expected) === 1) {
                $expectedStr = self::tokenName($expected[0]);
            } else {
                $last = array_pop($expected);
                $expectedStr = 'one of ' . implode(', ', array_map(['self', 'tokenName'], $expected)) . ' or ' . self::tokenName($last);
            }
            $actualStr = self::tokenName($token['type']);
            if ($token['match']) {
                $actualStr .= " ('" . addslashes($token['match']) . "')";
            }
            $actualStr .= ' <<< ' . Json::dump($token) . ' >>> ';
            throw new PermissionParserException("Parser error: expected $expectedStr, but found $actualStr");
        }
    }
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 );
	}
1235249
public function offsetSet($offset, $value)
    {
        if (!$value instanceof Token) {
            throw new \InvalidArgumentException('Value must be of type Token.');
        }

        if ($offset === null) {
            $this->tokens[] = $value;

            return;
        }

        $this->tokens[$offset] = $value;
    }
864250
protected function isValid($value)
    {
        if (is_null($value)) {
            return;
        }

        if (in_array($value, $this->options['values'], true)) {
            return;
        }

        $errorMessage = 'One of %s is expected.';

        if (is_string($value)) {
            $errorMessage .= sprintf(' Got "%s" instead.', $value);
        }

        $this->addError($errorMessage, 1514999090, [json_encode($this->options['values'])]);
    }
1046313
public function setValue($value)
    {
        // special case for boolean values
        if (is_bool($value)) {
            if ($value) {
                $this->_value = "true";
            } else {
                $this->_value = "false";
            }
        } else {
            $this->_value = (string) $value;
        }
    }
556740
protected function isValidCurrency(string $value): void
    {
        $allowedCurrency = $this->getAllowedCurrency();

        $regex = '/^' . implode('|', $allowedCurrency) . '$/';
        if (!preg_match($regex, $value)) {
            throw new InvalidCurrencyException(sprintf(
                '%s is not a valid currency. Currency must be in ISO-4217-3 format.',
                $value
            ));
        }
    }