/**
* Method to sanitize a height value.
*
* @param mixed $height The input height value to sanitize.
* @param mixed $width The input width value for reference.
*
* @return integer
*
* @since 2.5.0
*/
protected function sanitizeHeight($height, $width)
{
// If no height was given we will assume it is a square and use the width.
$height = $height === null ? $width : $height;
// If we were given a percentage, calculate the integer value.
if (preg_match('/^[0-9]+(\\.[0-9]+)?\\%$/', $height)) {
$height = (int) round($this->getHeight() * (float) str_replace('%', '', $height) / 100);
} else {
// Else do some rounding so we come out with a sane integer value.
$height = (int) round((float) $height);
}
return $height;
}