Class

# VMware_VCloud_SDK_Helper

class VMware_VCloud_SDK_Helper

## Methods

static mixed|null | getObjByXml(string $xml, string $return = null) Parse XML form of a vCloud entity to a VMware vCloud data object. |
static array | getObjsByName(array $objs, string $name = null) Return subset of input objects with the given name. |
static VMware_VCloud_API_ReferenceType | createReferenceTypeObj(string $url, string $tagName = null, string $type = null, string $name = null) Construct a VMwareVCloudAPI_ReferenceType data object. |
static string|null | getUuidByUrl(string $url) Get the UUID of a vCloud entity by parsing its URL. |
static string|null | getUrlByEntityId(VMware_VCloud_SDK_Service $service, string $eid) Get a resource URL from its vCloud entity ID. |
static array | getMetadataKeys(mixed $obj) Returns all the metadata keys. |
static array|null | getContainedLinks(string $ctype, string $rel, mixed $obj, string $method = 'getLink') Get subset links of a VMware vCloud data object, filtered by 'type' and/or 'rel' attributes. |

## Details

###
at line 12
`static public mixed|null getObjByXml(string $xml, string $return = null)`

Parse XML form of a vCloud entity to a VMware vCloud data object.

#### Parameters

string | $xml | An XML string, representing a vCloud entity
string | $return | Class name of the output object.

#### Return Value

mixed|null | A VMware vCloud data object

###
at line 33
`static public array getObjsByName(array $objs, string $name = null)`

Return subset of input objects with the given name.

#### Parameters

array | $objs | A set of VMware vCloud data objects, which should have 'name' attribute.
string | $name | Object(s) with specified name will be returned. If $name is null, returns all data objects.

#### Return Value

array | An array of objects with the given name. Returns an empty array if object with specified name is not found.

###
at line 60
`static public VMware_VCloud_API_ReferenceType createReferenceTypeObj(string $url, string $tagName = null, string $type = null, string $name = null)`

Construct a VMwareVCloudAPI_ReferenceType data object.

#### Parameters

string | $url | URL used as href attribute
string | $tagName | Tag name used as the XML element tag
string | $type | Content-type of the vCloud resource entity
string | $name | Name of the entity, used as name attribute

#### Return Value

VMware_VCloud_API_ReferenceType |

###
at line 88
`static public string|null getUuidByUrl(string $url)`

Get the UUID of a vCloud entity by parsing its URL.

It assumes the end of the URL given to the function is or contains the UUID.

#### Parameters

string | $url | vCloud entity URL.

#### Return Value

string|null |

###
at line 107
`static public string|null getUrlByEntityId(VMware_VCloud_SDK_Service $service, string $eid)`

Get a resource URL from its vCloud entity ID.

#### Parameters

VMware_VCloud_SDK_Service | $service |
string | $eid | vCloud entity ID

#### Return Value

string|null |

###
at line 127
`static public array getMetadataKeys(mixed $obj)`

Returns all the metadata keys.

#### Parameters

mixed | $obj | A VMware VCloud SDK object which has getMetadata() method defined.

#### Return Value

array |

###
at line 159
`static public array|null getContainedLinks(string $ctype, string $rel, mixed $obj, string $method = 'getLink')`

Get subset links of a VMware vCloud data object, filtered by 'type' and/or 'rel' attributes.

If a link with specified filter (using $ctype or $rel or both) does not exist, this means the desired opertion is not allowed on that resource entity.

#### Parameters

string | $ctype | The 'type' attribute of an XML element to filter
string | $rel | The 'rel' attribute of an XML element to filter
mixed | $obj | A VMware vCloud container data object which has link element
string | $method | Name of the getter method

#### Return Value

array|null | VMwareVCloudAPI_LinkType object array or null