<?php
 abstract class vB_dB_Type_UInt extends vB_dB_Type { protected $value; public static function instance($value) : self { return parent::getInstance('UInt', $value); } public function __construct($value) { if (!is_numeric($value) AND !self::is_hex($value)) { throw new vB_Exception_Assertor('error_x', ['Invalid value for vB_dB_Type_UInt constructor. Value must be numeric (hex notation allowed).']); } $this->value = strval($value); } private static function is_hex($string) { if (empty($string) OR strpos($string, '0x') !== 0) { return false; } $string = substr($string, 2); if (function_exists('ctype_xdigit')) { return ctype_xdigit($string); } else { return (preg_match( '/[^0-9a-fA-F]/', $string) === 0); } } } 