From 836026b47fa08fe785e677d7ac15b43c47229688 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sun, 23 Apr 2017 03:01:16 +0200 Subject: [PATCH 1/2] Minor phpdoc fixes --- src/Intervention/Image/AbstractColor.php | 2 +- src/Intervention/Image/Gd/Driver.php | 2 +- src/Intervention/Image/Image.php | 6 +++--- src/Intervention/Image/Imagick/Driver.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Intervention/Image/AbstractColor.php b/src/Intervention/Image/AbstractColor.php index 61864951..59279205 100644 --- a/src/Intervention/Image/AbstractColor.php +++ b/src/Intervention/Image/AbstractColor.php @@ -98,7 +98,7 @@ abstract class AbstractColor /** * Creates new instance * - * @param string $value + * @param mixed $value */ public function __construct($value = null) { diff --git a/src/Intervention/Image/Gd/Driver.php b/src/Intervention/Image/Gd/Driver.php index 28612fc9..6179f08f 100644 --- a/src/Intervention/Image/Gd/Driver.php +++ b/src/Intervention/Image/Gd/Driver.php @@ -27,7 +27,7 @@ class Driver extends \Intervention\Image\AbstractDriver * * @param integer $width * @param integer $height - * @param string $background + * @param mixed $background * @return \Intervention\Image\Image */ public function newImage($width, $height, $background = null) diff --git a/src/Intervention/Image/Image.php b/src/Intervention/Image/Image.php index 8eade9d3..72268449 100644 --- a/src/Intervention/Image/Image.php +++ b/src/Intervention/Image/Image.php @@ -9,7 +9,7 @@ use Psr\Http\Message\StreamInterface; * @method \Intervention\Image\Image backup(string $name = 'default') Backups current image state as fallback for reset method under an optional name. Overwrites older state on every call, unless a different name is passed. * @method \Intervention\Image\Image blur(integer $amount = 1) Apply a gaussian blur filter with a optional amount on the current image. Use values between 0 and 100. * @method \Intervention\Image\Image brightness(integer $level) Changes the brightness of the current image by the given level. Use values between -100 for min. brightness. 0 for no change and +100 for max. brightness. - * @method \Intervention\Image\Image cache(\Closure $callback, integer $lifetime = null, boolean $returnObj = false) Method to create a new cached image instance from a Closure callback. Pass a lifetime in minutes for the callback and decide whether you want to get an Intervention Image instance as return value or just receive the image stream. + * @method \Intervention\Image\Image cache(\Closure $callback, integer $lifetime = null, boolean $returnObj = false) Method to create a new cached image instance from a Closure callback. Pass a lifetime in minutes for the callback and decide whether you want to get an Intervention Image instance as return value or just receive the image stream. * @method \Intervention\Image\Image canvas(integer $width, integer $height, mixed $bgcolor = null) Factory method to create a new empty image instance with given width and height. You can define a background-color optionally. By default the canvas background is transparent. * @method \Intervention\Image\Image circle(integer $radius, integer $x, integer $y, \Closure $callback = null) Draw a circle at given x, y, coordinates with given radius. You can define the appearance of the circle by an optional closure callback. * @method \Intervention\Image\Image colorize(integer $red, integer $green, integer $blue) Change the RGB color values of the current image on the given channels red, green and blue. The input values are normalized so you have to include parameters from 100 for maximum color value. 0 for no change and -100 to take out all the certain color on the image. @@ -20,7 +20,7 @@ use Psr\Http\Message\StreamInterface; * @method mixed exif(string $key = null) Read Exif meta data from current image. * @method mixed iptc(string $key = null) Read Iptc meta data from current image. * @method \Intervention\Image\Image fill(mixed $filling, integer $x = null, integer $y = null) Fill current image with given color or another image used as tile for filling. Pass optional x, y coordinates to start at a certain point. - * @method \Intervention\Image\Image flip(string $mode = 'h') Mirror the current image horizontally or vertically by specifying the mode. + * @method \Intervention\Image\Image flip(string $mode = 'h') Mirror the current image horizontally or vertically by specifying the mode. * @method \Intervention\Image\Image fit(integer $width, integer $height = null, \Closure $callback = null, string $position = 'center') Combine cropping and resizing to format image in a smart way. The method will find the best fitting aspect ratio of your given width and height on the current image automatically, cut it out and resize it to the given dimension. You may pass an optional Closure callback as third parameter, to prevent possible upsizing and a custom position of the cutout as fourth parameter. * @method \Intervention\Image\Image gamma(float $correction) Performs a gamma correction operation on the current image. * @method \Intervention\Image\Image greyscale() Turns image into a greyscale version. @@ -41,7 +41,7 @@ use Psr\Http\Message\StreamInterface; * @method \Intervention\Image\Image rectangle(integer $x1, integer $y1, integer $x2, integer $y2, \Closure $callback = null) Draw a colored rectangle on current image with top-left corner on x,y point 1 and bottom-right corner at x,y point 2. Define the overall appearance of the shape by passing a Closure callback as an optional parameter. * @method \Intervention\Image\Image reset(string $name = 'default') Resets all of the modifications to a state saved previously by backup under an optional name. * @method \Intervention\Image\Image resize(integer $width, integer $height, \Closure $callback = null) Resizes current image based on given width and/or height. To contraint the resize command, pass an optional Closure callback as third parameter. - * @method \Intervention\Image\Image resizeCanvas(integer $width, integer $height, string $anchor = 'center', boolean $relative = false, string $bgcolor = '#000000') Resize the boundaries of the current image to given width and height. An anchor can be defined to determine from what point of the image the resizing is going to happen. Set the mode to relative to add or subtract the given width or height to the actual image dimensions. You can also pass a background color for the emerging area of the image. + * @method \Intervention\Image\Image resizeCanvas(integer $width, integer $height, string $anchor = 'center', boolean $relative = false, mixed $bgcolor = null) Resize the boundaries of the current image to given width and height. An anchor can be defined to determine from what point of the image the resizing is going to happen. Set the mode to relative to add or subtract the given width or height to the actual image dimensions. You can also pass a background color for the emerging area of the image. * @method mixed response(string $format = null, integer $quality = 90) Sends HTTP response with current image in given format and quality. * @method \Intervention\Image\Image rotate(float $angle, string $bgcolor = '#000000') Rotate the current image counter-clockwise by a given angle. Optionally define a background color for the uncovered zone after the rotation. * @method \Intervention\Image\Image sharpen(integer $amount = 10) Sharpen current image with an optional amount. Use values between 0 and 100. diff --git a/src/Intervention/Image/Imagick/Driver.php b/src/Intervention/Image/Imagick/Driver.php index 2fbd78b8..1c72e5ab 100644 --- a/src/Intervention/Image/Imagick/Driver.php +++ b/src/Intervention/Image/Imagick/Driver.php @@ -27,7 +27,7 @@ class Driver extends \Intervention\Image\AbstractDriver * * @param integer $width * @param integer $height - * @param string $background + * @param mixed $background * @return \Intervention\Image\Image */ public function newImage($width, $height, $background = null) From 478dca3b8ed348c4c899de72310eb02343ff7010 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sun, 23 Apr 2017 03:29:03 +0200 Subject: [PATCH 2/2] Indicate the default boolean value For explicitness and consistency. --- src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php | 2 +- src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php b/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php index c88e6f19..70739fff 100644 --- a/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php +++ b/src/Intervention/Image/Gd/Commands/ResizeCanvasCommand.php @@ -15,7 +15,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand $width = $this->argument(0)->type('digit')->required()->value(); $height = $this->argument(1)->type('digit')->required()->value(); $anchor = $this->argument(2)->value('center'); - $relative = $this->argument(3)->type('boolean')->value(); + $relative = $this->argument(3)->type('boolean')->value(false); $bgcolor = $this->argument(4)->value(); $original_width = $image->getWidth(); diff --git a/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php b/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php index 8884230e..f394c15d 100644 --- a/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php +++ b/src/Intervention/Image/Imagick/Commands/ResizeCanvasCommand.php @@ -15,7 +15,7 @@ class ResizeCanvasCommand extends \Intervention\Image\Commands\AbstractCommand $width = $this->argument(0)->type('digit')->required()->value(); $height = $this->argument(1)->type('digit')->required()->value(); $anchor = $this->argument(2)->value('center'); - $relative = $this->argument(3)->type('boolean')->value(); + $relative = $this->argument(3)->type('boolean')->value(false); $bgcolor = $this->argument(4)->value(); $original_width = $image->getWidth();