You are here

public function Rectangle::__construct in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Utility/Rectangle.php \Drupal\Component\Utility\Rectangle::__construct()
  2. 9 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\Utility

Code

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");
  }
}