scratch – Blame information for rev 122
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
120 | office | 1 | <?php |
2 | |||
3 | /* |
||
4 | * This file is part of PHP-FFmpeg. |
||
5 | * |
||
6 | * (c) Alchemy <info@alchemy.fr> |
||
7 | * |
||
8 | * For the full copyright and license information, please view the LICENSE |
||
9 | * file that was distributed with this source code. |
||
10 | */ |
||
11 | |||
12 | namespace FFMpeg\Coordinate; |
||
13 | |||
14 | use FFMpeg\Exception\InvalidArgumentException; |
||
15 | |||
16 | /** |
||
17 | * Dimension object, used for manipulating width and height couples |
||
18 | */ |
||
19 | class Dimension |
||
20 | { |
||
21 | private $width; |
||
22 | private $height; |
||
23 | |||
24 | /** |
||
25 | * @param integer $width |
||
26 | * @param integer $height |
||
27 | * |
||
28 | * @throws InvalidArgumentException when one of the parameteres is invalid |
||
29 | */ |
||
30 | public function __construct($width, $height) |
||
31 | { |
||
32 | if ($width <= 0 || $height <= 0) { |
||
33 | throw new InvalidArgumentException('Width and height should be positive integer'); |
||
34 | } |
||
35 | |||
36 | $this->width = (int) $width; |
||
37 | $this->height = (int) $height; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * Returns width. |
||
42 | * |
||
43 | * @return integer |
||
44 | */ |
||
45 | public function getWidth() |
||
46 | { |
||
47 | return $this->width; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * Returns height. |
||
52 | * |
||
53 | * @return integer |
||
54 | */ |
||
55 | public function getHeight() |
||
56 | { |
||
57 | return $this->height; |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Returns the ratio. |
||
62 | * |
||
63 | * @param type $forceStandards Whether or not force the use of standards ratios; |
||
64 | * |
||
65 | * @return AspectRatio |
||
66 | */ |
||
67 | public function getRatio($forceStandards = true) |
||
68 | { |
||
69 | return AspectRatio::create($this, $forceStandards); |
||
70 | } |
||
71 | } |