Skip to content

Commit

Permalink
Fix test for Watermark
Browse files Browse the repository at this point in the history
  • Loading branch information
Art4 committed Jan 22, 2024
1 parent be8e752 commit 5ffd4f8
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/Manipulators/Background.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;
use League\Glide\Manipulators\Helpers\Color;

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Manipulators/BaseManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

abstract class BaseManipulator implements ManipulatorInterface
{
Expand Down Expand Up @@ -44,7 +44,7 @@ public function __get($name)
/**
* Perform the image manipulation.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
abstract public function run(Image $image);
abstract public function run(ImageInterface $image): ImageInterface;
}
2 changes: 1 addition & 1 deletion src/Manipulators/Blur.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string $blur
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Border.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;
use League\Glide\Manipulators\Helpers\Color;
use League\Glide\Manipulators\Helpers\Dimension;

Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Brightness.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string|null $bri
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Contrast.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string|null $con
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Crop.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string|null $crop
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Encode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string $fm
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string $filt
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Flip.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string $flip
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Gamma.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string|null $gam
Expand Down
8 changes: 4 additions & 4 deletions src/Manipulators/Helpers/Dimension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace League\Glide\Manipulators\Helpers;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

class Dimension
{
/**
* The source image.
*
* @var Image
* @var ImageInterface
*/
protected $image;

Expand All @@ -23,10 +23,10 @@ class Dimension
/**
* Create dimension helper instance.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param float $dpr The device pixel ratio.
*/
public function __construct(Image $image, $dpr = 1)
public function __construct(ImageInterface $image, $dpr = 1)
{
$this->image = $image;
$this->dpr = $dpr;
Expand Down
8 changes: 4 additions & 4 deletions src/Manipulators/ManipulatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

interface ManipulatorInterface
{
Expand All @@ -16,9 +16,9 @@ public function setParams(array $params);
/**
* Perform the image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function run(Image $image);
public function run(ImageInterface $image): ImageInterface;
}
2 changes: 1 addition & 1 deletion src/Manipulators/Orientation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string $or
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Pixelate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string $pixel
Expand Down
2 changes: 1 addition & 1 deletion src/Manipulators/Sharpen.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string $sharp
Expand Down
62 changes: 31 additions & 31 deletions src/Manipulators/Size.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace League\Glide\Manipulators;

use Intervention\Image\Image;
use Intervention\Image\Interfaces\ImageInterface;

/**
* @property string $dpr
Expand Down Expand Up @@ -54,11 +54,11 @@ public function getMaxImageSize()
/**
* Perform size image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function run(Image $image)
public function run(ImageInterface $image): ImageInterface
{
$width = $this->getWidth();
$height = $this->getHeight();
Expand Down Expand Up @@ -155,13 +155,13 @@ public function getDpr()
/**
* Resolve missing image dimensions.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int|null $width The image width.
* @param int|null $height The image height.
*
* @return int[] The resolved width and height.
*/
public function resolveMissingDimensions(Image $image, $width, $height)
public function resolveMissingDimensions(ImageInterface $image, $width, $height)
{
if (is_null($width) and is_null($height)) {
$width = $image->width();
Expand Down Expand Up @@ -232,14 +232,14 @@ public function limitImageSize($width, $height)
/**
* Perform resize image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param string $fit The fit.
* @param int $width The width.
* @param int $height The height.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function runResize(Image $image, $fit, $width, $height)
public function runResize(ImageInterface $image, $fit, $width, $height): ImageInterface
{
if ('contain' === $fit) {
return $this->runContainResize($image, $width, $height);
Expand Down Expand Up @@ -271,13 +271,13 @@ public function runResize(Image $image, $fit, $width, $height)
/**
* Perform contain resize image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int $width The width.
* @param int $height The height.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function runContainResize(Image $image, $width, $height)
public function runContainResize(ImageInterface $image, $width, $height): ImageInterface
{
return $image->resize($width, $height, function ($constraint) {
$constraint->aspectRatio();
Expand All @@ -287,13 +287,13 @@ public function runContainResize(Image $image, $width, $height)
/**
* Perform max resize image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int $width The width.
* @param int $height The height.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function runMaxResize(Image $image, $width, $height)
public function runMaxResize(ImageInterface $image, $width, $height): ImageInterface
{
return $image->resize($width, $height, function ($constraint) {
$constraint->aspectRatio();
Expand All @@ -304,13 +304,13 @@ public function runMaxResize(Image $image, $width, $height)
/**
* Perform fill resize image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int $width The width.
* @param int $height The height.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function runFillResize($image, $width, $height)
public function runFillResize(ImageInterface $image, $width, $height): ImageInterface
{
$image = $this->runMaxResize($image, $width, $height);

Expand All @@ -320,13 +320,13 @@ public function runFillResize($image, $width, $height)
/**
* Perform fill-max resize image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int $width The width.
* @param int $height The height.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function runFillMaxResize(Image $image, $width, $height)
public function runFillMaxResize(ImageInterface $image, $width, $height): ImageInterface
{
$image = $image->resize($width, $height, function ($constraint) {
$constraint->aspectRatio();
Expand All @@ -338,27 +338,27 @@ public function runFillMaxResize(Image $image, $width, $height)
/**
* Perform stretch resize image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int $width The width.
* @param int $height The height.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function runStretchResize(Image $image, $width, $height)
public function runStretchResize(ImageInterface $image, $width, $height): ImageInterface
{
return $image->resize($width, $height);
}

/**
* Perform crop resize image manipulation.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int $width The width.
* @param int $height The height.
*
* @return Image The manipulated image.
* @return ImageInterface The manipulated image.
*/
public function runCropResize(Image $image, $width, $height)
public function runCropResize(ImageInterface $image, $width, $height): ImageInterface
{
list($resize_width, $resize_height) = $this->resolveCropResizeDimensions($image, $width, $height);

Expand All @@ -376,13 +376,13 @@ public function runCropResize(Image $image, $width, $height)
/**
* Resolve the crop resize dimensions.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int $width The width.
* @param int $height The height.
*
* @return array The resize dimensions.
*/
public function resolveCropResizeDimensions(Image $image, $width, $height)
public function resolveCropResizeDimensions(ImageInterface $image, $width, $height): array
{
if ($height > $width * ($image->height() / $image->width())) {
return [$height * ($image->width() / $image->height()), $height];
Expand All @@ -394,13 +394,13 @@ public function resolveCropResizeDimensions(Image $image, $width, $height)
/**
* Resolve the crop offset.
*
* @param Image $image The source image.
* @param ImageInterface $image The source image.
* @param int $width The width.
* @param int $height The height.
*
* @return array The crop offset.
*/
public function resolveCropOffset(Image $image, $width, $height)
public function resolveCropOffset(ImageInterface $image, $width, $height): array
{
list($offset_percentage_x, $offset_percentage_y) = $this->getCrop();

Expand Down
Loading

0 comments on commit 5ffd4f8

Please sign in to comment.