diff --git a/src/Core/Container/Image/Image.php b/src/Core/Container/Image/Image.php index bdbeeb3..00d5b08 100644 --- a/src/Core/Container/Image/Image.php +++ b/src/Core/Container/Image/Image.php @@ -85,4 +85,15 @@ public static function fromName(string $name) { return new self($name, null, null); } + + public static function fromString(string $string) + { + if(preg_match('#(.+)/(.+):(.+)#', $string, $matches)) { + return new self($matches[2], $matches[1], $matches[3]); + } + if(preg_match('#(.+):(.+)#', $string, $matches)) { + return new self($matches[1], null, $matches[2]); + } + return new self($string, null, null); + } }