function Resource::setDimensions
Sets the dimensions.
Parameters
int|null $width: The width of the resource.
int|null $height: The height of the resource.
Throws
\InvalidArgumentException If either $width or $height are not numbers greater than zero.
File
-
core/
modules/ media/ src/ OEmbed/ Resource.php, line 521
Class
- Resource
- Value object representing an oEmbed resource.
Namespace
Drupal\media\OEmbedCode
protected function setDimensions($width, $height) {
if (isset($width) && $width <= 0 || isset($height) && $height <= 0) {
throw new \InvalidArgumentException('The dimensions must be NULL or numbers greater than zero.');
}
$this->width = isset($width) ? (int) $width : NULL;
$this->height = isset($height) ? (int) $height : NULL;
}