PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.13.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.13.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / vendor / spatie / image / src / Exceptions / InvalidManipulation.php

InvalidManipulation.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.13.3, at vendor/spatie/image/src/Exceptions/InvalidManipulation.php

44 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Spatie\Image\Exceptions;
4
5 use Exception;
6
7 class InvalidManipulation extends Exception
8 {
9 public static function invalidWidth(int $width): self
10 {
11 return new self("Width should be a positive number. `{$width}` given.");
12 }
13
14 public static function invalidHeight(int $height): self
15 {
16 return new self("Height should be a positive number. `{$height}` given.");
17 }
18
19 public static function invalidParameter(string $name, $invalidValue, array $validValues): self
20 {
21 $validValues = self::formatValues($validValues);
22
23 $name = ucfirst($name);
24
25 return new self("{$name} should be one of {$validValues}. `{$invalidValue}` given.");
26 }
27
28 public static function valueNotInRange(string $name, $invalidValue, $minValue, $maxValue): self
29 {
30 $name = ucfirst($name);
31
32 return new self("{$name} should be a number in the range {$minValue} until {$maxValue}. `{$invalidValue}` given.");
33 }
34
35 protected static function formatValues(array $values): string
36 {
37 $quotedValues = array_map(function (string $value) {
38 return "`{$value}`";
39 }, $values);
40
41 return implode(', ', $quotedValues);
42 }
43 }
44