Page MenuHomeDevCentral

DockerImage.php
No OneTemporary

DockerImage.php

<?php
namespace Keruald\DockerHub;
use InvalidArgumentException;
abstract class DockerImage {
///
/// Public properties
///
/**
* @var string
*/
public $registry;
/**
* @var string
*/
public $user;
/**
* @var string
*/
public $image;
///
/// Constructors
///
/**
* Initializes a new instance of a DockerImage object.
*
* @param string $user
* @param string $image
*/
public function __construct ($user, $image) {
$this->user = $user;
$this->image = $image;
}
/**
* Initializes a new instance of a DockerImage object
* from the slash notation.
*
* @param string $image the full user image name (e.g. "acme/foo")
* @return DockerImage
*
* @throws InvalidArgumentException when image name doesn't contain a slash.
*/
public static function loadFromSlashNotation ($image) {
if (strpos($image, '/') === false) {
throw new InvalidArgumentException("Image name doesn't contain a slash (/).");
}
$imageFragments = explode('/', $image, 2);
return new static(...$imageFragments);
}
///
/// Helper methods
///
/**
* Gets the URL to the image on the registry.
*
* @return string
*/
public abstract function getRegistryUrl();
}

File Metadata

Mime Type
text/x-php
Expires
Mon, Feb 16, 09:31 (18 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3446871
Default Alt Text
DockerImage.php (1 KB)

Event Timeline