22declare(strict_types=1);
24namespace pocketmine\nbt\tag;
27use
function func_num_args;
32trait IntegerishTagTrait{
34 abstract protected function min() : int;
36 abstract protected function max() : int;
41 public function __construct(
int $value){
42 if(func_num_args() > 1){
43 throw new \ArgumentCountError(__METHOD__ .
"() expects at most 1 parameters, " . func_num_args() .
" given");
45 if($value < $this->min() or $value > $this->max()){
46 throw new InvalidTagValueException(
"Value $value is outside the allowed range " . $this->min() .
" - " . $this->max());
48 $this->value = $value;
51 public function getValue() : int{
55 protected function stringifyValue(
int $indentation) : string{
56 return (string) $this->value;