Skip to content

Commit 11dfa2f

Browse files
committed
Implement Command::rawCommand() for edge cases and trigger a proper error
1 parent f717f14 commit 11dfa2f

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

Command.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,32 @@ public function strokeWidth(int $strokeWidth): self
552552
return $this;
553553
}
554554

555+
/**
556+
* /!\ Append a raw command to ImageMagick.
557+
* Not safe! Use at your own risks!
558+
*
559+
* @internal
560+
*/
561+
public function rawCommand(string $command, bool $append = false): self
562+
{
563+
$msg = <<<MSG
564+
This command is not safe and therefore should not be used, unless you need to use an option that is not supported yet.
565+
Use at your own risk!
566+
If you are certain of what you are doing, you can silence this error using the "@" sign on the instruction that executes this method.
567+
If the option you need is not supported, please open an issue or a pull-request at https://github.com/Orbitale/ImageMagickPHP in order for us to implement the option you need! 😃
568+
MSG
569+
;
570+
trigger_error($msg, E_USER_DEPRECATED);
571+
572+
if ($append) {
573+
$this->commandToAppend[] = $command;
574+
} else {
575+
$this->command[] = $command;
576+
}
577+
578+
return $this;
579+
}
580+
555581
/* ------------------------------------------ *
556582
* End of ImageMagick native options. *
557583
* Want more? Some options are missing? *

0 commit comments

Comments
 (0)