diff --git a/src/Intervention/Image/AbstractColor.php b/src/Intervention/Image/AbstractColor.php index 28cbaf29..c9846c6a 100644 --- a/src/Intervention/Image/AbstractColor.php +++ b/src/Intervention/Image/AbstractColor.php @@ -2,6 +2,9 @@ namespace Intervention\Image; +use Intervention\Image\Exception\NotReadableException; +use Intervention\Image\Exception\NotSupportedException; + abstract class AbstractColor { /** @@ -136,7 +139,7 @@ abstract class AbstractColor break; default: - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Color format ({$value}) cannot be read." ); } @@ -172,7 +175,7 @@ abstract class AbstractColor return $this; default: - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Color format ({$type}) is not supported." ); } @@ -216,7 +219,7 @@ abstract class AbstractColor $result[2] = ($matches[3] >= 0 && $matches[3] <= 255) ? intval($matches[3]) : 0; $result[3] = ($matches[4] >= 0 && $matches[4] <= 1) ? $matches[4] : 0; } else { - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to read color ({$value})." ); } diff --git a/src/Intervention/Image/AbstractDecoder.php b/src/Intervention/Image/AbstractDecoder.php index 235520e3..de770c32 100644 --- a/src/Intervention/Image/AbstractDecoder.php +++ b/src/Intervention/Image/AbstractDecoder.php @@ -3,6 +3,7 @@ namespace Intervention\Image; use GuzzleHttp\Psr7\Stream; +use Intervention\Image\Exception\NotReadableException; use Psr\Http\Message\StreamInterface; abstract class AbstractDecoder @@ -80,7 +81,7 @@ abstract class AbstractDecoder return $this->initFromBinary($data); } - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to init from given url (".$url.")." ); } @@ -123,7 +124,7 @@ abstract class AbstractDecoder return $this->initFromBinary($data); } - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to init from given stream" ); } @@ -342,7 +343,7 @@ abstract class AbstractDecoder return $this->initFromBinary(base64_decode($this->data)); default: - throw new Exception\NotReadableException("Image source not readable"); + throw new NotReadableException("Image source not readable"); } } diff --git a/src/Intervention/Image/AbstractDriver.php b/src/Intervention/Image/AbstractDriver.php index 29ad9d59..d2356ae8 100644 --- a/src/Intervention/Image/AbstractDriver.php +++ b/src/Intervention/Image/AbstractDriver.php @@ -2,6 +2,8 @@ namespace Intervention\Image; +use Intervention\Image\Exception\NotSupportedException; + abstract class AbstractDriver { /** @@ -114,7 +116,7 @@ abstract class AbstractDriver return $classnameGlobal; } - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Command ({$name}) is not available for driver ({$drivername})." ); } diff --git a/src/Intervention/Image/AbstractEncoder.php b/src/Intervention/Image/AbstractEncoder.php index 357b8f48..d3e59eaa 100644 --- a/src/Intervention/Image/AbstractEncoder.php +++ b/src/Intervention/Image/AbstractEncoder.php @@ -2,6 +2,9 @@ namespace Intervention\Image; +use Intervention\Image\Exception\InvalidArgumentException; +use Intervention\Image\Exception\NotSupportedException; + abstract class AbstractEncoder { /** @@ -167,7 +170,7 @@ abstract class AbstractEncoder break; default: - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Encoding format ({$format}) is not supported." ); } @@ -229,7 +232,7 @@ abstract class AbstractEncoder $quality = $quality === 0 ? 1 : $quality; if ($quality < 0 || $quality > 100) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( 'Quality must range from 0 to 100.' ); } diff --git a/src/Intervention/Image/Commands/AbstractCommand.php b/src/Intervention/Image/Commands/AbstractCommand.php index cf9ca108..e31078ce 100644 --- a/src/Intervention/Image/Commands/AbstractCommand.php +++ b/src/Intervention/Image/Commands/AbstractCommand.php @@ -2,6 +2,8 @@ namespace Intervention\Image\Commands; +use Intervention\Image\Commands\Argument; + abstract class AbstractCommand { /** @@ -44,7 +46,7 @@ abstract class AbstractCommand */ public function argument($key) { - return new \Intervention\Image\Commands\Argument($this, $key); + return new Argument($this, $key); } /** diff --git a/src/Intervention/Image/Commands/Argument.php b/src/Intervention/Image/Commands/Argument.php index e64e8ac5..9538199f 100644 --- a/src/Intervention/Image/Commands/Argument.php +++ b/src/Intervention/Image/Commands/Argument.php @@ -2,6 +2,8 @@ namespace Intervention\Image\Commands; +use Intervention\Image\Exception\InvalidArgumentException; + class Argument { /** @@ -66,7 +68,7 @@ class Argument public function required() { if ( ! array_key_exists($this->key, $this->command->arguments)) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( sprintf("Missing argument %d for %s", $this->key + 1, $this->getCommandName()) ); } @@ -133,7 +135,7 @@ class Argument $message = sprintf('Missing argument for %d.', $argument); } - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( $message ); } @@ -158,7 +160,7 @@ class Argument $omega = max($x, $y); if ($value < $alpha || $value > $omega) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( sprintf('Argument %d must be between %s and %s.', $this->key, $x, $y) ); } @@ -180,7 +182,7 @@ class Argument } if ($v < $value) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( sprintf('Argument %d must be at least %s.', $this->key, $value) ); } @@ -202,7 +204,7 @@ class Argument } if ($v > $value) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( sprintf('Argument %d may not be greater than %s.', $this->key, $value) ); } diff --git a/src/Intervention/Image/Commands/CircleCommand.php b/src/Intervention/Image/Commands/CircleCommand.php index 2fc38ddf..c627818e 100644 --- a/src/Intervention/Image/Commands/CircleCommand.php +++ b/src/Intervention/Image/Commands/CircleCommand.php @@ -4,7 +4,7 @@ namespace Intervention\Image\Commands; use Closure; -class CircleCommand extends \Intervention\Image\Commands\AbstractCommand +class CircleCommand extends AbstractCommand { /** * Draw a circle centered on given image diff --git a/src/Intervention/Image/Commands/EllipseCommand.php b/src/Intervention/Image/Commands/EllipseCommand.php index 4f364eca..4637e020 100644 --- a/src/Intervention/Image/Commands/EllipseCommand.php +++ b/src/Intervention/Image/Commands/EllipseCommand.php @@ -4,7 +4,7 @@ namespace Intervention\Image\Commands; use Closure; -class EllipseCommand extends \Intervention\Image\Commands\AbstractCommand +class EllipseCommand extends AbstractCommand { /** * Draws ellipse on given image diff --git a/src/Intervention/Image/Commands/ExifCommand.php b/src/Intervention/Image/Commands/ExifCommand.php index 8c581b17..7103f2fd 100644 --- a/src/Intervention/Image/Commands/ExifCommand.php +++ b/src/Intervention/Image/Commands/ExifCommand.php @@ -3,6 +3,7 @@ namespace Intervention\Image\Commands; use Intervention\Image\Exception\NotReadableException; +use Intervention\Image\Exception\NotSupportedException; class ExifCommand extends AbstractCommand { @@ -18,7 +19,7 @@ class ExifCommand extends AbstractCommand public function execute($image) { if (!function_exists('exif_read_data')) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Reading Exif data is not supported by this PHP installation." ); } diff --git a/src/Intervention/Image/Commands/IptcCommand.php b/src/Intervention/Image/Commands/IptcCommand.php index 88e8fd35..ae953d20 100644 --- a/src/Intervention/Image/Commands/IptcCommand.php +++ b/src/Intervention/Image/Commands/IptcCommand.php @@ -2,6 +2,8 @@ namespace Intervention\Image\Commands; +use Intervention\Image\Exception\NotSupportedException; + class IptcCommand extends AbstractCommand { /** @@ -13,7 +15,7 @@ class IptcCommand extends AbstractCommand public function execute($image) { if ( ! function_exists('iptcparse')) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Reading Iptc data is not supported by this PHP installation." ); } diff --git a/src/Intervention/Image/Commands/LineCommand.php b/src/Intervention/Image/Commands/LineCommand.php index 0089c649..a068c662 100644 --- a/src/Intervention/Image/Commands/LineCommand.php +++ b/src/Intervention/Image/Commands/LineCommand.php @@ -4,7 +4,7 @@ namespace Intervention\Image\Commands; use Closure; -class LineCommand extends \Intervention\Image\Commands\AbstractCommand +class LineCommand extends AbstractCommand { /** * Draws line on given image diff --git a/src/Intervention/Image/Commands/PolygonCommand.php b/src/Intervention/Image/Commands/PolygonCommand.php index e46e3fff..a2fa9978 100644 --- a/src/Intervention/Image/Commands/PolygonCommand.php +++ b/src/Intervention/Image/Commands/PolygonCommand.php @@ -3,8 +3,9 @@ namespace Intervention\Image\Commands; use Closure; +use Intervention\Image\Exception\InvalidArgumentException; -class PolygonCommand extends \Intervention\Image\Commands\AbstractCommand +class PolygonCommand extends AbstractCommand { /** * Draw a polygon on given image @@ -21,13 +22,13 @@ class PolygonCommand extends \Intervention\Image\Commands\AbstractCommand // check if number if coordinates is even if ($vertices_count % 2 !== 0) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( "The number of given polygon vertices must be even." ); } if ($vertices_count < 6) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( "You must have at least 3 points in your array." ); } diff --git a/src/Intervention/Image/Commands/RectangleCommand.php b/src/Intervention/Image/Commands/RectangleCommand.php index 3a2074c5..24378b38 100644 --- a/src/Intervention/Image/Commands/RectangleCommand.php +++ b/src/Intervention/Image/Commands/RectangleCommand.php @@ -4,7 +4,7 @@ namespace Intervention\Image\Commands; use Closure; -class RectangleCommand extends \Intervention\Image\Commands\AbstractCommand +class RectangleCommand extends AbstractCommand { /** * Draws rectangle on given image diff --git a/src/Intervention/Image/Commands/TextCommand.php b/src/Intervention/Image/Commands/TextCommand.php index 4aebd8e8..3c60b4e7 100644 --- a/src/Intervention/Image/Commands/TextCommand.php +++ b/src/Intervention/Image/Commands/TextCommand.php @@ -4,7 +4,7 @@ namespace Intervention\Image\Commands; use Closure; -class TextCommand extends \Intervention\Image\Commands\AbstractCommand +class TextCommand extends AbstractCommand { /** * Write text on given image diff --git a/src/Intervention/Image/Filters/DemoFilter.php b/src/Intervention/Image/Filters/DemoFilter.php index f5aac05b..4e8f92b8 100644 --- a/src/Intervention/Image/Filters/DemoFilter.php +++ b/src/Intervention/Image/Filters/DemoFilter.php @@ -2,6 +2,8 @@ namespace Intervention\Image\Filters; +use Intervention\Image\Image; + class DemoFilter implements FilterInterface { /** @@ -32,7 +34,7 @@ class DemoFilter implements FilterInterface * @param \Intervention\Image\Image $image * @return \Intervention\Image\Image */ - public function applyFilter(\Intervention\Image\Image $image) + public function applyFilter(Image $image) { $image->pixelate($this->size); $image->greyscale(); diff --git a/src/Intervention/Image/Filters/FilterInterface.php b/src/Intervention/Image/Filters/FilterInterface.php index 27c0beef..88f6cbfe 100644 --- a/src/Intervention/Image/Filters/FilterInterface.php +++ b/src/Intervention/Image/Filters/FilterInterface.php @@ -2,6 +2,8 @@ namespace Intervention\Image\Filters; +use Intervention\Image\Image; + interface FilterInterface { /** @@ -10,5 +12,5 @@ interface FilterInterface * @param \Intervention\Image\Image $image * @return \Intervention\Image\Image */ - public function applyFilter(\Intervention\Image\Image $image); + public function applyFilter(Image $image); } diff --git a/src/Intervention/Image/Gd/Color.php b/src/Intervention/Image/Gd/Color.php index 71a889f1..44370ba0 100644 --- a/src/Intervention/Image/Gd/Color.php +++ b/src/Intervention/Image/Gd/Color.php @@ -3,6 +3,7 @@ namespace Intervention\Image\Gd; use Intervention\Image\AbstractColor; +use Intervention\Image\Exception\NotSupportedException; class Color extends AbstractColor { @@ -134,7 +135,7 @@ class Color extends AbstractColor */ public function initFromObject($value) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "GD colors cannot init from ImagickPixel objects." ); } diff --git a/src/Intervention/Image/Gd/Commands/BackupCommand.php b/src/Intervention/Image/Gd/Commands/BackupCommand.php index 98b3c725..310dc03a 100644 --- a/src/Intervention/Image/Gd/Commands/BackupCommand.php +++ b/src/Intervention/Image/Gd/Commands/BackupCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class BackupCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class BackupCommand extends AbstractCommand { /** * Saves a backups of current state of image core diff --git a/src/Intervention/Image/Gd/Commands/BlurCommand.php b/src/Intervention/Image/Gd/Commands/BlurCommand.php index d53f59d7..c4fca0ea 100644 --- a/src/Intervention/Image/Gd/Commands/BlurCommand.php +++ b/src/Intervention/Image/Gd/Commands/BlurCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class BlurCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class BlurCommand extends AbstractCommand { /** * Applies blur effect on image diff --git a/src/Intervention/Image/Gd/Commands/BrightnessCommand.php b/src/Intervention/Image/Gd/Commands/BrightnessCommand.php index de4263f7..4e48464b 100644 --- a/src/Intervention/Image/Gd/Commands/BrightnessCommand.php +++ b/src/Intervention/Image/Gd/Commands/BrightnessCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class BrightnessCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class BrightnessCommand extends AbstractCommand { /** * Changes image brightness diff --git a/src/Intervention/Image/Gd/Commands/ColorizeCommand.php b/src/Intervention/Image/Gd/Commands/ColorizeCommand.php index 8f539638..410917b3 100644 --- a/src/Intervention/Image/Gd/Commands/ColorizeCommand.php +++ b/src/Intervention/Image/Gd/Commands/ColorizeCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class ColorizeCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class ColorizeCommand extends AbstractCommand { /** * Changes balance of different RGB color channels diff --git a/src/Intervention/Image/Gd/Commands/ContrastCommand.php b/src/Intervention/Image/Gd/Commands/ContrastCommand.php index e43b761a..916c41f8 100644 --- a/src/Intervention/Image/Gd/Commands/ContrastCommand.php +++ b/src/Intervention/Image/Gd/Commands/ContrastCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class ContrastCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class ContrastCommand extends AbstractCommand { /** * Changes contrast of image diff --git a/src/Intervention/Image/Gd/Commands/DestroyCommand.php b/src/Intervention/Image/Gd/Commands/DestroyCommand.php index 18383307..4503d10f 100644 --- a/src/Intervention/Image/Gd/Commands/DestroyCommand.php +++ b/src/Intervention/Image/Gd/Commands/DestroyCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class DestroyCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class DestroyCommand extends AbstractCommand { /** * Destroys current image core and frees up memory diff --git a/src/Intervention/Image/Gd/Commands/FillCommand.php b/src/Intervention/Image/Gd/Commands/FillCommand.php index aaecb7fb..cf190821 100644 --- a/src/Intervention/Image/Gd/Commands/FillCommand.php +++ b/src/Intervention/Image/Gd/Commands/FillCommand.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Gd\Commands; -use Intervention\Image\Gd\Decoder; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Gd\Color; +use Intervention\Image\Gd\Decoder; -class FillCommand extends \Intervention\Image\Commands\AbstractCommand +class FillCommand extends AbstractCommand { /** * Fills image with color or pattern diff --git a/src/Intervention/Image/Gd/Commands/GammaCommand.php b/src/Intervention/Image/Gd/Commands/GammaCommand.php index 366f1180..7de0fb8a 100644 --- a/src/Intervention/Image/Gd/Commands/GammaCommand.php +++ b/src/Intervention/Image/Gd/Commands/GammaCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class GammaCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class GammaCommand extends AbstractCommand { /** * Applies gamma correction to a given image diff --git a/src/Intervention/Image/Gd/Commands/GetSizeCommand.php b/src/Intervention/Image/Gd/Commands/GetSizeCommand.php index 89ee2848..9eb7e209 100644 --- a/src/Intervention/Image/Gd/Commands/GetSizeCommand.php +++ b/src/Intervention/Image/Gd/Commands/GetSizeCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Gd\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Size; -class GetSizeCommand extends \Intervention\Image\Commands\AbstractCommand +class GetSizeCommand extends AbstractCommand { /** * Reads size of given image instance in pixels diff --git a/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php b/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php index ded8e0d8..12921e79 100644 --- a/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php +++ b/src/Intervention/Image/Gd/Commands/GreyscaleCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class GreyscaleCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class GreyscaleCommand extends AbstractCommand { /** * Turns an image into a greyscale version diff --git a/src/Intervention/Image/Gd/Commands/InsertCommand.php b/src/Intervention/Image/Gd/Commands/InsertCommand.php index eba75f01..47c77039 100644 --- a/src/Intervention/Image/Gd/Commands/InsertCommand.php +++ b/src/Intervention/Image/Gd/Commands/InsertCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class InsertCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class InsertCommand extends AbstractCommand { /** * Insert another image into given image diff --git a/src/Intervention/Image/Gd/Commands/InterlaceCommand.php b/src/Intervention/Image/Gd/Commands/InterlaceCommand.php index e8f4b184..e3461cb0 100644 --- a/src/Intervention/Image/Gd/Commands/InterlaceCommand.php +++ b/src/Intervention/Image/Gd/Commands/InterlaceCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class InterlaceCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class InterlaceCommand extends AbstractCommand { /** * Toggles interlaced encoding mode diff --git a/src/Intervention/Image/Gd/Commands/InvertCommand.php b/src/Intervention/Image/Gd/Commands/InvertCommand.php index f72e7e30..1a514f1d 100644 --- a/src/Intervention/Image/Gd/Commands/InvertCommand.php +++ b/src/Intervention/Image/Gd/Commands/InvertCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class InvertCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class InvertCommand extends AbstractCommand { /** * Inverts colors of an image diff --git a/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php b/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php index 27955e79..0baed7e9 100644 --- a/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php +++ b/src/Intervention/Image/Gd/Commands/LimitColorsCommand.php @@ -2,8 +2,10 @@ namespace Intervention\Image\Gd\Commands; +use Intervention\Image\Commands\AbstractCommand; -class LimitColorsCommand extends \Intervention\Image\Commands\AbstractCommand + +class LimitColorsCommand extends AbstractCommand { /** * Reduces colors of a given image diff --git a/src/Intervention/Image/Gd/Commands/MaskCommand.php b/src/Intervention/Image/Gd/Commands/MaskCommand.php index ef88d4db..4c61429b 100644 --- a/src/Intervention/Image/Gd/Commands/MaskCommand.php +++ b/src/Intervention/Image/Gd/Commands/MaskCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class MaskCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class MaskCommand extends AbstractCommand { /** * Applies an alpha mask to an image diff --git a/src/Intervention/Image/Gd/Commands/OpacityCommand.php b/src/Intervention/Image/Gd/Commands/OpacityCommand.php index 081e68a4..48492d24 100644 --- a/src/Intervention/Image/Gd/Commands/OpacityCommand.php +++ b/src/Intervention/Image/Gd/Commands/OpacityCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class OpacityCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class OpacityCommand extends AbstractCommand { /** * Defines opacity of an image diff --git a/src/Intervention/Image/Gd/Commands/PickColorCommand.php b/src/Intervention/Image/Gd/Commands/PickColorCommand.php index 9fb4bb42..bad96f49 100644 --- a/src/Intervention/Image/Gd/Commands/PickColorCommand.php +++ b/src/Intervention/Image/Gd/Commands/PickColorCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Gd\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Gd\Color; -class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand +class PickColorCommand extends AbstractCommand { /** * Read color information from a certain position diff --git a/src/Intervention/Image/Gd/Commands/PixelCommand.php b/src/Intervention/Image/Gd/Commands/PixelCommand.php index 67f3e3b9..2a90ce34 100644 --- a/src/Intervention/Image/Gd/Commands/PixelCommand.php +++ b/src/Intervention/Image/Gd/Commands/PixelCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Gd\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Gd\Color; -class PixelCommand extends \Intervention\Image\Commands\AbstractCommand +class PixelCommand extends AbstractCommand { /** * Draws one pixel to a given image diff --git a/src/Intervention/Image/Gd/Commands/PixelateCommand.php b/src/Intervention/Image/Gd/Commands/PixelateCommand.php index 2e2093d7..0934797a 100644 --- a/src/Intervention/Image/Gd/Commands/PixelateCommand.php +++ b/src/Intervention/Image/Gd/Commands/PixelateCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class PixelateCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class PixelateCommand extends AbstractCommand { /** * Applies a pixelation effect to a given image diff --git a/src/Intervention/Image/Gd/Commands/ResetCommand.php b/src/Intervention/Image/Gd/Commands/ResetCommand.php index c8d2e4a1..12c41bf6 100644 --- a/src/Intervention/Image/Gd/Commands/ResetCommand.php +++ b/src/Intervention/Image/Gd/Commands/ResetCommand.php @@ -2,7 +2,10 @@ namespace Intervention\Image\Gd\Commands; -class ResetCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; +use Intervention\Image\Exception\RuntimeException; + +class ResetCommand extends AbstractCommand { /** * Resets given image to its backup state @@ -28,7 +31,7 @@ class ResetCommand extends \Intervention\Image\Commands\AbstractCommand return true; } - throw new \Intervention\Image\Exception\RuntimeException( + throw new RuntimeException( "Backup not available. Call backup() before reset()." ); } diff --git a/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php b/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php index 70739fff..73f3df30 100644 --- a/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php +++ b/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class ResizeCanvasCommand extends AbstractCommand { /** * Resizes image boundaries diff --git a/src/Intervention/Image/Gd/Commands/ResizeCommand.php b/src/Intervention/Image/Gd/Commands/ResizeCommand.php index b76df3a9..382d9709 100644 --- a/src/Intervention/Image/Gd/Commands/ResizeCommand.php +++ b/src/Intervention/Image/Gd/Commands/ResizeCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class ResizeCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class ResizeCommand extends AbstractCommand { /** * Resizes image dimensions diff --git a/src/Intervention/Image/Gd/Commands/RotateCommand.php b/src/Intervention/Image/Gd/Commands/RotateCommand.php index 698f514a..e02b9176 100644 --- a/src/Intervention/Image/Gd/Commands/RotateCommand.php +++ b/src/Intervention/Image/Gd/Commands/RotateCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Gd\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Gd\Color; -class RotateCommand extends \Intervention\Image\Commands\AbstractCommand +class RotateCommand extends AbstractCommand { /** * Rotates image counter clockwise diff --git a/src/Intervention/Image/Gd/Commands/SharpenCommand.php b/src/Intervention/Image/Gd/Commands/SharpenCommand.php index 4c0cc50f..782e5650 100644 --- a/src/Intervention/Image/Gd/Commands/SharpenCommand.php +++ b/src/Intervention/Image/Gd/Commands/SharpenCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Gd\Commands; -class SharpenCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class SharpenCommand extends AbstractCommand { /** * Sharpen image diff --git a/src/Intervention/Image/Gd/Decoder.php b/src/Intervention/Image/Gd/Decoder.php index 4fe821e5..6d2d7b4d 100644 --- a/src/Intervention/Image/Gd/Decoder.php +++ b/src/Intervention/Image/Gd/Decoder.php @@ -2,6 +2,8 @@ namespace Intervention\Image\Gd; +use Intervention\Image\Exception\NotReadableException; +use Intervention\Image\Exception\NotSupportedException; use Intervention\Image\Image; class Decoder extends \Intervention\Image\AbstractDecoder @@ -15,7 +17,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder public function initFromPath($path) { if ( ! file_exists($path)) { - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to find file ({$path})." ); } @@ -46,7 +48,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder case 'image/webp': case 'image/x-webp': if ( ! function_exists('imagecreatefromwebp')) { - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unsupported image type. GD/PHP installation does not support WebP format." ); } @@ -54,13 +56,13 @@ class Decoder extends \Intervention\Image\AbstractDecoder break; default: - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files." ); } if (empty($core)) { - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to decode image from file ({$path})." ); } @@ -94,7 +96,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder */ public function initFromImagick(\Imagick $object) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Gd driver is unable to init from Imagick object." ); } @@ -110,7 +112,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder $resource = @imagecreatefromstring($binary); if ($resource === false) { - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to init from given binary data." ); } diff --git a/src/Intervention/Image/Gd/Driver.php b/src/Intervention/Image/Gd/Driver.php index b5a2d72e..5f2f23ea 100644 --- a/src/Intervention/Image/Gd/Driver.php +++ b/src/Intervention/Image/Gd/Driver.php @@ -2,6 +2,9 @@ namespace Intervention\Image\Gd; +use Intervention\Image\Exception\NotSupportedException; +use Intervention\Image\Image; + class Driver extends \Intervention\Image\AbstractDriver { /** @@ -13,7 +16,7 @@ class Driver extends \Intervention\Image\AbstractDriver public function __construct(Decoder $decoder = null, Encoder $encoder = null) { if ( ! $this->coreAvailable()) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "GD Library extension not available with this PHP installation." ); } @@ -34,7 +37,7 @@ class Driver extends \Intervention\Image\AbstractDriver { // create empty resource $core = imagecreatetruecolor($width, $height); - $image = new \Intervention\Image\Image(new static, $core); + $image = new Image(new static, $core); // set background color $background = new Color($background); diff --git a/src/Intervention/Image/Gd/Encoder.php b/src/Intervention/Image/Gd/Encoder.php index a3fd2f12..d8cc0217 100644 --- a/src/Intervention/Image/Gd/Encoder.php +++ b/src/Intervention/Image/Gd/Encoder.php @@ -2,6 +2,8 @@ namespace Intervention\Image\Gd; +use Intervention\Image\Exception\NotSupportedException; + class Encoder extends \Intervention\Image\AbstractEncoder { /** @@ -58,7 +60,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder protected function processWebp() { if ( ! function_exists('imagewebp')) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Webp format is not supported by PHP installation." ); } @@ -79,7 +81,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder */ protected function processTiff() { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "TIFF format is not supported by Gd Driver." ); } @@ -91,7 +93,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder */ protected function processBmp() { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "BMP format is not supported by Gd Driver." ); } @@ -103,7 +105,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder */ protected function processIco() { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "ICO format is not supported by Gd Driver." ); } @@ -115,7 +117,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder */ protected function processPsd() { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "PSD format is not supported by Gd Driver." ); } diff --git a/src/Intervention/Image/Gd/Font.php b/src/Intervention/Image/Gd/Font.php index 828c7af7..47a7b15b 100644 --- a/src/Intervention/Image/Gd/Font.php +++ b/src/Intervention/Image/Gd/Font.php @@ -2,6 +2,7 @@ namespace Intervention\Image\Gd; +use Intervention\Image\Exception\NotSupportedException; use Intervention\Image\Image; class Font extends \Intervention\Image\AbstractFont @@ -27,7 +28,7 @@ class Font extends \Intervention\Image\AbstractFont $internalfont = is_numeric($internalfont) ? $internalfont : false; if ( ! in_array($internalfont, [1, 2, 3, 4, 5])) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( sprintf('Internal GD font (%s) not available. Use only 1-5.', $internalfont) ); } diff --git a/src/Intervention/Image/Gd/Shapes/EllipseShape.php b/src/Intervention/Image/Gd/Shapes/EllipseShape.php index c2e81c04..78e5e4a5 100644 --- a/src/Intervention/Image/Gd/Shapes/EllipseShape.php +++ b/src/Intervention/Image/Gd/Shapes/EllipseShape.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Gd\Shapes; -use Intervention\Image\Image; +use Intervention\Image\AbstractShape; use Intervention\Image\Gd\Color; +use Intervention\Image\Image; -class EllipseShape extends \Intervention\Image\AbstractShape +class EllipseShape extends AbstractShape { /** * Width of ellipse in pixels diff --git a/src/Intervention/Image/Gd/Shapes/LineShape.php b/src/Intervention/Image/Gd/Shapes/LineShape.php index c1eedd68..ea38b513 100644 --- a/src/Intervention/Image/Gd/Shapes/LineShape.php +++ b/src/Intervention/Image/Gd/Shapes/LineShape.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Gd\Shapes; -use Intervention\Image\Image; +use Intervention\Image\AbstractShape; use Intervention\Image\Gd\Color; +use Intervention\Image\Image; -class LineShape extends \Intervention\Image\AbstractShape +class LineShape extends AbstractShape { /** * Starting point x-coordinate of line diff --git a/src/Intervention/Image/Gd/Shapes/PolygonShape.php b/src/Intervention/Image/Gd/Shapes/PolygonShape.php index b11c6a11..5e14df40 100644 --- a/src/Intervention/Image/Gd/Shapes/PolygonShape.php +++ b/src/Intervention/Image/Gd/Shapes/PolygonShape.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Gd\Shapes; -use Intervention\Image\Image; +use Intervention\Image\AbstractShape; use Intervention\Image\Gd\Color; +use Intervention\Image\Image; -class PolygonShape extends \Intervention\Image\AbstractShape +class PolygonShape extends AbstractShape { /** * Array of points of polygon diff --git a/src/Intervention/Image/Gd/Shapes/RectangleShape.php b/src/Intervention/Image/Gd/Shapes/RectangleShape.php index 72449496..5f69a7f9 100644 --- a/src/Intervention/Image/Gd/Shapes/RectangleShape.php +++ b/src/Intervention/Image/Gd/Shapes/RectangleShape.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Gd\Shapes; -use Intervention\Image\Image; +use Intervention\Image\AbstractShape; use Intervention\Image\Gd\Color; +use Intervention\Image\Image; -class RectangleShape extends \Intervention\Image\AbstractShape +class RectangleShape extends AbstractShape { /** * X-Coordinate of top-left point diff --git a/src/Intervention/Image/Image.php b/src/Intervention/Image/Image.php index e577e7e8..2c4d3140 100644 --- a/src/Intervention/Image/Image.php +++ b/src/Intervention/Image/Image.php @@ -2,6 +2,8 @@ namespace Intervention\Image; +use Intervention\Image\Exception\NotWritableException; +use Intervention\Image\Exception\RuntimeException; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; @@ -131,7 +133,7 @@ class Image extends File $path = is_null($path) ? $this->basePath() : $path; if (is_null($path)) { - throw new Exception\NotWritableException( + throw new NotWritableException( "Can't write to undefined path." ); } @@ -140,7 +142,7 @@ class Image extends File $saved = @file_put_contents($path, $data); if ($saved === false) { - throw new Exception\NotWritableException( + throw new NotWritableException( "Can't write image data to path ({$path})" ); } @@ -216,7 +218,7 @@ class Image extends File $name = is_null($name) ? 'default' : $name; if ( ! $this->backupExists($name)) { - throw new \Intervention\Image\Exception\RuntimeException( + throw new RuntimeException( "Backup with name ({$name}) not available. Call backup() before reset()." ); } diff --git a/src/Intervention/Image/ImageManager.php b/src/Intervention/Image/ImageManager.php index 7c9f1c91..324fe7fa 100644 --- a/src/Intervention/Image/ImageManager.php +++ b/src/Intervention/Image/ImageManager.php @@ -3,6 +3,8 @@ namespace Intervention\Image; use Closure; +use Intervention\Image\Exception\MissingDependencyException; +use Intervention\Image\Exception\NotSupportedException; class ImageManager { @@ -90,7 +92,7 @@ class ImageManager return $imagecache->get($lifetime, $returnObj); } - throw new \Intervention\Image\Exception\MissingDependencyException( + throw new MissingDependencyException( "Please install package intervention/imagecache before running this function." ); } @@ -110,7 +112,7 @@ class ImageManager return new $driverclass; } - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Driver ({$drivername}) could not be instantiated." ); } @@ -119,7 +121,7 @@ class ImageManager return $this->config['driver']; } - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Unknown driver type." ); } @@ -132,7 +134,7 @@ class ImageManager private function checkRequirements() { if ( ! function_exists('finfo_buffer')) { - throw new \Intervention\Image\Exception\MissingDependencyException( + throw new MissingDependencyException( "PHP Fileinfo extension must be installed/enabled to use Intervention Image." ); } diff --git a/src/Intervention/Image/ImageServiceProvider.php b/src/Intervention/Image/ImageServiceProvider.php index 1e6351df..e106d06c 100644 --- a/src/Intervention/Image/ImageServiceProvider.php +++ b/src/Intervention/Image/ImageServiceProvider.php @@ -3,6 +3,8 @@ namespace Intervention\Image; use Illuminate\Support\ServiceProvider; +use Laravel\Lumen\Application as LumenApplication; +use Illuminate\Foundation\Application as IlluminateApplication; class ImageServiceProvider extends ServiceProvider { @@ -62,9 +64,9 @@ class ImageServiceProvider extends ServiceProvider */ private function getProvider() { - if ($this->app instanceof \Laravel\Lumen\Application) { + if ($this->app instanceof LumenApplication) { $provider = '\Intervention\Image\ImageServiceProviderLumen'; - } elseif (version_compare(\Illuminate\Foundation\Application::VERSION, '5.0', '<')) { + } elseif (version_compare(IlluminateApplication::VERSION, '5.0', '<')) { $provider = '\Intervention\Image\ImageServiceProviderLaravel4'; } else { $provider = '\Intervention\Image\ImageServiceProviderLaravel5'; diff --git a/src/Intervention/Image/Imagick/Color.php b/src/Intervention/Image/Imagick/Color.php index 91db8217..a41ff3a6 100644 --- a/src/Intervention/Image/Imagick/Color.php +++ b/src/Intervention/Image/Imagick/Color.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick; -class Color extends \Intervention\Image\AbstractColor +use Intervention\Image\AbstractColor; + +class Color extends AbstractColor { /** * ImagickPixel containing current color information @@ -178,7 +180,7 @@ class Color extends \Intervention\Image\AbstractColor * @param int $tolerance * @return boolean */ - public function differs(\Intervention\Image\AbstractColor $color, $tolerance = 0) + public function differs(AbstractColor $color, $tolerance = 0) { $color_tolerance = round($tolerance * 2.55); $alpha_tolerance = round($tolerance); diff --git a/src/Intervention/Image/Imagick/Commands/BackupCommand.php b/src/Intervention/Image/Imagick/Commands/BackupCommand.php index 60dedb2b..76b4f72b 100644 --- a/src/Intervention/Image/Imagick/Commands/BackupCommand.php +++ b/src/Intervention/Image/Imagick/Commands/BackupCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class BackupCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class BackupCommand extends AbstractCommand { /** * Saves a backups of current state of image core diff --git a/src/Intervention/Image/Imagick/Commands/BlurCommand.php b/src/Intervention/Image/Imagick/Commands/BlurCommand.php index b037c151..d2533e0e 100644 --- a/src/Intervention/Image/Imagick/Commands/BlurCommand.php +++ b/src/Intervention/Image/Imagick/Commands/BlurCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class BlurCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class BlurCommand extends AbstractCommand { /** * Applies blur effect on image diff --git a/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php b/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php index eefb1802..03ac8478 100644 --- a/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php +++ b/src/Intervention/Image/Imagick/Commands/BrightnessCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class BrightnessCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class BrightnessCommand extends AbstractCommand { /** * Changes image brightness diff --git a/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php b/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php index 51142be2..3a6506f6 100644 --- a/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ColorizeCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class ColorizeCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class ColorizeCommand extends AbstractCommand { /** * Changes balance of different RGB color channels diff --git a/src/Intervention/Image/Imagick/Commands/ContrastCommand.php b/src/Intervention/Image/Imagick/Commands/ContrastCommand.php index 113a2186..c4847c61 100644 --- a/src/Intervention/Image/Imagick/Commands/ContrastCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ContrastCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class ContrastCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class ContrastCommand extends AbstractCommand { /** * Changes contrast of image diff --git a/src/Intervention/Image/Imagick/Commands/CropCommand.php b/src/Intervention/Image/Imagick/Commands/CropCommand.php index 21c7184b..618edea7 100644 --- a/src/Intervention/Image/Imagick/Commands/CropCommand.php +++ b/src/Intervention/Image/Imagick/Commands/CropCommand.php @@ -2,10 +2,12 @@ namespace Intervention\Image\Imagick\Commands; +use Intervention\Image\Commands\AbstractCommand; +use Intervention\Image\Exception\InvalidArgumentException; use Intervention\Image\Point; use Intervention\Image\Size; -class CropCommand extends \Intervention\Image\Commands\AbstractCommand +class CropCommand extends AbstractCommand { /** * Crop an image instance @@ -21,7 +23,7 @@ class CropCommand extends \Intervention\Image\Commands\AbstractCommand $y = $this->argument(3)->type('digit')->value(); if (is_null($width) || is_null($height)) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( "Width and height of cutout needs to be defined." ); } diff --git a/src/Intervention/Image/Imagick/Commands/DestroyCommand.php b/src/Intervention/Image/Imagick/Commands/DestroyCommand.php index d98062d8..58c9556e 100644 --- a/src/Intervention/Image/Imagick/Commands/DestroyCommand.php +++ b/src/Intervention/Image/Imagick/Commands/DestroyCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class DestroyCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class DestroyCommand extends AbstractCommand { /** * Destroys current image core and frees up memory diff --git a/src/Intervention/Image/Imagick/Commands/ExifCommand.php b/src/Intervention/Image/Imagick/Commands/ExifCommand.php index 924522ca..521b38b0 100644 --- a/src/Intervention/Image/Imagick/Commands/ExifCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ExifCommand.php @@ -3,6 +3,7 @@ namespace Intervention\Image\Imagick\Commands; use Intervention\Image\Commands\ExifCommand as BaseCommand; +use Intervention\Image\Exception\NotSupportedException; class ExifCommand extends BaseCommand { @@ -35,7 +36,7 @@ class ExifCommand extends BaseCommand $core = $image->getCore(); if ( ! method_exists($core, 'getImageProperties')) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Reading Exif data is not supported by this PHP installation." ); } diff --git a/src/Intervention/Image/Imagick/Commands/FillCommand.php b/src/Intervention/Image/Imagick/Commands/FillCommand.php index bfac75fb..82baac53 100644 --- a/src/Intervention/Image/Imagick/Commands/FillCommand.php +++ b/src/Intervention/Image/Imagick/Commands/FillCommand.php @@ -2,11 +2,13 @@ namespace Intervention\Image\Imagick\Commands; +use Intervention\Image\Commands\AbstractCommand; +use Intervention\Image\Exception\NotReadableException; use Intervention\Image\Image; -use Intervention\Image\Imagick\Decoder; use Intervention\Image\Imagick\Color; +use Intervention\Image\Imagick\Decoder; -class FillCommand extends \Intervention\Image\Commands\AbstractCommand +class FillCommand extends AbstractCommand { /** * Fills image with color or pattern @@ -27,7 +29,7 @@ class FillCommand extends \Intervention\Image\Commands\AbstractCommand $source = new Decoder; $filling = $source->init($filling); - } catch (\Intervention\Image\Exception\NotReadableException $e) { + } catch (NotReadableException $e) { // set solid color filling $filling = new Color($filling); diff --git a/src/Intervention/Image/Imagick/Commands/FitCommand.php b/src/Intervention/Image/Imagick/Commands/FitCommand.php index f2c60d21..6d62ba67 100644 --- a/src/Intervention/Image/Imagick/Commands/FitCommand.php +++ b/src/Intervention/Image/Imagick/Commands/FitCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Imagick\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Size; -class FitCommand extends \Intervention\Image\Commands\AbstractCommand +class FitCommand extends AbstractCommand { /** * Crops and resized an image at the same time diff --git a/src/Intervention/Image/Imagick/Commands/FlipCommand.php b/src/Intervention/Image/Imagick/Commands/FlipCommand.php index cdb03c52..abae16ad 100644 --- a/src/Intervention/Image/Imagick/Commands/FlipCommand.php +++ b/src/Intervention/Image/Imagick/Commands/FlipCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class FlipCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class FlipCommand extends AbstractCommand { /** * Mirrors an image diff --git a/src/Intervention/Image/Imagick/Commands/GammaCommand.php b/src/Intervention/Image/Imagick/Commands/GammaCommand.php index e70cbdd3..200515f3 100644 --- a/src/Intervention/Image/Imagick/Commands/GammaCommand.php +++ b/src/Intervention/Image/Imagick/Commands/GammaCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class GammaCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class GammaCommand extends AbstractCommand { /** * Applies gamma correction to a given image diff --git a/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php b/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php index 65b1078d..ccccedb0 100644 --- a/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php +++ b/src/Intervention/Image/Imagick/Commands/GetSizeCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Imagick\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Size; -class GetSizeCommand extends \Intervention\Image\Commands\AbstractCommand +class GetSizeCommand extends AbstractCommand { /** * Reads size of given image instance in pixels diff --git a/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php b/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php index bb3f4726..df0ff5b5 100644 --- a/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php +++ b/src/Intervention/Image/Imagick/Commands/GreyscaleCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class GreyscaleCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class GreyscaleCommand extends AbstractCommand { /** * Turns an image into a greyscale version diff --git a/src/Intervention/Image/Imagick/Commands/InsertCommand.php b/src/Intervention/Image/Imagick/Commands/InsertCommand.php index 542feb2a..2a997436 100644 --- a/src/Intervention/Image/Imagick/Commands/InsertCommand.php +++ b/src/Intervention/Image/Imagick/Commands/InsertCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class InsertCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class InsertCommand extends AbstractCommand { /** * Insert another image into given image diff --git a/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php b/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php index 82cddd4c..913cab7e 100644 --- a/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php +++ b/src/Intervention/Image/Imagick/Commands/InterlaceCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class InterlaceCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class InterlaceCommand extends AbstractCommand { /** * Toggles interlaced encoding mode diff --git a/src/Intervention/Image/Imagick/Commands/InvertCommand.php b/src/Intervention/Image/Imagick/Commands/InvertCommand.php index 125fbdde..1d134301 100644 --- a/src/Intervention/Image/Imagick/Commands/InvertCommand.php +++ b/src/Intervention/Image/Imagick/Commands/InvertCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class InvertCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class InvertCommand extends AbstractCommand { /** * Inverts colors of an image diff --git a/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php b/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php index 7308180f..16f9b82e 100644 --- a/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php +++ b/src/Intervention/Image/Imagick/Commands/LimitColorsCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class LimitColorsCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class LimitColorsCommand extends AbstractCommand { /** * Reduces colors of a given image diff --git a/src/Intervention/Image/Imagick/Commands/MaskCommand.php b/src/Intervention/Image/Imagick/Commands/MaskCommand.php index 2dfc697b..af9d6b2f 100644 --- a/src/Intervention/Image/Imagick/Commands/MaskCommand.php +++ b/src/Intervention/Image/Imagick/Commands/MaskCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class MaskCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class MaskCommand extends AbstractCommand { /** * Applies an alpha mask to an image diff --git a/src/Intervention/Image/Imagick/Commands/OpacityCommand.php b/src/Intervention/Image/Imagick/Commands/OpacityCommand.php index 57ed006b..b4708d89 100644 --- a/src/Intervention/Image/Imagick/Commands/OpacityCommand.php +++ b/src/Intervention/Image/Imagick/Commands/OpacityCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class OpacityCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class OpacityCommand extends AbstractCommand { /** * Defines opacity of an image diff --git a/src/Intervention/Image/Imagick/Commands/PickColorCommand.php b/src/Intervention/Image/Imagick/Commands/PickColorCommand.php index 8daa0f95..978a1284 100644 --- a/src/Intervention/Image/Imagick/Commands/PickColorCommand.php +++ b/src/Intervention/Image/Imagick/Commands/PickColorCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Imagick\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Imagick\Color; -class PickColorCommand extends \Intervention\Image\Commands\AbstractCommand +class PickColorCommand extends AbstractCommand { /** * Read color information from a certain position diff --git a/src/Intervention/Image/Imagick/Commands/PixelCommand.php b/src/Intervention/Image/Imagick/Commands/PixelCommand.php index b9e6d395..6eb6ae71 100644 --- a/src/Intervention/Image/Imagick/Commands/PixelCommand.php +++ b/src/Intervention/Image/Imagick/Commands/PixelCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Imagick\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Imagick\Color; -class PixelCommand extends \Intervention\Image\Commands\AbstractCommand +class PixelCommand extends AbstractCommand { /** * Draws one pixel to a given image diff --git a/src/Intervention/Image/Imagick/Commands/PixelateCommand.php b/src/Intervention/Image/Imagick/Commands/PixelateCommand.php index 75f2218f..6fe79491 100644 --- a/src/Intervention/Image/Imagick/Commands/PixelateCommand.php +++ b/src/Intervention/Image/Imagick/Commands/PixelateCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class PixelateCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class PixelateCommand extends AbstractCommand { /** * Applies a pixelation effect to a given image diff --git a/src/Intervention/Image/Imagick/Commands/ResetCommand.php b/src/Intervention/Image/Imagick/Commands/ResetCommand.php index ee5a2cdf..77b7f336 100644 --- a/src/Intervention/Image/Imagick/Commands/ResetCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ResetCommand.php @@ -2,7 +2,10 @@ namespace Intervention\Image\Imagick\Commands; -class ResetCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; +use Intervention\Image\Exception\RuntimeException; + +class ResetCommand extends AbstractCommand { /** * Resets given image to its backup state @@ -30,7 +33,7 @@ class ResetCommand extends \Intervention\Image\Commands\AbstractCommand return true; } - throw new \Intervention\Image\Exception\RuntimeException( + throw new RuntimeException( "Backup not available. Call backup({$backupName}) before reset()." ); } diff --git a/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php b/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php index f394c15d..ecf07610 100644 --- a/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class ResizeCanvasCommand extends AbstractCommand { /** * Resizes image boundaries diff --git a/src/Intervention/Image/Imagick/Commands/ResizeCommand.php b/src/Intervention/Image/Imagick/Commands/ResizeCommand.php index 9ccc202c..3d4dc5be 100644 --- a/src/Intervention/Image/Imagick/Commands/ResizeCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ResizeCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class ResizeCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class ResizeCommand extends AbstractCommand { /** * Resizes image dimensions diff --git a/src/Intervention/Image/Imagick/Commands/RotateCommand.php b/src/Intervention/Image/Imagick/Commands/RotateCommand.php index c4503a6c..edaef0d3 100644 --- a/src/Intervention/Image/Imagick/Commands/RotateCommand.php +++ b/src/Intervention/Image/Imagick/Commands/RotateCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Imagick\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Imagick\Color; -class RotateCommand extends \Intervention\Image\Commands\AbstractCommand +class RotateCommand extends AbstractCommand { /** * Rotates image counter clockwise diff --git a/src/Intervention/Image/Imagick/Commands/SharpenCommand.php b/src/Intervention/Image/Imagick/Commands/SharpenCommand.php index 4f2fc8c2..bc5e393f 100644 --- a/src/Intervention/Image/Imagick/Commands/SharpenCommand.php +++ b/src/Intervention/Image/Imagick/Commands/SharpenCommand.php @@ -2,7 +2,9 @@ namespace Intervention\Image\Imagick\Commands; -class SharpenCommand extends \Intervention\Image\Commands\AbstractCommand +use Intervention\Image\Commands\AbstractCommand; + +class SharpenCommand extends AbstractCommand { /** * Sharpen image diff --git a/src/Intervention/Image/Imagick/Commands/TrimCommand.php b/src/Intervention/Image/Imagick/Commands/TrimCommand.php index f0959032..bdc897be 100644 --- a/src/Intervention/Image/Imagick/Commands/TrimCommand.php +++ b/src/Intervention/Image/Imagick/Commands/TrimCommand.php @@ -2,9 +2,10 @@ namespace Intervention\Image\Imagick\Commands; +use Intervention\Image\Commands\AbstractCommand; use Intervention\Image\Imagick\Color; -class TrimCommand extends \Intervention\Image\Commands\AbstractCommand +class TrimCommand extends AbstractCommand { /** * Trims away parts of an image diff --git a/src/Intervention/Image/Imagick/Decoder.php b/src/Intervention/Image/Imagick/Decoder.php index 8cf2420a..f4dde9a8 100644 --- a/src/Intervention/Image/Imagick/Decoder.php +++ b/src/Intervention/Image/Imagick/Decoder.php @@ -2,9 +2,12 @@ namespace Intervention\Image\Imagick; +use Intervention\Image\AbstractDecoder; +use Intervention\Image\Exception\NotReadableException; +use Intervention\Image\Exception\NotSupportedException; use Intervention\Image\Image; -class Decoder extends \Intervention\Image\AbstractDecoder +class Decoder extends AbstractDecoder { /** * Initiates new image from path in filesystem @@ -45,7 +48,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder */ public function initFromGdResource($resource) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( 'Imagick driver is unable to init from GD resource.' ); } @@ -84,7 +87,7 @@ class Decoder extends \Intervention\Image\AbstractDecoder $core->readImageBlob($binary); } catch (\ImagickException $e) { - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to read image from binary data.", 0, $e diff --git a/src/Intervention/Image/Imagick/Driver.php b/src/Intervention/Image/Imagick/Driver.php index 1f2fcc6c..bb26ca0f 100644 --- a/src/Intervention/Image/Imagick/Driver.php +++ b/src/Intervention/Image/Imagick/Driver.php @@ -2,7 +2,11 @@ namespace Intervention\Image\Imagick; -class Driver extends \Intervention\Image\AbstractDriver +use Intervention\Image\AbstractDriver; +use Intervention\Image\Exception\NotSupportedException; +use Intervention\Image\Image; + +class Driver extends AbstractDriver { /** * Creates new instance of driver @@ -13,7 +17,7 @@ class Driver extends \Intervention\Image\AbstractDriver public function __construct(Decoder $decoder = null, Encoder $encoder = null) { if ( ! $this->coreAvailable()) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "ImageMagick module not available with this PHP installation." ); } @@ -42,7 +46,7 @@ class Driver extends \Intervention\Image\AbstractDriver $core->setColorspace(\Imagick::COLORSPACE_UNDEFINED); // build image - $image = new \Intervention\Image\Image(new static, $core); + $image = new Image(new static, $core); return $image; } diff --git a/src/Intervention/Image/Imagick/Encoder.php b/src/Intervention/Image/Imagick/Encoder.php index 6c20410b..ac7345e4 100644 --- a/src/Intervention/Image/Imagick/Encoder.php +++ b/src/Intervention/Image/Imagick/Encoder.php @@ -2,7 +2,10 @@ namespace Intervention\Image\Imagick; -class Encoder extends \Intervention\Image\AbstractEncoder +use Intervention\Image\AbstractEncoder; +use Intervention\Image\Exception\NotSupportedException; + +class Encoder extends AbstractEncoder { /** * Processes and returns encoded image as JPEG string @@ -69,7 +72,7 @@ class Encoder extends \Intervention\Image\AbstractEncoder protected function processWebp() { if ( ! \Imagick::queryFormats('WEBP')) { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Webp format is not supported by Imagick installation." ); } diff --git a/src/Intervention/Image/Imagick/Font.php b/src/Intervention/Image/Imagick/Font.php index 62d2ef24..0c5002a4 100644 --- a/src/Intervention/Image/Imagick/Font.php +++ b/src/Intervention/Image/Imagick/Font.php @@ -2,9 +2,11 @@ namespace Intervention\Image\Imagick; +use Intervention\Image\AbstractFont; +use Intervention\Image\Exception\RuntimeException; use Intervention\Image\Image; -class Font extends \Intervention\Image\AbstractFont +class Font extends AbstractFont { /** * Draws font to given image at given position @@ -25,7 +27,7 @@ class Font extends \Intervention\Image\AbstractFont if ($this->hasApplicableFontFile()) { $draw->setFont($this->file); } else { - throw new \Intervention\Image\Exception\RuntimeException( + throw new RuntimeException( "Font file must be provided to apply text to image." ); } @@ -95,7 +97,7 @@ class Font extends \Intervention\Image\AbstractFont if ($this->hasApplicableFontFile()) { $draw->setFont($this->file); } else { - throw new \Intervention\Image\Exception\RuntimeException( + throw new RuntimeException( "Font file must be provided to apply text to image." ); } diff --git a/src/Intervention/Image/Imagick/Shapes/EllipseShape.php b/src/Intervention/Image/Imagick/Shapes/EllipseShape.php index 1b89942f..99694b97 100644 --- a/src/Intervention/Image/Imagick/Shapes/EllipseShape.php +++ b/src/Intervention/Image/Imagick/Shapes/EllipseShape.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Imagick\Shapes; +use Intervention\Image\AbstractShape; use Intervention\Image\Image; use Intervention\Image\Imagick\Color; -class EllipseShape extends \Intervention\Image\AbstractShape +class EllipseShape extends AbstractShape { /** * Width of ellipse in pixels diff --git a/src/Intervention/Image/Imagick/Shapes/LineShape.php b/src/Intervention/Image/Imagick/Shapes/LineShape.php index 638b97b6..0d6b3297 100644 --- a/src/Intervention/Image/Imagick/Shapes/LineShape.php +++ b/src/Intervention/Image/Imagick/Shapes/LineShape.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Imagick\Shapes; +use Intervention\Image\AbstractShape; use Intervention\Image\Image; use Intervention\Image\Imagick\Color; -class LineShape extends \Intervention\Image\AbstractShape +class LineShape extends AbstractShape { /** * Starting point x-coordinate of line diff --git a/src/Intervention/Image/Imagick/Shapes/PolygonShape.php b/src/Intervention/Image/Imagick/Shapes/PolygonShape.php index 4c087b37..45f44ad8 100644 --- a/src/Intervention/Image/Imagick/Shapes/PolygonShape.php +++ b/src/Intervention/Image/Imagick/Shapes/PolygonShape.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Imagick\Shapes; +use Intervention\Image\AbstractShape; use Intervention\Image\Image; use Intervention\Image\Imagick\Color; -class PolygonShape extends \Intervention\Image\AbstractShape +class PolygonShape extends AbstractShape { /** * Array of points of polygon diff --git a/src/Intervention/Image/Imagick/Shapes/RectangleShape.php b/src/Intervention/Image/Imagick/Shapes/RectangleShape.php index 2d1a09f5..1166d77b 100644 --- a/src/Intervention/Image/Imagick/Shapes/RectangleShape.php +++ b/src/Intervention/Image/Imagick/Shapes/RectangleShape.php @@ -2,10 +2,11 @@ namespace Intervention\Image\Imagick\Shapes; +use Intervention\Image\AbstractShape; use Intervention\Image\Image; use Intervention\Image\Imagick\Color; -class RectangleShape extends \Intervention\Image\AbstractShape +class RectangleShape extends AbstractShape { /** * X-Coordinate of top-left point diff --git a/src/Intervention/Image/Response.php b/src/Intervention/Image/Response.php index e883cac4..8e794081 100644 --- a/src/Intervention/Image/Response.php +++ b/src/Intervention/Image/Response.php @@ -2,6 +2,9 @@ namespace Intervention\Image; +use Illuminate\Support\Facades\Response as IlluminateResponse; +use Symfony\Component\HttpFoundation\Response as SymfonyResponse; + class Response { /** @@ -53,13 +56,13 @@ class Response if (function_exists('app') && is_a($app = app(), 'Illuminate\Foundation\Application')) { - $response = \Illuminate\Support\Facades\Response::make($data); + $response = IlluminateResponse::make($data); $response->header('Content-Type', $mime); $response->header('Content-Length', $length); } elseif (class_exists('\Symfony\Component\HttpFoundation\Response')) { - $response = \Symfony\Component\HttpFoundation\Response::create($data); + $response = SymfonyResponse::create($data); $response->headers->set('Content-Type', $mime); $response->headers->set('Content-Length', $length); diff --git a/src/Intervention/Image/Size.php b/src/Intervention/Image/Size.php index b01376a8..46ae3135 100644 --- a/src/Intervention/Image/Size.php +++ b/src/Intervention/Image/Size.php @@ -3,6 +3,7 @@ namespace Intervention\Image; use Closure; +use Intervention\Image\Exception\InvalidArgumentException; class Size { @@ -104,7 +105,7 @@ class Size public function resize($width, $height, Closure $callback = null) { if (is_null($width) && is_null($height)) { - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( "Width or height needs to be defined." ); }