@@ -10,7 +10,7 @@ |
||
10 | 10 | { |
11 | 11 | if (is_float($value + 0)) { |
12 | 12 | // if less than zero and doesn't start with a zero |
13 | - if ($value + 0 < 1 && ! str_starts_with($value, '0')) { |
|
13 | + if ($value + 0 < 1 && !str_starts_with($value, '0')) { |
|
14 | 14 | throw new BadRequestException('Region values less than one require a leading zero.'); |
15 | 15 | } |
16 | 16 | // option should not have an extra trailing zero |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | |
48 | 48 | if (strpos($this->options[0], 'pct:') === false) { |
49 | 49 | // iiif - x,y,w,h |
50 | - $x = (int) $this->options[0]; |
|
51 | - $y = (int) $this->options[1]; |
|
52 | - $w = (int) $this->options[2]; |
|
53 | - $h = (int) $this->options[3]; |
|
50 | + $x = (int)$this->options[0]; |
|
51 | + $y = (int)$this->options[1]; |
|
52 | + $w = (int)$this->options[2]; |
|
53 | + $h = (int)$this->options[3]; |
|
54 | 54 | |
55 | 55 | if (($x + $w) > $this->width) { |
56 | 56 | $w = $w - (($x + $w) - $this->width); |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | // iiif - x,y,w,h |
68 | - $x = (int) round($this->width * substr($this->options[0], 4) / 100); |
|
69 | - $y = (int) round($this->height * $this->options[1] / 100); |
|
70 | - $w = (int) round($this->width * $this->options[2] / 100); |
|
71 | - $h = (int) round($this->height * $this->options[3] / 100); |
|
68 | + $x = (int)round($this->width * substr($this->options[0], 4) / 100); |
|
69 | + $y = (int)round($this->height * $this->options[1] / 100); |
|
70 | + $w = (int)round($this->width * $this->options[2] / 100); |
|
71 | + $h = (int)round($this->height * $this->options[3] / 100); |
|
72 | 72 | |
73 | 73 | if ($this->options[2] + substr($this->options[0], 4) > 100) { |
74 | 74 | $w = $this->width - $x; |
@@ -58,8 +58,8 @@ |
||
58 | 58 | |
59 | 59 | protected function isValidPercent($value) |
60 | 60 | { |
61 | - $percent_value = (int) $this->getPercentValue($value); |
|
62 | - if ($percent_value < 1 || ($percent_value > 100 && ! $this->upscale)) { |
|
61 | + $percent_value = (int)$this->getPercentValue($value); |
|
62 | + if ($percent_value < 1 || ($percent_value > 100 && !$this->upscale)) { |
|
63 | 63 | throw new BadRequestException("Size $value is invalid."); |
64 | 64 | } |
65 | 65 |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | ]; |
53 | 53 | |
54 | 54 | foreach ($parameters as $parameter => $options) { |
55 | - if (! in_array($parameter, array_keys($iiifParameters))) { |
|
55 | + if (!in_array($parameter, array_keys($iiifParameters))) { |
|
56 | 56 | continue; |
57 | 57 | } |
58 | 58 | |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | ]; |
72 | 72 | |
73 | 73 | foreach ($parameters as $parameter => $value) { |
74 | - if (! in_array($parameter, array_keys($validators))) { |
|
74 | + if (!in_array($parameter, array_keys($validators))) { |
|
75 | 75 | continue; |
76 | 76 | } |
77 | 77 | |
78 | - if (! (new $validators[$parameter]($this->config, $this->image))->valid($value)) { |
|
78 | + if (!(new $validators[$parameter]($this->config, $this->image))->valid($value)) { |
|
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | $scaleFactors = []; |
115 | 115 | $maxSize = max($this->image->width(), $this->image->height()); |
116 | - $total = (int) ceil($maxSize / $this->config['tile_width']); |
|
116 | + $total = (int)ceil($maxSize / $this->config['tile_width']); |
|
117 | 117 | $factor = 1; |
118 | 118 | while ($factor / 2 <= $total) { |
119 | 119 | $scaleFactors[] = $factor; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | protected function getExtraFormats() |
130 | 130 | { |
131 | - $formats = $this->getSupportedFormats((string) $this->config['driver']); |
|
131 | + $formats = $this->getSupportedFormats((string)$this->config['driver']); |
|
132 | 132 | |
133 | 133 | // All formats except level2 deafults of jpg and png |
134 | 134 | return array_intersect($formats, ['jpg', 'png']); |