diff --git a/image.php b/image.php index ee206bc..50b7263 100644 --- a/image.php +++ b/image.php @@ -11,8 +11,11 @@ class image extends objectStructs public $annotations; /** @var imageConfig */ public $config; - /** @var string name of image */ - public $image; + /** @var string name of hte image*/ + public $imageName; + /** @var string name of image after the registry domain -- /image:latest */ + public $shortName; + public function __construct($vars) { @@ -21,6 +24,16 @@ class image extends objectStructs $this->imageName = (isset($vars['image']) ? $vars['image'] : (isset($vars['name']) ? $vars['name'] : (isset($vars['imageName']) ? $vars['imageName'] : "" ) ) ) ; + + if (empty($this->imageName)) + throw new \Exception(__FUNCTION__ . " Image name is empty"); + + list($RegistryDomain, $ImageShortName) = explode('/',$this->imageName,2); + if (!$ImageShortName) + throw new \Exception(__FUNCTION__ . " Image short name not valid"); + else + $this->shortName = $ImageShortName; + if (isset( $vars['imageBasic']->annotations) ) $annotations = $vars['imageBasic']->annotations; elseif (isset($vars['annotations']))