for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* Grandstream-XMLApp
*
* Copyright (c) 2017 pudelek.org.pl
* @license MIT License (MIT)
* For the full copyright and license information, please view source file
* that is bundled with this package in the file LICENSE
* @author Marcin Pudełek <[email protected]>
*/
namespace mrcnpdlk\Grandstream\XMLApp\Helper;
* Class Rectangle
* @package mrcnpdlk\Grandstream\XMLApp\Helper
class Rectangle
{
* @var int
private $iWidth;
private $iHeight;
* Rectangle constructor.
* @param int $w
* @param int|null $h
public function __construct(int $w, int $h = null)
$this->iWidth = $w < 0 ? 0 : $w;
$this->iHeight = $h < 0 ? 0 : ($h ?? $this->iWidth);
}
* @return int
public function getArea()
return $this->getHeight() * $this->getWidth();
public function getHeight()
return $this->iHeight;
public function getWidth()
return $this->iWidth;