diff --git a/src/Intervention/Image/AbstractColor.php b/src/Intervention/Image/AbstractColor.php index 28cbaf29d..c9846c6ae 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 @@ public function parse($value) break; default: - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Color format ({$value}) cannot be read." ); } @@ -172,7 +175,7 @@ public function format($type) return $this; default: - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Color format ({$type}) is not supported." ); } @@ -216,7 +219,7 @@ protected function rgbaFromString($value) $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 235520e38..de770c328 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 @@ public function initFromUrl($url) return $this->initFromBinary($data); } - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to init from given url (".$url.")." ); } @@ -123,7 +124,7 @@ public function initFromStream($stream) return $this->initFromBinary($data); } - throw new \Intervention\Image\Exception\NotReadableException( + throw new NotReadableException( "Unable to init from given stream" ); } @@ -342,7 +343,7 @@ public function init($data) 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 29ad9d598..d2356ae80 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 @@ private function getCommandClassName($name) 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 357b8f487..d3e59eaa4 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 @@ public function process(Image $image, $format = null, $quality = null) break; default: - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Encoding format ({$format}) is not supported." ); } @@ -229,7 +232,7 @@ protected function setQuality($quality) $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 cf9ca1083..e31078ceb 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 @@ public function __construct($arguments) */ 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 e64e8ac54..9538199f6 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 @@ public function value($default = null) 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 @@ public function type($type) $message = sprintf('Missing argument for %d.', $argument); } - throw new \Intervention\Image\Exception\InvalidArgumentException( + throw new InvalidArgumentException( $message ); } @@ -158,7 +160,7 @@ public function between($x, $y) $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 @@ public function min($value) } 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 @@ public function max($value) } 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 2fc38ddf8..c627818e3 100644 --- a/src/Intervention/Image/Commands/CircleCommand.php +++ b/src/Intervention/Image/Commands/CircleCommand.php @@ -4,7 +4,7 @@ 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 4f364eca1..4637e0205 100644 --- a/src/Intervention/Image/Commands/EllipseCommand.php +++ b/src/Intervention/Image/Commands/EllipseCommand.php @@ -4,7 +4,7 @@ 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 8c581b17b..7103f2fd3 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 88e8fd35b..ae953d200 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 0089c649a..a068c662a 100644 --- a/src/Intervention/Image/Commands/LineCommand.php +++ b/src/Intervention/Image/Commands/LineCommand.php @@ -4,7 +4,7 @@ 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 e46e3fffb..a2fa99788 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 @@ public function execute($image) // 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 3a2074c57..24378b386 100644 --- a/src/Intervention/Image/Commands/RectangleCommand.php +++ b/src/Intervention/Image/Commands/RectangleCommand.php @@ -4,7 +4,7 @@ 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 4aebd8e89..3c60b4e77 100644 --- a/src/Intervention/Image/Commands/TextCommand.php +++ b/src/Intervention/Image/Commands/TextCommand.php @@ -4,7 +4,7 @@ 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 f5aac05bf..4e8f92b82 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 @@ public function __construct($size = null) * @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 27c0beef4..88f6cbfe0 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 71a889f1c..44370ba09 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 @@ public function initFromRgba($r, $g, $b, $a = 1) */ 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 98b3c7250..310dc03a9 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 d53f59d7c..c4fca0eae 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 de4263f74..4e48464b1 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 8f539638b..410917b33 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 e43b761af..916c41f82 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 18383307a..4503d10fe 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 aaecb7fb9..cf1908210 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 366f11808..7de0fb8a1 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 89ee2848f..9eb7e2092 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 ded8e0d8f..12921e79e 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 eba75f012..47c770398 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 e8f4b184c..e3461cb07 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 f72e7e305..1a514f1d4 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 27955e79a..0baed7e91 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 ef88d4dba..4c61429b2 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 081e68a4a..48492d24f 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 9fb4bb422..bad96f498 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 67f3e3b95..2a90ce34f 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 2e2093d7d..0934797a8 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 c8d2e4a12..12c41bf6e 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 @@ public function execute($image) 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 70739fff9..73f3df308 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 b76df3a9f..382d9709e 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 698f514a3..e02b91760 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 4c0cc50f5..782e56502 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 4fe821e5e..6d2d7b4d3 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 @@ public function initFromPath($path) 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 @@ public function initFromPath($path) 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 @@ public function initFromGdResource($resource) */ 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 @@ public function initFromBinary($binary) $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 b5a2d72ee..5f2f23ea3 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 @@ public function newImage($width, $height, $background = null) { // 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 a3fd2f127..d8cc02178 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 @@ protected function processGif() 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 @@ protected function processWebp() */ protected function processTiff() { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "TIFF format is not supported by Gd Driver." ); } @@ -91,7 +93,7 @@ protected function processTiff() */ protected function processBmp() { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "BMP format is not supported by Gd Driver." ); } @@ -103,7 +105,7 @@ protected function processBmp() */ protected function processIco() { - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "ICO format is not supported by Gd Driver." ); } @@ -115,7 +117,7 @@ protected function processIco() */ 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 828c7af70..47a7b15bd 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 @@ private function getInternalFont() $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 c2e81c04e..78e5e4a59 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 c1eedd688..ea38b513e 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 b11c6a11b..5e14df40e 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 724494963..5f69a7f92 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 e577e7e83..2c4d3140a 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 @@ public function save($path = null, $quality = null) $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 @@ public function save($path = null, $quality = null) $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 @@ public function getBackup($name = null) $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 7c9f1c91f..324fe7fa3 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 @@ public function cache(Closure $callback, $lifetime = null, $returnObj = false) 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 @@ private function createDriver() return new $driverclass; } - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Driver ({$drivername}) could not be instantiated." ); } @@ -119,7 +121,7 @@ private function createDriver() return $this->config['driver']; } - throw new \Intervention\Image\Exception\NotSupportedException( + throw new NotSupportedException( "Unknown driver type." ); } @@ -132,7 +134,7 @@ private function createDriver() 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 1e6351df7..e106d06cb 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 @@ public function register() */ 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 91db8217c..a41ff3a6e 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 @@ public function getRgba() * @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 60dedb2b7..76b4f72bb 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 b037c1516..d2533e0ea 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 eefb1802c..03ac8478d 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 51142be27..3a6506f6d 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 113a2186c..c4847c61d 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 21c7184b7..618edea7d 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 @@ public function execute($image) $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 d98062d8a..58c9556e4 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 924522caf..521b38b09 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 @@ public function execute($image) $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 bfac75fbf..82baac532 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 @@ public function execute($image) $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 f2c60d219..6d62ba677 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 cdb03c52d..abae16ad1 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 e70cbdd36..200515f3b 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 65b1078d1..ccccedb03 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 bb3f47260..df0ff5b57 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 542feb2ae..2a9974367 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 82cddd4c6..913cab7e0 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 125fbddee..1d134301b 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 7308180f6..16f9b82e9 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 2dfc697b0..af9d6b2f5 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 57ed006b8..b4708d899 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 8daa0f95a..978a1284e 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 b9e6d395d..6eb6ae715 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 75f2218f5..6fe794913 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 ee5a2cdf3..77b7f3366 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 @@ public function execute($image) 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 f394c15dc..ecf076106 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 9ccc202c2..3d4dc5bed 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 c4503a6ca..edaef0d3f 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 4f2fc8c29..bc5e393f2 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 f09590320..bdc897be7 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 8cf2420ae..f4dde9a84 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 @@ public function initFromPath($path) */ 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 @@ public function initFromBinary($binary) $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 1f2fcc6c1..bb26ca0fe 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 @@ public function newImage($width, $height, $background = null) $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 6c20410b2..ac7345e4a 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 @@ protected function processGif() 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 62d2ef243..0c5002a47 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 @@ public function applyToImage(Image $image, $posx = 0, $posy = 0) 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 @@ public function getBoxSize() 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 1b89942fd..99694b97b 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 638b97b67..0d6b3297d 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 4c087b374..45f44ad88 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 2d1a09f5c..1166d77b7 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 e883cac45..8e7940811 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 @@ public function make() 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 b01376a80..46ae3135e 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 @@ public function getRatio() 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." ); }