From c002e6ee1367cadda06885ffed773730464a6ea5 Mon Sep 17 00:00:00 2001 From: Romain Neutron Date: Sun, 22 Jun 2014 17:21:30 +0200 Subject: [PATCH] Make Imagine more hackable, remove final keywords from classes and functions declaration --- lib/Imagine/Filter/Transformation.php | 2 +- lib/Imagine/Gd/Drawer.php | 2 +- lib/Imagine/Gd/Font.php | 2 +- lib/Imagine/Gd/Image.php | 20 +++++++++---------- lib/Imagine/Gd/Imagine.php | 2 +- lib/Imagine/Gmagick/Drawer.php | 2 +- lib/Imagine/Gmagick/Font.php | 2 +- lib/Imagine/Gmagick/Image.php | 2 +- lib/Imagine/Image/AbstractFont.php | 6 +++--- lib/Imagine/Image/Box.php | 2 +- .../Image/Fill/Gradient/Horizontal.php | 2 +- lib/Imagine/Image/Fill/Gradient/Linear.php | 8 ++++---- lib/Imagine/Image/Fill/Gradient/Vertical.php | 2 +- lib/Imagine/Image/Histogram/Bucket.php | 2 +- lib/Imagine/Image/Histogram/Range.php | 2 +- lib/Imagine/Image/Palette/Color/CMYK.php | 2 +- lib/Imagine/Image/Palette/Color/Gray.php | 2 +- lib/Imagine/Image/Palette/Color/RGB.php | 2 +- lib/Imagine/Image/Point.php | 2 +- lib/Imagine/Image/Point/Center.php | 2 +- lib/Imagine/Imagick/Drawer.php | 2 +- lib/Imagine/Imagick/Font.php | 2 +- lib/Imagine/Imagick/Image.php | 2 +- lib/Imagine/Imagick/Imagine.php | 2 +- 24 files changed, 38 insertions(+), 38 deletions(-) diff --git a/lib/Imagine/Filter/Transformation.php b/lib/Imagine/Filter/Transformation.php index 6e77e7430..b5c12aabd 100644 --- a/lib/Imagine/Filter/Transformation.php +++ b/lib/Imagine/Filter/Transformation.php @@ -36,7 +36,7 @@ /** * A transformation filter */ -final class Transformation implements FilterInterface, ManipulatorInterface +class Transformation implements FilterInterface, ManipulatorInterface { /** * @var array diff --git a/lib/Imagine/Gd/Drawer.php b/lib/Imagine/Gd/Drawer.php index e5d74e0d9..7be17599f 100644 --- a/lib/Imagine/Gd/Drawer.php +++ b/lib/Imagine/Gd/Drawer.php @@ -23,7 +23,7 @@ /** * Drawer implementation using the GD library */ -final class Drawer implements DrawerInterface +class Drawer implements DrawerInterface { /** * @var resource diff --git a/lib/Imagine/Gd/Font.php b/lib/Imagine/Gd/Font.php index 8bc2b04d4..062333ffc 100644 --- a/lib/Imagine/Gd/Font.php +++ b/lib/Imagine/Gd/Font.php @@ -18,7 +18,7 @@ /** * Font implementation using the GD library */ -final class Font extends AbstractFont +class Font extends AbstractFont { /** * {@inheritdoc} diff --git a/lib/Imagine/Gd/Image.php b/lib/Imagine/Gd/Image.php index 848fe4e83..7e1308c40 100644 --- a/lib/Imagine/Gd/Image.php +++ b/lib/Imagine/Gd/Image.php @@ -31,7 +31,7 @@ /** * Image implementation using the GD library */ -final class Image extends AbstractImage +class Image extends AbstractImage { /** * @var resource @@ -85,7 +85,7 @@ public function getGdResource() /** * {@inheritdoc} */ - final public function copy() + public function copy() { $size = $this->getSize(); $copy = $this->createImage($size, 'copy'); @@ -100,7 +100,7 @@ final public function copy() /** * {@inheritdoc} */ - final public function crop(PointInterface $start, BoxInterface $size) + public function crop(PointInterface $start, BoxInterface $size) { if (!$start->in($this->getSize())) { throw new OutOfBoundsException('Crop coordinates must start at minimum 0, 0 position from top left corner, crop height and width must be positive integers and must not exceed the current image borders'); @@ -125,7 +125,7 @@ final public function crop(PointInterface $start, BoxInterface $size) /** * {@inheritdoc} */ - final public function paste(ImageInterface $image, PointInterface $start) + public function paste(ImageInterface $image, PointInterface $start) { if (!$image instanceof self) { throw new InvalidArgumentException(sprintf('Gd\Image can only paste() Gd\Image instances, %s given', get_class($image))); @@ -152,7 +152,7 @@ final public function paste(ImageInterface $image, PointInterface $start) /** * {@inheritdoc} */ - final public function resize(BoxInterface $size, $filter = ImageInterface::FILTER_UNDEFINED) + public function resize(BoxInterface $size, $filter = ImageInterface::FILTER_UNDEFINED) { if (ImageInterface::FILTER_UNDEFINED !== $filter) { throw new InvalidArgumentException('Unsupported filter type, GD only supports ImageInterface::FILTER_UNDEFINED filter'); @@ -183,7 +183,7 @@ final public function resize(BoxInterface $size, $filter = ImageInterface::FILTE /** * {@inheritdoc} */ - final public function rotate($angle, ColorInterface $background = null) + public function rotate($angle, ColorInterface $background = null) { $color = $background ? $background : $this->palette->color('fff'); $resource = imagerotate($this->resource, -1 * $angle, $this->getColor($color)); @@ -201,7 +201,7 @@ final public function rotate($angle, ColorInterface $background = null) /** * {@inheritdoc} */ - final public function save($path = null, array $options = array()) + public function save($path = null, array $options = array()) { $path = null === $path ? (isset($this->metadata['filepath']) ? $this->metadata['filepath'] : $path) : $path; @@ -257,7 +257,7 @@ public function __toString() /** * {@inheritdoc} */ - final public function flipHorizontally() + public function flipHorizontally() { $size = $this->getSize(); $width = $size->getWidth(); @@ -280,7 +280,7 @@ final public function flipHorizontally() /** * {@inheritdoc} */ - final public function flipVertically() + public function flipVertically() { $size = $this->getSize(); $width = $size->getWidth(); @@ -303,7 +303,7 @@ final public function flipVertically() /** * {@inheritdoc} */ - final public function strip() + public function strip() { // GD strips profiles and comment, so there's nothing to do here return $this; diff --git a/lib/Imagine/Gd/Imagine.php b/lib/Imagine/Gd/Imagine.php index f05b06a52..2d241a2b1 100644 --- a/lib/Imagine/Gd/Imagine.php +++ b/lib/Imagine/Gd/Imagine.php @@ -24,7 +24,7 @@ /** * Imagine implementation using the GD library */ -final class Imagine extends AbstractImagine +class Imagine extends AbstractImagine { /** * @var array diff --git a/lib/Imagine/Gmagick/Drawer.php b/lib/Imagine/Gmagick/Drawer.php index de6cc9048..7de3779c2 100644 --- a/lib/Imagine/Gmagick/Drawer.php +++ b/lib/Imagine/Gmagick/Drawer.php @@ -24,7 +24,7 @@ /** * Drawer implementation using the Gmagick PHP extension */ -final class Drawer implements DrawerInterface +class Drawer implements DrawerInterface { /** * @var \Gmagick diff --git a/lib/Imagine/Gmagick/Font.php b/lib/Imagine/Gmagick/Font.php index ad67c5647..35a4cc363 100644 --- a/lib/Imagine/Gmagick/Font.php +++ b/lib/Imagine/Gmagick/Font.php @@ -18,7 +18,7 @@ /** * Font implementation using the Gmagick PHP extension */ -final class Font extends AbstractFont +class Font extends AbstractFont { /** * @var \Gmagick diff --git a/lib/Imagine/Gmagick/Image.php b/lib/Imagine/Gmagick/Image.php index b79f7af76..57eb661a6 100644 --- a/lib/Imagine/Gmagick/Image.php +++ b/lib/Imagine/Gmagick/Image.php @@ -29,7 +29,7 @@ /** * Image implementation using the Gmagick PHP extension */ -final class Image extends AbstractImage +class Image extends AbstractImage { /** * @var \Gmagick diff --git a/lib/Imagine/Image/AbstractFont.php b/lib/Imagine/Image/AbstractFont.php index 59e9a45ba..3cc355f99 100644 --- a/lib/Imagine/Image/AbstractFont.php +++ b/lib/Imagine/Image/AbstractFont.php @@ -52,7 +52,7 @@ public function __construct($file, $size, ColorInterface $color) /** * {@inheritdoc} */ - final public function getFile() + public function getFile() { return $this->file; } @@ -60,7 +60,7 @@ final public function getFile() /** * {@inheritdoc} */ - final public function getSize() + public function getSize() { return $this->size; } @@ -68,7 +68,7 @@ final public function getSize() /** * {@inheritdoc} */ - final public function getColor() + public function getColor() { return $this->color; } diff --git a/lib/Imagine/Image/Box.php b/lib/Imagine/Image/Box.php index 37b85135a..96214b29c 100644 --- a/lib/Imagine/Image/Box.php +++ b/lib/Imagine/Image/Box.php @@ -16,7 +16,7 @@ /** * A box implementation */ -final class Box implements BoxInterface +class Box implements BoxInterface { /** * @var integer diff --git a/lib/Imagine/Image/Fill/Gradient/Horizontal.php b/lib/Imagine/Image/Fill/Gradient/Horizontal.php index 4a4230671..881e89c88 100644 --- a/lib/Imagine/Image/Fill/Gradient/Horizontal.php +++ b/lib/Imagine/Image/Fill/Gradient/Horizontal.php @@ -16,7 +16,7 @@ /** * Horizontal gradient fill */ -final class Horizontal extends Linear +class Horizontal extends Linear { /** * {@inheritdoc} diff --git a/lib/Imagine/Image/Fill/Gradient/Linear.php b/lib/Imagine/Image/Fill/Gradient/Linear.php index 9bf2cf6cc..6103d86a9 100644 --- a/lib/Imagine/Image/Fill/Gradient/Linear.php +++ b/lib/Imagine/Image/Fill/Gradient/Linear.php @@ -43,7 +43,7 @@ abstract class Linear implements FillInterface * @param ColorInterface $start * @param ColorInterface $end */ - final public function __construct($length, ColorInterface $start, ColorInterface $end) + public function __construct($length, ColorInterface $start, ColorInterface $end) { $this->length = $length; $this->start = $start; @@ -53,7 +53,7 @@ final public function __construct($length, ColorInterface $start, ColorInterface /** * {@inheritdoc} */ - final public function getColor(PointInterface $position) + public function getColor(PointInterface $position) { $l = $this->getDistance($position); @@ -71,7 +71,7 @@ final public function getColor(PointInterface $position) /** * @return ColorInterface */ - final public function getStart() + public function getStart() { return $this->start; } @@ -79,7 +79,7 @@ final public function getStart() /** * @return ColorInterface */ - final public function getEnd() + public function getEnd() { return $this->end; } diff --git a/lib/Imagine/Image/Fill/Gradient/Vertical.php b/lib/Imagine/Image/Fill/Gradient/Vertical.php index 9a26b7789..eb3bb556b 100644 --- a/lib/Imagine/Image/Fill/Gradient/Vertical.php +++ b/lib/Imagine/Image/Fill/Gradient/Vertical.php @@ -16,7 +16,7 @@ /** * Vertical gradient fill */ -final class Vertical extends Linear +class Vertical extends Linear { /** * {@inheritdoc} diff --git a/lib/Imagine/Image/Histogram/Bucket.php b/lib/Imagine/Image/Histogram/Bucket.php index 34dad5eed..9f3d145a4 100644 --- a/lib/Imagine/Image/Histogram/Bucket.php +++ b/lib/Imagine/Image/Histogram/Bucket.php @@ -14,7 +14,7 @@ /** * Bucket histogram */ -final class Bucket implements \Countable +class Bucket implements \Countable { /** * @var Range diff --git a/lib/Imagine/Image/Histogram/Range.php b/lib/Imagine/Image/Histogram/Range.php index 9dc9f9928..c3c88ef3d 100644 --- a/lib/Imagine/Image/Histogram/Range.php +++ b/lib/Imagine/Image/Histogram/Range.php @@ -16,7 +16,7 @@ /** * Range histogram */ -final class Range +class Range { /** * @var integer diff --git a/lib/Imagine/Image/Palette/Color/CMYK.php b/lib/Imagine/Image/Palette/Color/CMYK.php index 316543355..9a3632d1f 100644 --- a/lib/Imagine/Image/Palette/Color/CMYK.php +++ b/lib/Imagine/Image/Palette/Color/CMYK.php @@ -15,7 +15,7 @@ use Imagine\Exception\RuntimeException; use Imagine\Exception\InvalidArgumentException; -final class CMYK implements ColorInterface +class CMYK implements ColorInterface { /** * @var integer diff --git a/lib/Imagine/Image/Palette/Color/Gray.php b/lib/Imagine/Image/Palette/Color/Gray.php index c8096450f..e59d4a004 100644 --- a/lib/Imagine/Image/Palette/Color/Gray.php +++ b/lib/Imagine/Image/Palette/Color/Gray.php @@ -14,7 +14,7 @@ use Imagine\Image\Palette\Grayscale; use Imagine\Exception\InvalidArgumentException; -final class Gray implements ColorInterface +class Gray implements ColorInterface { /** * @var integer diff --git a/lib/Imagine/Image/Palette/Color/RGB.php b/lib/Imagine/Image/Palette/Color/RGB.php index a0b4f0d01..841587ab2 100644 --- a/lib/Imagine/Image/Palette/Color/RGB.php +++ b/lib/Imagine/Image/Palette/Color/RGB.php @@ -14,7 +14,7 @@ use Imagine\Image\Palette\RGB as RGBPalette; use Imagine\Exception\InvalidArgumentException; -final class RGB implements ColorInterface +class RGB implements ColorInterface { /** * @var integer diff --git a/lib/Imagine/Image/Point.php b/lib/Imagine/Image/Point.php index d3f385e5d..69eefaebf 100644 --- a/lib/Imagine/Image/Point.php +++ b/lib/Imagine/Image/Point.php @@ -16,7 +16,7 @@ /** * The point class */ -final class Point implements PointInterface +class Point implements PointInterface { /** * @var integer diff --git a/lib/Imagine/Image/Point/Center.php b/lib/Imagine/Image/Point/Center.php index 0e60349e1..7bf0cb8bd 100644 --- a/lib/Imagine/Image/Point/Center.php +++ b/lib/Imagine/Image/Point/Center.php @@ -18,7 +18,7 @@ /** * Point center */ -final class Center implements PointInterface +class Center implements PointInterface { /** * @var BoxInterface diff --git a/lib/Imagine/Imagick/Drawer.php b/lib/Imagine/Imagick/Drawer.php index b56d47ad7..c0b6d0613 100644 --- a/lib/Imagine/Imagick/Drawer.php +++ b/lib/Imagine/Imagick/Drawer.php @@ -23,7 +23,7 @@ /** * Drawer implementation using the Imagick PHP extension */ -final class Drawer implements DrawerInterface +class Drawer implements DrawerInterface { /** * @var Imagick diff --git a/lib/Imagine/Imagick/Font.php b/lib/Imagine/Imagick/Font.php index 3fc41dd2f..e3018ba50 100644 --- a/lib/Imagine/Imagick/Font.php +++ b/lib/Imagine/Imagick/Font.php @@ -18,7 +18,7 @@ /** * Font implementation using the Imagick PHP extension */ -final class Font extends AbstractFont +class Font extends AbstractFont { /** * @var \Imagick diff --git a/lib/Imagine/Imagick/Image.php b/lib/Imagine/Imagick/Image.php index ae506b836..53fbc8bb2 100644 --- a/lib/Imagine/Imagick/Image.php +++ b/lib/Imagine/Imagick/Image.php @@ -31,7 +31,7 @@ /** * Image implementation using the Imagick PHP extension */ -final class Image extends AbstractImage +class Image extends AbstractImage { /** * @var \Imagick diff --git a/lib/Imagine/Imagick/Imagine.php b/lib/Imagine/Imagick/Imagine.php index fc3a1358c..5271e5f12 100644 --- a/lib/Imagine/Imagick/Imagine.php +++ b/lib/Imagine/Imagick/Imagine.php @@ -25,7 +25,7 @@ /** * Imagine implementation using the Imagick PHP extension */ -final class Imagine extends AbstractImagine +class Imagine extends AbstractImagine { /** * @throws RuntimeException