function Rectangle::__construct
Same name in other branches
- 9 core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::__construct()
- 8.9.x core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::__construct()
- 10 core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::__construct()
Constructs a new Rectangle object.
Parameters
int $width: The width of the rectangle.
int $height: The height of the rectangle.
File
-
core/
lib/ Drupal/ Component/ Utility/ Rectangle.php, line 63
Class
- Rectangle
- Rectangle rotation algebra class.
Namespace
Drupal\Component\UtilityCode
public function __construct($width, $height) {
if ($width > 0 && $height > 0) {
$this->width = $width;
$this->height = $height;
$this->boundingWidth = $width;
$this->boundingHeight = $height;
}
else {
throw new \InvalidArgumentException("Invalid dimensions ({$width}x{$height}) specified for a Rectangle object");
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.