ffmpeg-mappable-media/src/FFMpeg/Format/Dimension.php

63 lines
1.2 KiB
PHP
Raw Normal View History

2012-05-30 15:06:53 +02:00
<?php
/*
* This file is part of PHP-FFmpeg.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FFMpeg\Format;
use FFMpeg\Exception\InvalidArgumentException;
/**
2012-05-30 18:44:09 +02:00
* Dimension object, used for manipulating width and height couples
*
2012-05-30 15:06:53 +02:00
* @author Romain Neutron imprec@gmail.com
*/
class Dimension
{
protected $width;
protected $height;
2012-05-30 18:44:09 +02:00
/**
* Constructor
*
* @param integer $width
* @param integer $height
* @throws InvalidArgumentException when one of the parameteres is invalid
*/
2012-05-30 15:06:53 +02:00
public function __construct($width, $height)
{
if ($width <= 0 || $height <= 0) {
throw InvalidArgumentException('Width and height should be positive integer');
}
$this->width = (int) $width;
$this->height = (int) $height;
}
2012-05-30 18:44:09 +02:00
/**
* Return width
*
* @return width
*/
2012-05-30 15:06:53 +02:00
public function getWidth()
{
return $this->width;
}
2012-05-30 18:44:09 +02:00
/**
* Return height
*
* @return integer
*/
2012-05-30 15:06:53 +02:00
public function getHeight()
{
return $this->height;
}
}