/** * @dataProvider isXhtmlLengthProvider * * @param mixed $input * @param boolean $expected */ public function testIsXhtmlLength($input, $expected) { $this->assertSame($expected, Format::isXhtmlLength($input)); }
/** * Set the width attribute. A negative (< 0) value for $width means there * is no width indicated. * * @param integer $width An integer (pixels) or a string (percentage). * @throws InvalidArgumentException If $width is not an integer value. */ public function setWidth($width) { if (is_int($width) && $width === -1 || Format::isXhtmlLength($width) === true) { $this->width = $width; } else { $msg = "The 'width' argument must be a valid XHTML length value, '" . $width . "' given."; throw new InvalidArgumentException($msg); } }