Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Rectangle.php

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal