Item: restrict bounds of count to 0-255

This commit is contained in:
Dylan K. Taylor
2020-02-23 17:23:53 +00:00
parent 46ac4cbca1
commit 10317527e4
2 changed files with 18 additions and 0 deletions

View File

@ -557,6 +557,10 @@ class Item implements ItemIds, \JsonSerializable{
* @return $this
*/
public function setCount(int $count) : Item{
if($count < 0 or $count > 255){
throw new \InvalidArgumentException("Count must be in the range 0-255");
}
$this->count = $count;
return $this;