Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Imagine more hackable, remove final keywords from classes and functions declaration #339

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Imagine/Filter/Transformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
/**
* A transformation filter
*/
final class Transformation implements FilterInterface, ManipulatorInterface
class Transformation implements FilterInterface, ManipulatorInterface
{
/**
* @var array
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Gd/Drawer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Drawer implementation using the GD library
*/
final class Drawer implements DrawerInterface
class Drawer implements DrawerInterface
{
/**
* @var resource
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Gd/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Font implementation using the GD library
*/
final class Font extends AbstractFont
class Font extends AbstractFont
{
/**
* {@inheritdoc}
Expand Down
20 changes: 10 additions & 10 deletions lib/Imagine/Gd/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Image implementation using the GD library
*/
final class Image extends AbstractImage
class Image extends AbstractImage
{
/**
* @var resource
Expand Down Expand Up @@ -85,7 +85,7 @@ public function getGdResource()
/**
* {@inheritdoc}
*/
final public function copy()
public function copy()
{
$size = $this->getSize();
$copy = $this->createImage($size, 'copy');
Expand All @@ -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');
Expand All @@ -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)));
Expand All @@ -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');
Expand Down Expand Up @@ -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));
Expand All @@ -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;

Expand Down Expand Up @@ -257,7 +257,7 @@ public function __toString()
/**
* {@inheritdoc}
*/
final public function flipHorizontally()
public function flipHorizontally()
{
$size = $this->getSize();
$width = $size->getWidth();
Expand All @@ -280,7 +280,7 @@ final public function flipHorizontally()
/**
* {@inheritdoc}
*/
final public function flipVertically()
public function flipVertically()
{
$size = $this->getSize();
$width = $size->getWidth();
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Gd/Imagine.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Imagine implementation using the GD library
*/
final class Imagine extends AbstractImagine
class Imagine extends AbstractImagine
{
/**
* @var array
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Gmagick/Drawer.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
/**
* Drawer implementation using the Gmagick PHP extension
*/
final class Drawer implements DrawerInterface
class Drawer implements DrawerInterface
{
/**
* @var \Gmagick
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Gmagick/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Font implementation using the Gmagick PHP extension
*/
final class Font extends AbstractFont
class Font extends AbstractFont
{
/**
* @var \Gmagick
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Gmagick/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
/**
* Image implementation using the Gmagick PHP extension
*/
final class Image extends AbstractImage
class Image extends AbstractImage
{
/**
* @var \Gmagick
Expand Down
6 changes: 3 additions & 3 deletions lib/Imagine/Image/AbstractFont.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ public function __construct($file, $size, ColorInterface $color)
/**
* {@inheritdoc}
*/
final public function getFile()
public function getFile()
{
return $this->file;
}

/**
* {@inheritdoc}
*/
final public function getSize()
public function getSize()
{
return $this->size;
}

/**
* {@inheritdoc}
*/
final public function getColor()
public function getColor()
{
return $this->color;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Box.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* A box implementation
*/
final class Box implements BoxInterface
class Box implements BoxInterface
{
/**
* @var integer
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Fill/Gradient/Horizontal.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Horizontal gradient fill
*/
final class Horizontal extends Linear
class Horizontal extends Linear
{
/**
* {@inheritdoc}
Expand Down
8 changes: 4 additions & 4 deletions lib/Imagine/Image/Fill/Gradient/Linear.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -71,15 +71,15 @@ final public function getColor(PointInterface $position)
/**
* @return ColorInterface
*/
final public function getStart()
public function getStart()
{
return $this->start;
}

/**
* @return ColorInterface
*/
final public function getEnd()
public function getEnd()
{
return $this->end;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Fill/Gradient/Vertical.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Vertical gradient fill
*/
final class Vertical extends Linear
class Vertical extends Linear
{
/**
* {@inheritdoc}
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Histogram/Bucket.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/**
* Bucket histogram
*/
final class Bucket implements \Countable
class Bucket implements \Countable
{
/**
* @var Range
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Histogram/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* Range histogram
*/
final class Range
class Range
{
/**
* @var integer
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Palette/Color/CMYK.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
use Imagine\Exception\RuntimeException;
use Imagine\Exception\InvalidArgumentException;

final class CMYK implements ColorInterface
class CMYK implements ColorInterface
{
/**
* @var integer
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Palette/Color/Gray.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Imagine\Image\Palette\Grayscale;
use Imagine\Exception\InvalidArgumentException;

final class Gray implements ColorInterface
class Gray implements ColorInterface
{
/**
* @var integer
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Palette/Color/RGB.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/**
* The point class
*/
final class Point implements PointInterface
class Point implements PointInterface
{
/**
* @var integer
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Image/Point/Center.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Point center
*/
final class Center implements PointInterface
class Center implements PointInterface
{
/**
* @var BoxInterface
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Imagick/Drawer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
/**
* Drawer implementation using the Imagick PHP extension
*/
final class Drawer implements DrawerInterface
class Drawer implements DrawerInterface
{
/**
* @var Imagick
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Imagick/Font.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
/**
* Font implementation using the Imagick PHP extension
*/
final class Font extends AbstractFont
class Font extends AbstractFont
{
/**
* @var \Imagick
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Imagick/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/**
* Image implementation using the Imagick PHP extension
*/
final class Image extends AbstractImage
class Image extends AbstractImage
{
/**
* @var \Imagick
Expand Down
2 changes: 1 addition & 1 deletion lib/Imagine/Imagick/Imagine.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/**
* Imagine implementation using the Imagick PHP extension
*/
final class Imagine extends AbstractImagine
class Imagine extends AbstractImagine
{
/**
* @throws RuntimeException
Expand Down