mirror of
https://github.com/Intervention/image.git
synced 2025-08-26 15:24:37 +02:00
Rename method
- SizeInterface::getAspectRatio to SizeInterface::aspectRatio
This commit is contained in:
@@ -188,7 +188,7 @@ class Rectangle extends Polygon implements SizeInterface, DrawableInterface
|
||||
);
|
||||
}
|
||||
|
||||
public function getAspectRatio(): float
|
||||
public function aspectRatio(): float
|
||||
{
|
||||
return $this->width() / $this->height();
|
||||
}
|
||||
|
@@ -77,7 +77,7 @@ class RectangleResizer
|
||||
return $size->width();
|
||||
}
|
||||
|
||||
return (int) round($this->height * $size->getAspectRatio());
|
||||
return (int) round($this->height * $size->aspectRatio());
|
||||
}
|
||||
|
||||
protected function getProportionalHeight(SizeInterface $size): int
|
||||
@@ -86,7 +86,7 @@ class RectangleResizer
|
||||
return $size->height();
|
||||
}
|
||||
|
||||
return (int) round($this->width / $size->getAspectRatio());
|
||||
return (int) round($this->width / $size->aspectRatio());
|
||||
}
|
||||
|
||||
public function resize(SizeInterface $size): SizeInterface
|
||||
|
@@ -10,7 +10,7 @@ interface SizeInterface
|
||||
public function setWidth(int $width): SizeInterface;
|
||||
public function setHeight(int $height): SizeInterface;
|
||||
public function setPivot(PointInterface $pivot): SizeInterface;
|
||||
public function getAspectRatio(): float;
|
||||
public function aspectRatio(): float;
|
||||
public function fitsInto(SizeInterface $size): bool;
|
||||
public function isLandscape(): bool;
|
||||
public function isPortrait(): bool;
|
||||
|
@@ -50,13 +50,13 @@ class RectangleTest extends TestCase
|
||||
public function testGetAspectRatio()
|
||||
{
|
||||
$size = new Rectangle(800, 600);
|
||||
$this->assertEquals(1.333, round($size->getAspectRatio(), 3));
|
||||
$this->assertEquals(1.333, round($size->aspectRatio(), 3));
|
||||
|
||||
$size = new Rectangle(100, 100);
|
||||
$this->assertEquals(1, $size->getAspectRatio());
|
||||
$this->assertEquals(1, $size->aspectRatio());
|
||||
|
||||
$size = new Rectangle(1920, 1080);
|
||||
$this->assertEquals(1.778, round($size->getAspectRatio(), 3));
|
||||
$this->assertEquals(1.778, round($size->aspectRatio(), 3));
|
||||
}
|
||||
|
||||
public function testFitsInto()
|
||||
|
Reference in New Issue
Block a user