diff --git a/src/VisualizerTask.php b/src/VisualizerTask.php index 4a1a5d6..9fd19b5 100644 --- a/src/VisualizerTask.php +++ b/src/VisualizerTask.php @@ -31,8 +31,10 @@ use SimpleXMLElement; use XSLTProcessor; use function array_reduce; +use function filter_var; use function reset; use function simplexml_load_string; +use const FILTER_VALIDATE_URL; /** * Class VisualizerTask @@ -354,6 +356,11 @@ public function getServer(): string */ public function setServer(string $server): VisualizerTask { + if (!filter_var($server, FILTER_VALIDATE_URL)) { + $exceptionMessage = 'Invalid PlantUml server'; + $this->log($exceptionMessage, Project::MSG_ERR); + throw new BuildException($exceptionMessage); + } $this->server = $server; return $this;