Checks if value is a UUID

@param mixed $value The value

@return bool
551497
public static function isUuid($value): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        // http://tools.ietf.org/html/rfc4122
        //
        // UUID                   = time-low "-" time-mid "-"
        //                          time-high-and-version "-"
        //                          clock-seq-and-reserved
        //                          clock-seq-low "-" node
        // time-low               = 4hexOctet
        // time-mid               = 2hexOctet
        // time-high-and-version  = 2hexOctet
        // clock-seq-and-reserved = hexOctet
        // clock-seq-low          = hexOctet
        // node                   = 6hexOctet
        // hexOctet               = hexDigit hexDigit
        // hexDigit =
        //       "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" /
        //       "a" / "b" / "c" / "d" / "e" / "f" /
        //       "A" / "B" / "C" / "D" / "E" / "F"
        $pattern = sprintf(
            '/\A%s-%s-%s-%s%s-%s\z/i',
            '[a-f0-9]{8}',
            '[a-f0-9]{4}',
            '[a-f0-9]{4}',
            '[a-f0-9]{2}',
            '[a-f0-9]{2}',
            '[a-f0-9]{12}'
        );

        $value = str_replace(['urn:', 'uuid:', '{', '}'], '', (string) $value);

        return !!preg_match($pattern, $value);
    }
1060467
public function isValueValid($value) {
		return $value instanceof Type\ListItemType || $value instanceof DataType\TextType || $value instanceof Type\ThingType;
	}
142546
public static function isValid($value)
    {
        if (is_string($value)) {
            $value = [ $value ];
        }
        
        if (!is_array($value) || count($value) === 0) {
            return false;
        }

        foreach ($value as $ep) {
            if (!is_string($ep)) {
                return false;
            }
            $type = self::getType($ep);

            if ($type === null) {
                return false;
            }
        }
        return true;
    }
1028420
final public static function fromString(string $value)
    {
        try {
            $uuid = Uuid::fromString((new Hashids())->decodeHex($value));
        } catch (InvalidUuidStringException $exception) {
            throw new InvalidIdentityException(
                \sprintf('Provided identity value "%s" is not a valid hashed UUID', $value),
                0,
                $exception
            );
        }

        if ($uuid->getVariant() !== Uuid::RFC_4122 || !\in_array($uuid->getVersion(), \range(1, 5), true)) {
            throw new InvalidIdentityException(
                \sprintf('Provided identity value "%s" is not a valid hashed UUID', $value)
            );
        }

        return new static($value);
    }
1213362
public static function IsDerivedSubtype( $value )
	{
		if ( $value instanceof Integer )
	        return true;

	    switch ( Type::FromValue( $value )->getTypeCode() )
	    {
	        case TypeCode::SByte:
	        case TypeCode::Int16:
	        case TypeCode::Int32:
	        case TypeCode::Int64:
	        case TypeCode::Byte:
	        case TypeCode::UInt16:
	        case TypeCode::UInt32:
	        case TypeCode::UInt64:
	            return true;

	        default:
	            return false;
	    }
	}
1110443
public static function isIban($value)
    {
        // build replacement arrays
        $iban_replace_chars = range('A', 'Z');
        foreach (range(10, 35) as $tempvalue) {
            $iban_replace_values[] = strval($tempvalue);
        }

        // prepare string
        $tempiban = strtoupper($value);
        $tempiban = str_replace(' ', '', $tempiban);

        // check iban length
        if (self::getIbanLength($tempiban) != strlen($tempiban)) {
            return false;
        }

        // build checksum
        $tempiban = substr($tempiban, 4).substr($tempiban, 0, 4);
        $tempiban = str_replace($iban_replace_chars, $iban_replace_values, $tempiban);
        $tempcheckvalue = intval(substr($tempiban, 0, 1));

        for ($strcounter = 1; $strcounter < strlen($tempiban); $strcounter++) {
            $tempcheckvalue *= 10;
            $tempcheckvalue += intval(substr($tempiban,$strcounter,1));
            $tempcheckvalue %= 97;
        }

        // only modulo 1 is iban
        return $tempcheckvalue == 1;
    }
432556
public static function validate(string $uuid): bool
	{
		$uuid = str_replace(['urn:uuid:', '{', '}'], '', $uuid);

		return (bool) preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i', $uuid);
	}
1193963
public function isValid($value)
    {
        $valueString = (string) $value;

        $this->_setValue($valueString);

        if ('' === $valueString) {
            $this->_error(self::STRING_EMPTY);
            return false;
        }

        if (null === self::$_filter) {
            /**
             * @see Zend_Filter_Digits
             */
            require_once 'Zend/Filter/Digits.php';
            self::$_filter = new Zend_Filter_Digits();
        }

        if ($valueString !== self::$_filter->filter($valueString)) {
            $this->_error(self::NOT_DIGITS);
            return false;
        }

        return true;
    }
527291
public function isValid($value) : bool
    {
        if ($value === null && $this->nullable) {
            return true;
        }

        return $value instanceof \DateTimeImmutable;
    }
620762
public function isValueValid($value) {
		return $value instanceof Type\Product || $value instanceof DataType\TextType || $value instanceof DataType\URLType;
	}
758628
public function verify($value) {
        if (!Factory::session()->has(self::SESSION_KEY)) {
            return false;
        }
        $data = Factory::session()->get(self::SESSION_KEY);
        if (!$data['sensitive'] && !is_numeric($value)) {
            $value = strtolower($value);
        }
        Factory::session()->delete(self::SESSION_KEY);
        return Hash::verify($value, $data['key']);
    }
33846
public function checkPlain($value)
    {
        if (!Type::isStringable($value)) {
            return false;
        }

        $string = "$value";

        return $string == strip_tags($string);
    }
425589
public static function isUrn($value): bool
    {
        if (!static::isStringCastable($value)) {
            return false;
        }

        // http://tools.ietf.org/html/rfc2141#section-2.1
        // To avoid confusion with the "urn:" identifier, the NID "urn" is
        // reserved and MUST NOT be used
        if (substr((string) $value, 0, 8) === "urn:urn:") {
            return false;
        }

        // http://tools.ietf.org/html/rfc2141
        //
        // <URN> ::= "urn:" <NID> ":" <NSS>
        //
        // <NID> ::= <let-num> [ 1,31<let-num-hyp> ]
        // <let-num-hyp> ::= <upper> | <lower> | <number> | "-"
        // <let-num>     ::= <upper> | <lower> | <number>
        // <upper>       ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" |
        //                   "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" |
        //                   "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" |
        //                   "Y" | "Z"
        // <lower>       ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" |
        //                   "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" |
        //                   "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" |
        //                   "y" | "z"
        // <number>      ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
        //                   "8" | "9"
        //
        // <NSS>         ::= 1*<URN chars>
        // <URN chars>   ::= <trans> | "%" <hex> <hex>
        // <trans>       ::= <upper> | <lower> | <number> | <other> | <reserved>
        // <hex>         ::= <number> | "A" | "B" | "C" | "D" | "E" | "F" |
        //                   "a" | "b" | "c" | "d" | "e" | "f"
        // <other>       ::= "(" | ")" | "+" | "," | "-" | "." |
        //                   ":" | "=" | "@" | ";" | "$" |
        //                   "_" | "!" | "*" | "'"
        //
        // Therefore, these characters are RESERVED for future developments.
        // Namespace developers SHOULD NOT use these characters in unencoded
        // form, but rather use the appropriate %-encoding for each character.
        //
        // In addition, octet 0 (0 hex) should NEVER be used, in either
        // unencoded or %-encoded form.
        $pattern = sprintf(
            '/\Aurn:%s:%s\z/i',
            '[a-z0-9](?:[a-z0-9\-]{1,31})?',
            '(?:[a-z0-9()+,\-.:=@;$_!*\']|%(?:0[a-f1-9]|[a-f1-9][a-f0-9]))+'
        );

        return !!preg_match($pattern, (string) $value);
    }
1280346
public function isValueValid($value) {
		return $value instanceof Type\ProductType || $value instanceof DataType\TextType || $value instanceof DataType\URLType;
	}
96204
public function isValueValid($value) {
		return $value instanceof DataType\NumberType || $value instanceof Type\QuantitativeValue || $value instanceof DataType\TextType;
	}
1088421
protected function isValid($value)
    {
        if (!is_string($value) || !preg_match(self::PATTERN_MATCH_UUID, $value)) {
            $this->addError('The given subject was not a valid UUID.', 1221565853);
        }
    }
1083955
private function uuidTextToBin($value)
	{
		// Multiple files
		if (substr($value, 0, 2) === 'a:') {
			return serialize(array_map(function($value) {
				if (strlen($value) === 36) {
					$value = \StringUtil::uuidToBin($value);
				}
				return $value;
			}, \StringUtil::deserialize($value)));
		}
		// Single file
		if (strlen($value) === 36) {
			return \StringUtil::uuidToBin($value);
		}

		return $value;
	}