Skip to content
This repository was archived by the owner on Oct 29, 2023. It is now read-only.

Commit a736b3e

Browse files
committed
rename variables & change swap algo
1 parent 174c231 commit a736b3e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/Adapter.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,13 @@ protected function handler(Image $image, array $data, ?string $color = null): Im
9595

9696
$image->resizeCanvas($width, $height, 'center', false, $color);
9797

98-
$fill = $this->imageManager->canvas($width, $height, $color);
98+
$canvas = $this->imageManager->canvas($width, $height, $color);
9999

100100
if ($image->getDriver() instanceof \Intervention\Image\Gd\Driver) {
101-
$object = $fill;
102-
$fill = $image;
103-
$image = $object;
101+
[$canvas, $image] = [$image, $canvas];
104102
}
105103

106-
return $fill->fill(
104+
return $canvas->fill(
107105
$image,
108106
$data['shifted']['width'] ?? null,
109107
$data['shifted']['height'] ?? null,

src/Adapters/None.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function apply(Image $image, array $data): Image
3131
}
3232

3333
$color = $data['color'] ?? null;
34-
$fill = $this->imageManager->canvas($width, $height, $color);
34+
$canvas = $this->imageManager->canvas($width, $height, $color);
3535

3636
$image->resizeCanvas(
3737
$width,
@@ -41,13 +41,13 @@ public function apply(Image $image, array $data): Image
4141
$color
4242
);
4343

44-
$fill->fill(
44+
$canvas->fill(
4545
$image,
46-
($fill->width() - $image->width()) / 2,
47-
($fill->height() - $image->height()) / 2,
46+
($canvas->width() - $image->width()) / 2,
47+
($canvas->height() - $image->height()) / 2,
4848
);
4949

50-
return $fill;
50+
return $canvas;
5151
}
5252

5353
}

0 commit comments

Comments
 (0)