/** * @throws XMLDatatype\Exception\OutOfBoundsException * @param int $value */ public function setValue($value) { if ($value < -32768 || $value > 32767) { throw new \XMLDatatype\Exception\OutOfBoundsException('Short out of bounds'); } parent::setValue($value); }
/** * @throws XMLDatatype\Exception\OutOfBoundsException * @param int $value */ public function setValue($value) { if ($value < 0 || $value > 65535) { throw new \XMLDatatype\Exception\OutOfBoundsException('UnsignedShort out of bounds'); } parent::setValue($value); }
public function testIntegerProperty() { $min = 1; $max = 100; $validInteger = 5; $toLarge = 102; $toSmall = 0; $property = new Integer('AProperty', null, $min, $max); $property->setValue($validInteger); $this->assertEquals($validInteger, $property->getValue()); $property->setValue($toLarge); $this->assertEquals($max, $property->getValue()); $property->setValue($toSmall); $this->assertEquals($min, $property->getValue()); }
/** * @param mixed $nullOrValue */ protected function setValue($nullOrValue) { if (is_null($nullOrValue)) { $this->value = $nullOrValue; } else { parent::setValue($nullOrValue); } }