Skip to content

Commit 4832030

Browse files
committed
Reorder parameters
1 parent ed103b2 commit 4832030

File tree

2 files changed

+39
-38
lines changed

2 files changed

+39
-38
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Kirby v3 wrapper for colorist",
44
"type": "kirby-plugin",
55
"license": "MIT",
6-
"version": "1.7.0",
6+
"version": "1.8.0",
77
"keywords": ["kirby3", "image", "graphics"],
88
"homepage": "https://github.com/Fundevogel/kirby3-colorist#readme",
99
"authors": [

src/Colorist.php

+38-37
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,16 @@ protected function resize(string $file, array $options): string
290290

291291
# (1) Basic options
292292

293+
# See https://github.com/joedrago/colorist/blob/master/docs/Usage.md#-j---jobs
294+
protected function jobs(array $options): string
295+
{
296+
if ($options['jobs'] > 0) {
297+
return '--jobs ' . $options['jobs'];
298+
}
299+
300+
return '';
301+
}
302+
293303
# See https://github.com/joedrago/colorist/blob/master/docs/Usage.md#--cmm---cms
294304
protected function cmm(array $options): string
295305
{
@@ -325,16 +335,6 @@ protected function hlglum(array $options): string
325335
return '';
326336
}
327337

328-
# See https://github.com/joedrago/colorist/blob/master/docs/Usage.md#-j---jobs
329-
protected function jobs(array $options): string
330-
{
331-
if ($options['jobs'] > 0) {
332-
return '--jobs ' . $options['jobs'];
333-
}
334-
335-
return '';
336-
}
337-
338338
# (2) Input profile options
339339
protected function iccin(array $options): string
340340
{
@@ -487,15 +487,7 @@ protected function format(array $options): string
487487
return '';
488488
}
489489

490-
protected function nclx(array $options): string
491-
{
492-
if ($options['nclx'] !== null) {
493-
return '--nclx ' . $options['nclx'];
494-
}
495-
496-
return '';
497-
}
498-
490+
# See https://github.com/joedrago/colorist/blob/master/docs/Usage.md#-r---rate
499491
protected function rate(array $options): string
500492
{
501493
if ($options['rate'] > 0) {
@@ -505,22 +497,6 @@ protected function rate(array $options): string
505497
return '';
506498
}
507499

508-
protected function speed(array $options): string
509-
{
510-
if ($options['speed'] === null) {
511-
return '';
512-
}
513-
514-
$min = 0;
515-
$max = 10;
516-
517-
if (($min <= (int) $options['speed']) && ((int) $options['speed'] <= $max)) {
518-
return '--speed ' . $options['speed'];
519-
}
520-
521-
return '';
522-
}
523-
524500
# See https://github.com/joedrago/colorist/blob/master/docs/Usage.md#-t---tonemap
525501
protected function tonemap(array $options): string
526502
{
@@ -562,6 +538,31 @@ protected function yuv(array $options): string
562538
return '';
563539
}
564540

541+
protected function speed(array $options): string
542+
{
543+
if ($options['speed'] === null) {
544+
return '';
545+
}
546+
547+
$min = 0;
548+
$max = 10;
549+
550+
if (($min <= (int) $options['speed']) && ((int) $options['speed'] <= $max)) {
551+
return '--speed ' . $options['speed'];
552+
}
553+
554+
return '';
555+
}
556+
557+
protected function nclx(array $options): string
558+
{
559+
if ($options['nclx'] !== null) {
560+
return '--nclx ' . $options['nclx'];
561+
}
562+
563+
return '';
564+
}
565+
565566

566567
/**
567568
* Core
@@ -645,11 +646,11 @@ public function process(string $file, array $options = []): array
645646
# (5) Output format options
646647
$command[] = $this->bpc($options);
647648
$command[] = $this->format($options);
648-
$command[] = $this->nclx($options);
649649
$command[] = $this->rate($options);
650-
$command[] = $this->speed($options);
651650
$command[] = $this->tonemap($options);
652651
$command[] = $this->yuv($options);
652+
$command[] = $this->speed($options);
653+
$command[] = $this->nclx($options);
653654
# (6) Save image
654655
$command[] = $this->save($file);
655656

0 commit comments

Comments
 (0)