1<?php
2
3namespace Facebook\WebDriver;
4
5/**
6 * Represent a dimension.
7 */
8class WebDriverDimension
9{
10    /**
11     * @var int|float
12     */
13    private $height;
14    /**
15     * @var int|float
16     */
17    private $width;
18
19    /**
20     * @param int|float $width
21     * @param int|float $height
22     */
23    public function __construct($width, $height)
24    {
25        $this->width = $width;
26        $this->height = $height;
27    }
28
29    /**
30     * Get the height.
31     *
32     * @return int The height.
33     */
34    public function getHeight()
35    {
36        return (int) $this->height;
37    }
38
39    /**
40     * Get the width.
41     *
42     * @return int The width.
43     */
44    public function getWidth()
45    {
46        return (int) $this->width;
47    }
48
49    /**
50     * Check whether the given dimension is the same as the instance.
51     *
52     * @param WebDriverDimension $dimension The dimension to be compared with.
53     * @return bool Whether the height and the width are the same as the instance.
54     */
55    public function equals(self $dimension)
56    {
57        return $this->height === $dimension->getHeight() && $this->width === $dimension->getWidth();
58    }
59}
60