diff --git a/composer.json b/composer.json index 2637d5b..6db5976 100644 --- a/composer.json +++ b/composer.json @@ -4,10 +4,12 @@ "type": "library", "require": { "php": "^7.0", - "ext-ctype": "*", - "ext-hash": "*", + "ext-dom": "*", "mensbeam/intl": "*" }, + "suggest": { + "ext-ctype": "Improved performance" + }, "scripts": { "post-install-cmd": ["@composer bin all install"], "post-update-cmd": ["@composer bin all update"] @@ -33,10 +35,10 @@ "lib/DOM/traits" ] }, - "classmap": ["lib/Token.php"] + "classmap": ["lib/Token.php"], + "files": ["lib/ctype.php"] }, "autoload-dev": { - "files": ["lib/Token.php"], "psr-4": { "dW\\HTML5\\Test\\": "tests/lib/", "dW\\HTML5\\TestCase\\": "tests/cases/" diff --git a/composer.lock b/composer.lock index 33bd1eb..8a6eb1b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7f73d57a54597e507dfcbd1a6d40b779", + "content-hash": "037fcc961f6e8f68b15379be21f45854", "packages": [ { "name": "mensbeam/intl", @@ -100,8 +100,7 @@ "prefer-lowest": false, "platform": { "php": "^7.0", - "ext-ctype": "*", - "ext-hash": "*" + "ext-dom": "*" }, "platform-dev": [] } diff --git a/lib/ctype.php b/lib/ctype.php new file mode 100644 index 0000000..bcf9343 --- /dev/null +++ b/lib/ctype.php @@ -0,0 +1,30 @@ +true,"b"=>true,"c"=>true,"d"=>true,"e"=>true,"f"=>true,"g"=>true,"h"=>true,"i"=>true,"j"=>true,"k"=>true,"l"=>true,"m"=>true,"n"=>true,"o"=>true,"p"=>true,"q"=>true,"r"=>true,"s"=>true,"t"=>true,"u"=>true,"v"=>true,"w"=>true,"x"=>true,"y"=>true,"z"=>true,"A"=>true,"B"=>true,"C"=>true,"D"=>true,"E"=>true,"F"=>true,"G"=>true,"H"=>true,"I"=>true,"J"=>true,"K"=>true,"L"=>true,"M"=>true,"N"=>true,"O"=>true,"P"=>true,"Q"=>true,"R"=>true,"S"=>true,"T"=>true,"U"=>true,"V"=>true,"W"=>true,"X"=>true,"Y"=>true,"Z"=>true,"0"=>true,"1"=>true,"2"=>true,"3"=>true,"4"=>true,"5"=>true,"6"=>true,"7"=>true,"8"=>true,"9"=>true][$str] ?? false; + } + + function ctype_alpha(string $str): bool { + return ["a"=>true,"b"=>true,"c"=>true,"d"=>true,"e"=>true,"f"=>true,"g"=>true,"h"=>true,"i"=>true,"j"=>true,"k"=>true,"l"=>true,"m"=>true,"n"=>true,"o"=>true,"p"=>true,"q"=>true,"r"=>true,"s"=>true,"t"=>true,"u"=>true,"v"=>true,"w"=>true,"x"=>true,"y"=>true,"z"=>true,"A"=>true,"B"=>true,"C"=>true,"D"=>true,"E"=>true,"F"=>true,"G"=>true,"H"=>true,"I"=>true,"J"=>true,"K"=>true,"L"=>true,"M"=>true,"N"=>true,"O"=>true,"P"=>true,"Q"=>true,"R"=>true,"S"=>true,"T"=>true,"U"=>true,"V"=>true,"W"=>true,"X"=>true,"Y"=>true,"Z"=>true][$str] ?? false; + } + + function ctype_upper(string $str): bool { + return ["A"=>true,"B"=>true,"C"=>true,"D"=>true,"E"=>true,"F"=>true,"G"=>true,"H"=>true,"I"=>true,"J"=>true,"K"=>true,"L"=>true,"M"=>true,"N"=>true,"O"=>true,"P"=>true,"Q"=>true,"R"=>true,"S"=>true,"T"=>true,"U"=>true,"V"=>true,"W"=>true,"X"=>true,"Y"=>true,"Z"=>true][$str] ?? false; + } + + function ctype_digit(string $str): bool { + return ["0"=>true,"1"=>true,"2"=>true,"3"=>true,"4"=>true,"5"=>true,"6"=>true,"7"=>true,"8"=>true,"9"=>true][$str] ?? false; + } + + function ctype_xdigit(string $str): bool { + return ["a"=>true,"b"=>true,"c"=>true,"d"=>true,"e"=>true,"f"=>true,"A"=>true,"B"=>true,"C"=>true,"D"=>true,"E"=>true,"F"=>true,"0"=>true,"1"=>true,"2"=>true,"3"=>true,"4"=>true,"5"=>true,"6"=>true,"7"=>true,"8"=>true,"9"=>true][$str] ?? false; + } +} diff --git a/vendor-bin/phpunit/composer.lock b/vendor-bin/phpunit/composer.lock index 25d6484..5c399b3 100644 --- a/vendor-bin/phpunit/composer.lock +++ b/vendor-bin/phpunit/composer.lock @@ -364,16 +364,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.10.0", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d638ebbb58daba25a6a0dc7969e1358a0e3c6682" + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d638ebbb58daba25a6a0dc7969e1358a0e3c6682", - "reference": "d638ebbb58daba25a6a0dc7969e1358a0e3c6682", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/cbe1df668b3fe136bcc909126a0f529a78d4cbbc", + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc", "shasum": "" }, "require": { @@ -423,7 +423,7 @@ "spy", "stub" ], - "time": "2019-12-17T16:54:23+00:00" + "time": "2019-12-22T21:05:45+00:00" }, { "name": "phpunit/php-code-coverage",