protected function setAndVerify($value, $interval) { if (!filter_var($value, FILTER_VALIDATE_INT) && $value != '0') { throw new InvalidArgumentException(sprintf("The %s should be an integer.", $interval)); } $this->{$interval} = $value; }