Created
August 7, 2020 18:47
-
-
Save PJZ9n/f3d5944205f99966da5e5dd180ba3cfd to your computer and use it in GitHub Desktop.
有効なアイテムIDがチェックする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param int $id | |
* | |
* @throws InvalidArgumentException | |
*/ | |
public static function validateItemId(int $id): void | |
{ | |
if ($id < -0x8000 or $id > 0x7fff) { //signed short range | |
throw new InvalidArgumentException("ID must be in range " . -0x8000 . " - " . 0x7fff); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment