repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Azure/azure-sdk-for-php | src/MediaServices/MediaServicesRestProxy.php | MediaServicesRestProxy.showSlateChannel | public function showSlateChannel($channel, $duration, $assetId)
{
$op = $this->sendShowSlateChannelOperation($channel, $duration, $assetId);
// waiting for create operation finishes
$op = $this->awaitOperation($op);
// true if succeeded
return $op->getState() == OperationState::Succeeded;
} | php | public function showSlateChannel($channel, $duration, $assetId)
{
$op = $this->sendShowSlateChannelOperation($channel, $duration, $assetId);
// waiting for create operation finishes
$op = $this->awaitOperation($op);
// true if succeeded
return $op->getState() == OperationState::Succeeded;
} | [
"public",
"function",
"showSlateChannel",
"(",
"$",
"channel",
",",
"$",
"duration",
",",
"$",
"assetId",
")",
"{",
"$",
"op",
"=",
"$",
"this",
"->",
"sendShowSlateChannelOperation",
"(",
"$",
"channel",
",",
"$",
"duration",
",",
"$",
"assetId",
")",
"... | Show Slate on Channel.
@param Channel|string $channel Channel data or channel Id
@param $duration
@param $assetId
@return bool true if succeeded | [
"Show",
"Slate",
"on",
"Channel",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/MediaServicesRestProxy.php#L3313-L3322 | train |
Azure/azure-sdk-for-php | src/MediaServices/MediaServicesRestProxy.php | MediaServicesRestProxy.hideSlateChannel | public function hideSlateChannel($channel)
{
$op = $this->sendHideSlateChannelOperation($channel);
// waiting for create operation finishes
$op = $this->awaitOperation($op);
// true if succeeded
return $op->getState() == OperationState::Succeeded;
} | php | public function hideSlateChannel($channel)
{
$op = $this->sendHideSlateChannelOperation($channel);
// waiting for create operation finishes
$op = $this->awaitOperation($op);
// true if succeeded
return $op->getState() == OperationState::Succeeded;
} | [
"public",
"function",
"hideSlateChannel",
"(",
"$",
"channel",
")",
"{",
"$",
"op",
"=",
"$",
"this",
"->",
"sendHideSlateChannelOperation",
"(",
"$",
"channel",
")",
";",
"// waiting for create operation finishes",
"$",
"op",
"=",
"$",
"this",
"->",
"awaitOpera... | Hide Slate on Channel.
@param Channel|string $channel Channel data or channel Id
@return bool true if succeeded | [
"Hide",
"Slate",
"on",
"Channel",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/MediaServicesRestProxy.php#L3331-L3340 | train |
Azure/azure-sdk-for-php | src/MediaServices/MediaServicesRestProxy.php | MediaServicesRestProxy.getProgram | public function getProgram($program)
{
$programId = Utilities::getEntityId(
$program,
'WindowsAzure\MediaServices\Models\Program'
);
return Program::createFromOptions($this->_getEntity("Programs('{$programId}')"));
} | php | public function getProgram($program)
{
$programId = Utilities::getEntityId(
$program,
'WindowsAzure\MediaServices\Models\Program'
);
return Program::createFromOptions($this->_getEntity("Programs('{$programId}')"));
} | [
"public",
"function",
"getProgram",
"(",
"$",
"program",
")",
"{",
"$",
"programId",
"=",
"Utilities",
"::",
"getEntityId",
"(",
"$",
"program",
",",
"'WindowsAzure\\MediaServices\\Models\\Program'",
")",
";",
"return",
"Program",
"::",
"createFromOptions",
"(",
"... | Get existing program.
@param Program|string $program Program data
@return Program Created Program | [
"Get",
"existing",
"program",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/MediaServicesRestProxy.php#L3349-L3357 | train |
Azure/azure-sdk-for-php | src/MediaServices/MediaServicesRestProxy.php | MediaServicesRestProxy.stopProgram | public function stopProgram($program)
{
$op = $this->sendStopProgramOperation($program);
// waiting for create operation finishes
$op = $this->awaitOperation($op);
// true if succeeded
return $op->getState() == OperationState::Succeeded;
} | php | public function stopProgram($program)
{
$op = $this->sendStopProgramOperation($program);
// waiting for create operation finishes
$op = $this->awaitOperation($op);
// true if succeeded
return $op->getState() == OperationState::Succeeded;
} | [
"public",
"function",
"stopProgram",
"(",
"$",
"program",
")",
"{",
"$",
"op",
"=",
"$",
"this",
"->",
"sendStopProgramOperation",
"(",
"$",
"program",
")",
";",
"// waiting for create operation finishes",
"$",
"op",
"=",
"$",
"this",
"->",
"awaitOperation",
"... | Stop a Program.
@param Program|string $program Program data or program Id
@return bool true if succeeded | [
"Stop",
"a",
"Program",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/MediaServicesRestProxy.php#L3472-L3481 | train |
Azure/azure-sdk-for-php | src/MediaServices/MediaServicesRestProxy.php | MediaServicesRestProxy.sendUpdateProgramOperation | public function sendUpdateProgramOperation(Program $program)
{
$programId = $program->getId();
Validate::notNull($programId, 'programId');
return $this->_sendOperation(
$program,
"Programs('{$programId}')",
Resources::HTTP_MERGE,
[Resources::STATUS_ACCEPTED, Resources::STATUS_NO_CONTENT]);
} | php | public function sendUpdateProgramOperation(Program $program)
{
$programId = $program->getId();
Validate::notNull($programId, 'programId');
return $this->_sendOperation(
$program,
"Programs('{$programId}')",
Resources::HTTP_MERGE,
[Resources::STATUS_ACCEPTED, Resources::STATUS_NO_CONTENT]);
} | [
"public",
"function",
"sendUpdateProgramOperation",
"(",
"Program",
"$",
"program",
")",
"{",
"$",
"programId",
"=",
"$",
"program",
"->",
"getId",
"(",
")",
";",
"Validate",
"::",
"notNull",
"(",
"$",
"programId",
",",
"'programId'",
")",
";",
"return",
"... | Send Update Program operation.
@param Program $program Programs data
@return Operation The operation to track the program update | [
"Send",
"Update",
"Program",
"operation",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/MediaServicesRestProxy.php#L3490-L3500 | train |
Azure/azure-sdk-for-php | src/MediaServices/MediaServicesRestProxy.php | MediaServicesRestProxy.updateProgram | public function updateProgram(Program $program)
{
$op = $this->sendUpdateProgramOperation($program);
// waiting for create operation finishes
$op = $this->awaitOperation($op);
if ($op->getState() != OperationState::Succeeded) {
return null;
}
// get and return the createProgram
return $this->getProgram($program->getId());
} | php | public function updateProgram(Program $program)
{
$op = $this->sendUpdateProgramOperation($program);
// waiting for create operation finishes
$op = $this->awaitOperation($op);
if ($op->getState() != OperationState::Succeeded) {
return null;
}
// get and return the createProgram
return $this->getProgram($program->getId());
} | [
"public",
"function",
"updateProgram",
"(",
"Program",
"$",
"program",
")",
"{",
"$",
"op",
"=",
"$",
"this",
"->",
"sendUpdateProgramOperation",
"(",
"$",
"program",
")",
";",
"// waiting for create operation finishes",
"$",
"op",
"=",
"$",
"this",
"->",
"awa... | Update a Program.
@param Program $program Program data
@return Program the updated program | [
"Update",
"a",
"Program",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/MediaServicesRestProxy.php#L3509-L3522 | train |
Azure/azure-sdk-for-php | src/MediaServices/MediaServicesRestProxy.php | MediaServicesRestProxy.sendDeleteProgramOperation | public function sendDeleteProgramOperation($program)
{
$programId = Utilities::getEntityId(
$program,
'WindowsAzure\MediaServices\Models\Program'
);
return $this->_sendOperation(
null,
"Programs('{$programId}')",
Resources::HTTP_DELETE,
Resources::STATUS_NO_CONTENT);
} | php | public function sendDeleteProgramOperation($program)
{
$programId = Utilities::getEntityId(
$program,
'WindowsAzure\MediaServices\Models\Program'
);
return $this->_sendOperation(
null,
"Programs('{$programId}')",
Resources::HTTP_DELETE,
Resources::STATUS_NO_CONTENT);
} | [
"public",
"function",
"sendDeleteProgramOperation",
"(",
"$",
"program",
")",
"{",
"$",
"programId",
"=",
"Utilities",
"::",
"getEntityId",
"(",
"$",
"program",
",",
"'WindowsAzure\\MediaServices\\Models\\Program'",
")",
";",
"return",
"$",
"this",
"->",
"_sendOpera... | Delete Program.
@param Program|string $program Program data or program Id
@return Operation | [
"Delete",
"Program",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/MediaServicesRestProxy.php#L3531-L3543 | train |
Azure/azure-sdk-for-php | src/MediaServices/MediaServicesRestProxy.php | MediaServicesRestProxy.deleteProgram | public function deleteProgram($program)
{
$op = $this->sendDeleteProgramOperation($program);
// waiting for delete operation finishes
$op = $this->awaitOperation($op);
// true if succeeded
return $op->getState() == OperationState::Succeeded;
} | php | public function deleteProgram($program)
{
$op = $this->sendDeleteProgramOperation($program);
// waiting for delete operation finishes
$op = $this->awaitOperation($op);
// true if succeeded
return $op->getState() == OperationState::Succeeded;
} | [
"public",
"function",
"deleteProgram",
"(",
"$",
"program",
")",
"{",
"$",
"op",
"=",
"$",
"this",
"->",
"sendDeleteProgramOperation",
"(",
"$",
"program",
")",
";",
"// waiting for delete operation finishes",
"$",
"op",
"=",
"$",
"this",
"->",
"awaitOperation",... | Delete a Program.
@param Program|string $program Program data or program Id
@return bool true if succeeded | [
"Delete",
"a",
"Program",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/MediaServicesRestProxy.php#L3552-L3561 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/BrokeredMessage.php | BrokeredMessage.setProperty | public function setProperty($propertyName, $propertyValue)
{
Validate::isString($propertyName, 'propertyName');
Validate::notNull($propertyValue, 'propertyValue');
$this->_customProperties[strtolower($propertyName)] = $propertyValue;
} | php | public function setProperty($propertyName, $propertyValue)
{
Validate::isString($propertyName, 'propertyName');
Validate::notNull($propertyValue, 'propertyValue');
$this->_customProperties[strtolower($propertyName)] = $propertyValue;
} | [
"public",
"function",
"setProperty",
"(",
"$",
"propertyName",
",",
"$",
"propertyValue",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"propertyName",
",",
"'propertyName'",
")",
";",
"Validate",
"::",
"notNull",
"(",
"$",
"propertyValue",
",",
"'property... | Sets the value of a custom property.
@param string $propertyName The name of the property
@param mixed $propertyValue The value of the property | [
"Sets",
"the",
"value",
"of",
"a",
"custom",
"property",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/BrokeredMessage.php#L193-L199 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/SubscriptionInfo.php | SubscriptionInfo.parseXml | public function parseXml($entryXml)
{
$this->_entry->parseXml($entryXml);
$content = $this->_entry->getContent();
if (is_null($content)) {
$this->_subscriptionDescription = null;
} else {
$this->_subscriptionDescription = SubscriptionDescription::create(
$content->getText()
);
}
} | php | public function parseXml($entryXml)
{
$this->_entry->parseXml($entryXml);
$content = $this->_entry->getContent();
if (is_null($content)) {
$this->_subscriptionDescription = null;
} else {
$this->_subscriptionDescription = SubscriptionDescription::create(
$content->getText()
);
}
} | [
"public",
"function",
"parseXml",
"(",
"$",
"entryXml",
")",
"{",
"$",
"this",
"->",
"_entry",
"->",
"parseXml",
"(",
"$",
"entryXml",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"_entry",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"is_null"... | Populates the properties of the subscription info instance with a XML string.
@param string $entryXml A XML string representing a subscription
information instance | [
"Populates",
"the",
"properties",
"of",
"the",
"subscription",
"info",
"instance",
"with",
"a",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/SubscriptionInfo.php#L94-L105 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/SubscriptionInfo.php | SubscriptionInfo.writeXml | public function writeXml(\XMLWriter $xmlWriter)
{
$content = null;
if (!is_null($this->_subscriptionDescription)) {
$content = new Content();
$content->setText(
XmlSerializer::objectSerialize(
$this->_subscriptionDescription,
'SubscriptionDescription'
)
);
}
$this->_entry->setContent($content);
$this->_entry->writeXml($xmlWriter);
} | php | public function writeXml(\XMLWriter $xmlWriter)
{
$content = null;
if (!is_null($this->_subscriptionDescription)) {
$content = new Content();
$content->setText(
XmlSerializer::objectSerialize(
$this->_subscriptionDescription,
'SubscriptionDescription'
)
);
}
$this->_entry->setContent($content);
$this->_entry->writeXml($xmlWriter);
} | [
"public",
"function",
"writeXml",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
")",
"{",
"$",
"content",
"=",
"null",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_subscriptionDescription",
")",
")",
"{",
"$",
"content",
"=",
"new",
"Content",
... | Writes XML based on the subscription information.
@param \XMLWriter $xmlWriter The XML writer | [
"Writes",
"XML",
"based",
"on",
"the",
"subscription",
"information",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/SubscriptionInfo.php#L112-L126 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy._sendRoleInstanceOrder | private function _sendRoleInstanceOrder($name, $roleName, GetDeploymentOptions $options, $order)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($roleName, 'roleName');
Validate::notNullOrEmpty($roleName, 'roleName');
Validate::notNullOrEmpty($options, 'options');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getRoleInstancePath($name, $options, $roleName));
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(Resources::QP_COMP, $order);
$context->addHeader(Resources::CONTENT_TYPE, Resources::XML_CONTENT_TYPE);
$context->addHeader(Resources::CONTENT_LENGTH_NO_SPACE, 0);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | private function _sendRoleInstanceOrder($name, $roleName, GetDeploymentOptions $options, $order)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($roleName, 'roleName');
Validate::notNullOrEmpty($roleName, 'roleName');
Validate::notNullOrEmpty($options, 'options');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getRoleInstancePath($name, $options, $roleName));
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(Resources::QP_COMP, $order);
$context->addHeader(Resources::CONTENT_TYPE, Resources::XML_CONTENT_TYPE);
$context->addHeader(Resources::CONTENT_LENGTH_NO_SPACE, 0);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"private",
"function",
"_sendRoleInstanceOrder",
"(",
"$",
"name",
",",
"$",
"roleName",
",",
"GetDeploymentOptions",
"$",
"options",
",",
"$",
"order",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"n... | Sends an order request for the specified role instance.
@param string $name The hosted service name
@param string $roleName The role instance name
@param GetDeploymentOptions $options The optional parameters
@param string $order The order name which is used as value
for query parameter 'comp'
@return AsynchronousOperationResult | [
"Sends",
"an",
"order",
"request",
"for",
"the",
"specified",
"role",
"instance",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L96-L115 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy._getPath | private function _getPath($serviceManagementResource, $name)
{
$path = $this->_subscriptionId.'/'.$serviceManagementResource;
if (!is_null($name)) {
$path .= '/'.$name;
}
return $path;
} | php | private function _getPath($serviceManagementResource, $name)
{
$path = $this->_subscriptionId.'/'.$serviceManagementResource;
if (!is_null($name)) {
$path .= '/'.$name;
}
return $path;
} | [
"private",
"function",
"_getPath",
"(",
"$",
"serviceManagementResource",
",",
"$",
"name",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_subscriptionId",
".",
"'/'",
".",
"$",
"serviceManagementResource",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"name... | Constructs URI path for given service management resource.
@param string $serviceManagementResource The resource name
@param string $name The service name
@return string | [
"Constructs",
"URI",
"path",
"for",
"given",
"service",
"management",
"resource",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L125-L134 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy._getRoleInstancePath | private function _getRoleInstancePath($name, GetDeploymentOptions $options, $roleName)
{
$path = $this->_getDeploymentPath($name, $options).'/roleinstances';
return "$path/$roleName";
} | php | private function _getRoleInstancePath($name, GetDeploymentOptions $options, $roleName)
{
$path = $this->_getDeploymentPath($name, $options).'/roleinstances';
return "$path/$roleName";
} | [
"private",
"function",
"_getRoleInstancePath",
"(",
"$",
"name",
",",
"GetDeploymentOptions",
"$",
"options",
",",
"$",
"roleName",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"_getDeploymentPath",
"(",
"$",
"name",
",",
"$",
"options",
")",
".",
"'/rol... | Gets role instance path.
@param string $name The hosted service name
@param GetDeploymentOptions $options The get deployment options
@param string $roleName The role instance name
@return string | [
"Gets",
"role",
"instance",
"path",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L221-L226 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy._getDeploymentPath | private function _getDeploymentPath($name, GetDeploymentOptions $options)
{
$slot = $options->getSlot();
$deploymentName = $options->getDeploymentName();
$path = null;
Validate::isTrue(
!empty($slot) || !empty($deploymentName),
Resources::INVALID_DEPLOYMENT_LOCATOR_MSG
);
if (!empty($slot)) {
$path = $this->_getDeploymentPathUsingSlot($name, $slot);
} else {
$path = $this->_getDeploymentPathUsingName($name, $deploymentName);
}
return $path;
} | php | private function _getDeploymentPath($name, GetDeploymentOptions $options)
{
$slot = $options->getSlot();
$deploymentName = $options->getDeploymentName();
$path = null;
Validate::isTrue(
!empty($slot) || !empty($deploymentName),
Resources::INVALID_DEPLOYMENT_LOCATOR_MSG
);
if (!empty($slot)) {
$path = $this->_getDeploymentPathUsingSlot($name, $slot);
} else {
$path = $this->_getDeploymentPathUsingName($name, $deploymentName);
}
return $path;
} | [
"private",
"function",
"_getDeploymentPath",
"(",
"$",
"name",
",",
"GetDeploymentOptions",
"$",
"options",
")",
"{",
"$",
"slot",
"=",
"$",
"options",
"->",
"getSlot",
"(",
")",
";",
"$",
"deploymentName",
"=",
"$",
"options",
"->",
"getDeploymentName",
"("... | Gets the deployment URI path using the slot or name.
@param string $name The hosted service name
@param GetDeploymentOptions $options The optional parameters
@return string | [
"Gets",
"the",
"deployment",
"URI",
"path",
"using",
"the",
"slot",
"or",
"name",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L236-L254 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy._createRequestXml | private function _createRequestXml($xmlElements, $root)
{
$requestArray = [
Resources::XTAG_NAMESPACE => [Resources::WA_XML_NAMESPACE => null],
];
foreach ($xmlElements as $tagName => $value) {
if (!empty($value)) {
$requestArray[$tagName] = $value;
}
}
$properties = [XmlSerializer::ROOT_NAME => $root];
return $this->dataSerializer->serialize($requestArray, $properties);
} | php | private function _createRequestXml($xmlElements, $root)
{
$requestArray = [
Resources::XTAG_NAMESPACE => [Resources::WA_XML_NAMESPACE => null],
];
foreach ($xmlElements as $tagName => $value) {
if (!empty($value)) {
$requestArray[$tagName] = $value;
}
}
$properties = [XmlSerializer::ROOT_NAME => $root];
return $this->dataSerializer->serialize($requestArray, $properties);
} | [
"private",
"function",
"_createRequestXml",
"(",
"$",
"xmlElements",
",",
"$",
"root",
")",
"{",
"$",
"requestArray",
"=",
"[",
"Resources",
"::",
"XTAG_NAMESPACE",
"=>",
"[",
"Resources",
"::",
"WA_XML_NAMESPACE",
"=>",
"null",
"]",
",",
"]",
";",
"foreach"... | Constructs request XML including windows azure XML namespace.
@param array $xmlElements The XML elements associated with their values
@param string $root The XML root name
@return string | [
"Constructs",
"request",
"XML",
"including",
"windows",
"azure",
"XML",
"namespace",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L288-L303 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy._encodeConfiguration | private function _encodeConfiguration($value)
{
$value = is_resource($value) ? stream_get_contents($value) : $value;
$value = base64_encode($value);
// Cut the BOM if any. If the xml configuration would start with BOM Azure treats it as invalid XML file.
if (strpos($value, '77u/') === 0) {
$value = substr($value, 4);
}
return $value;
} | php | private function _encodeConfiguration($value)
{
$value = is_resource($value) ? stream_get_contents($value) : $value;
$value = base64_encode($value);
// Cut the BOM if any. If the xml configuration would start with BOM Azure treats it as invalid XML file.
if (strpos($value, '77u/') === 0) {
$value = substr($value, 4);
}
return $value;
} | [
"private",
"function",
"_encodeConfiguration",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"is_resource",
"(",
"$",
"value",
")",
"?",
"stream_get_contents",
"(",
"$",
"value",
")",
":",
"$",
"value",
";",
"$",
"value",
"=",
"base64_encode",
"(",
"$"... | Prepare configuration XML for sending via REST API.
@param string|resource $value The configuration file contents
or file stream
@return string | [
"Prepare",
"configuration",
"XML",
"for",
"sending",
"via",
"REST",
"API",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L313-L324 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.listStorageServices | public function listStorageServices()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getStorageServicePath());
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return ListStorageServicesResult::create($serialized);
} | php | public function listStorageServices()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getStorageServicePath());
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return ListStorageServicesResult::create($serialized);
} | [
"public",
"function",
"listStorageServices",
"(",
")",
"{",
"$",
"context",
"=",
"new",
"HttpCallContext",
"(",
")",
";",
"$",
"context",
"->",
"setMethod",
"(",
"Resources",
"::",
"HTTP_GET",
")",
";",
"$",
"context",
"->",
"setPath",
"(",
"$",
"this",
... | Lists the storage accounts available under the current subscription.
@return ListStorageServicesResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460787.aspx | [
"Lists",
"the",
"storage",
"accounts",
"available",
"under",
"the",
"current",
"subscription",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L354-L365 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.getStorageServiceProperties | public function getStorageServiceProperties($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getStorageServicePath($name));
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetStorageServicePropertiesResult::create($parsed);
} | php | public function getStorageServiceProperties($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getStorageServicePath($name));
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetStorageServicePropertiesResult::create($parsed);
} | [
"public",
"function",
"getStorageServiceProperties",
"(",
"$",
"name",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"$",
"context",
"=",
... | Returns the system properties for the specified storage account.
These properties include: the address, description, and label of the storage
account; and the name of the affinity group to which the service belongs,
or its geo-location if it is not part of an affinity group.
@param string $name The storage account name
@return GetStorageServicePropertiesResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460802.aspx | [
"Returns",
"the",
"system",
"properties",
"for",
"the",
"specified",
"storage",
"account",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L380-L394 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.getStorageServiceKeys | public function getStorageServiceKeys($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getStorageServiceKeysPath($name));
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetStorageServiceKeysResult::create($parsed);
} | php | public function getStorageServiceKeys($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getStorageServiceKeysPath($name));
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetStorageServiceKeysResult::create($parsed);
} | [
"public",
"function",
"getStorageServiceKeys",
"(",
"$",
"name",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"$",
"context",
"=",
"new",... | Returns the primary and secondary access keys for the specified storage
account.
@param string $name The storage account name
@return GetStorageServiceKeysResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460785.aspx | [
"Returns",
"the",
"primary",
"and",
"secondary",
"access",
"keys",
"for",
"the",
"specified",
"storage",
"account",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L406-L420 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.regenerateStorageServiceKeys | public function regenerateStorageServiceKeys($name, $keyType)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($keyType, 'keyType');
Validate::notNullOrEmpty($keyType, 'keyType');
$body = $this->_createRequestXml(
[Resources::XTAG_KEY_TYPE => $keyType],
Resources::XTAG_REGENERATE_KEYS
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getStorageServiceKeysPath($name));
$context->addStatusCode(Resources::STATUS_OK);
$context->addQueryParameter(Resources::QP_ACTION, Resources::QPV_REGENERATE);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetStorageServiceKeysResult::create($parsed);
} | php | public function regenerateStorageServiceKeys($name, $keyType)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($keyType, 'keyType');
Validate::notNullOrEmpty($keyType, 'keyType');
$body = $this->_createRequestXml(
[Resources::XTAG_KEY_TYPE => $keyType],
Resources::XTAG_REGENERATE_KEYS
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getStorageServiceKeysPath($name));
$context->addStatusCode(Resources::STATUS_OK);
$context->addQueryParameter(Resources::QP_ACTION, Resources::QPV_REGENERATE);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetStorageServiceKeysResult::create($parsed);
} | [
"public",
"function",
"regenerateStorageServiceKeys",
"(",
"$",
"name",
",",
"$",
"keyType",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")",
";",
... | Regenerates the primary or secondary access key for the specified storage
account.
@param string $name The storage account name
@param string $keyType Specifies which key to regenerate
@return GetStorageServiceKeysResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460795.aspx | [
"Regenerates",
"the",
"primary",
"or",
"secondary",
"access",
"key",
"for",
"the",
"specified",
"storage",
"account",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L433-L460 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.createStorageService | public function createStorageService($name, $label, CreateServiceOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
Validate::notNullOrEmpty($options, 'options');
$affinityGroup = $options->getAffinityGroup();
$location = $options->getLocation();
Validate::isTrue(
!empty($location) || !empty($affinityGroup),
Resources::INVALID_CREATE_SERVICE_OPTIONS_MSG
);
$storageService = new StorageService();
$storageService->setName($name);
$storageService->setLabel($label);
$storageService->setLocation($options->getLocation());
$storageService->setAffinityGroup($options->getAffinityGroup());
$storageService->setDescription($options->getDescription());
$storageService->addSerializationProperty(
XmlSerializer::ROOT_NAME,
Resources::XTAG_CREATE_STORAGE_SERVICE_INPUT
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getStorageServicePath());
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->setBody($storageService->serialize($this->dataSerializer));
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | public function createStorageService($name, $label, CreateServiceOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
Validate::notNullOrEmpty($options, 'options');
$affinityGroup = $options->getAffinityGroup();
$location = $options->getLocation();
Validate::isTrue(
!empty($location) || !empty($affinityGroup),
Resources::INVALID_CREATE_SERVICE_OPTIONS_MSG
);
$storageService = new StorageService();
$storageService->setName($name);
$storageService->setLabel($label);
$storageService->setLocation($options->getLocation());
$storageService->setAffinityGroup($options->getAffinityGroup());
$storageService->setDescription($options->getDescription());
$storageService->addSerializationProperty(
XmlSerializer::ROOT_NAME,
Resources::XTAG_CREATE_STORAGE_SERVICE_INPUT
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getStorageServicePath());
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->setBody($storageService->serialize($this->dataSerializer));
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"public",
"function",
"createStorageService",
"(",
"$",
"name",
",",
"$",
"label",
",",
"CreateServiceOptions",
"$",
"options",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
... | Creates a new storage account in Windows Azure.
In the optional parameters either location or affinity group must be provided.
Because Create Storage Account is an asynchronous operation, it always returns
status code 202 (Accepted). To determine the status code for the operation
once it is complete, call getOperationStatus API. The status code is embedded
in the response for this operation; if successful, it will be
status code 200 (OK).
@param string $name The storage account name
@param string $label The name for the storage account specified as a base64-encoded string. The
name may be up to 100 characters in length. The name can be used identify
the storage account for your tracking purposes
@param CreateServiceOptions $options The optional parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/hh264518.aspx | [
"Creates",
"a",
"new",
"storage",
"account",
"in",
"Windows",
"Azure",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L482-L520 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.deleteStorageService | public function deleteStorageService($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_DELETE);
$context->setPath($this->_getStorageServicePath($name));
$context->addStatusCode(Resources::STATUS_OK);
$this->sendHttpContext($context);
} | php | public function deleteStorageService($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_DELETE);
$context->setPath($this->_getStorageServicePath($name));
$context->addStatusCode(Resources::STATUS_OK);
$this->sendHttpContext($context);
} | [
"public",
"function",
"deleteStorageService",
"(",
"$",
"name",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"$",
"context",
"=",
"new",
... | Deletes the specified storage account from Windows Azure.
@param string $name The storage account name
@see http://msdn.microsoft.com/en-us/library/windowsazure/hh264517.aspx | [
"Deletes",
"the",
"specified",
"storage",
"account",
"from",
"Windows",
"Azure",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L529-L540 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.listAffinityGroups | public function listAffinityGroups()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getAffinityGroupPath());
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return ListAffinityGroupsResult::create($serialized);
} | php | public function listAffinityGroups()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getAffinityGroupPath());
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return ListAffinityGroupsResult::create($serialized);
} | [
"public",
"function",
"listAffinityGroups",
"(",
")",
"{",
"$",
"context",
"=",
"new",
"HttpCallContext",
"(",
")",
";",
"$",
"context",
"->",
"setMethod",
"(",
"Resources",
"::",
"HTTP_GET",
")",
";",
"$",
"context",
"->",
"setPath",
"(",
"$",
"this",
"... | Lists the affinity groups associated with the specified subscription.
@return ListAffinityGroupsResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460797.aspx | [
"Lists",
"the",
"affinity",
"groups",
"associated",
"with",
"the",
"specified",
"subscription",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L589-L600 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.createAffinityGroup | public function createAffinityGroup($name, $label, $location, CreateAffinityGroupOptions $options = null)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
Validate::isString($location, 'location');
Validate::notNullOrEmpty($location, 'location');
if (is_null($options)) {
$options = new CreateAffinityGroupOptions();
}
$affinityGroup = new AffinityGroup();
$affinityGroup->setName($name);
$affinityGroup->setLabel($label);
$affinityGroup->setLocation($location);
$affinityGroup->setDescription($options->getDescription());
$affinityGroup->addSerializationProperty(
XmlSerializer::ROOT_NAME,
Resources::XTAG_CREATE_AFFINITY_GROUP
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getAffinityGroupPath());
$context->addStatusCode(Resources::STATUS_CREATED);
$context->setBody($affinityGroup->serialize($this->dataSerializer));
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$this->sendHttpContext($context);
} | php | public function createAffinityGroup($name, $label, $location, CreateAffinityGroupOptions $options = null)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
Validate::isString($location, 'location');
Validate::notNullOrEmpty($location, 'location');
if (is_null($options)) {
$options = new CreateAffinityGroupOptions();
}
$affinityGroup = new AffinityGroup();
$affinityGroup->setName($name);
$affinityGroup->setLabel($label);
$affinityGroup->setLocation($location);
$affinityGroup->setDescription($options->getDescription());
$affinityGroup->addSerializationProperty(
XmlSerializer::ROOT_NAME,
Resources::XTAG_CREATE_AFFINITY_GROUP
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getAffinityGroupPath());
$context->addStatusCode(Resources::STATUS_CREATED);
$context->setBody($affinityGroup->serialize($this->dataSerializer));
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$this->sendHttpContext($context);
} | [
"public",
"function",
"createAffinityGroup",
"(",
"$",
"name",
",",
"$",
"label",
",",
"$",
"location",
",",
"CreateAffinityGroupOptions",
"$",
"options",
"=",
"null",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Vali... | Creates a new affinity group for the specified subscription.
@param string $name The affinity group name
@param string $label The base-64 encoded name for the
affinity group. The name can be up to 100 characters in length
@param string $location The data center location where the
affinity group will be created. To list available locations, use the
listLocations API
@param CreateAffinityGroupOptions $options The optional parameters
@see http://msdn.microsoft.com/en-us/library/windowsazure/gg715317.aspx | [
"Creates",
"a",
"new",
"affinity",
"group",
"for",
"the",
"specified",
"subscription",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L615-L649 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.deleteAffinityGroup | public function deleteAffinityGroup($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_DELETE);
$context->setPath($this->_getAffinityGroupPath($name));
$context->addStatusCode(Resources::STATUS_OK);
$this->sendHttpContext($context);
} | php | public function deleteAffinityGroup($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_DELETE);
$context->setPath($this->_getAffinityGroupPath($name));
$context->addStatusCode(Resources::STATUS_OK);
$this->sendHttpContext($context);
} | [
"public",
"function",
"deleteAffinityGroup",
"(",
"$",
"name",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"$",
"context",
"=",
"new",
... | Deletes an affinity group in the specified subscription.
@param string $name The affinity group name
@see http://msdn.microsoft.com/en-us/library/windowsazure/gg715314.aspx | [
"Deletes",
"an",
"affinity",
"group",
"in",
"the",
"specified",
"subscription",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L658-L669 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.getAffinityGroupProperties | public function getAffinityGroupProperties($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getAffinityGroupPath($name));
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetAffinityGroupPropertiesResult::create($parsed);
} | php | public function getAffinityGroupProperties($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getAffinityGroupPath($name));
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetAffinityGroupPropertiesResult::create($parsed);
} | [
"public",
"function",
"getAffinityGroupProperties",
"(",
"$",
"name",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"$",
"context",
"=",
"... | Returns the system properties associated with the specified affinity group.
@param string $name The affinity group name
@return GetAffinityGroupPropertiesResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460789.aspx | [
"Returns",
"the",
"system",
"properties",
"associated",
"with",
"the",
"specified",
"affinity",
"group",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L722-L736 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.listLocations | public function listLocations()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getLocationPath());
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return ListLocationsResult::create($serialized);
} | php | public function listLocations()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getLocationPath());
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return ListLocationsResult::create($serialized);
} | [
"public",
"function",
"listLocations",
"(",
")",
"{",
"$",
"context",
"=",
"new",
"HttpCallContext",
"(",
")",
";",
"$",
"context",
"->",
"setMethod",
"(",
"Resources",
"::",
"HTTP_GET",
")",
";",
"$",
"context",
"->",
"setPath",
"(",
"$",
"this",
"->",
... | Lists all of the data center locations that are valid for your subscription.
@return ListLocationsResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/gg441293.aspx | [
"Lists",
"all",
"of",
"the",
"data",
"center",
"locations",
"that",
"are",
"valid",
"for",
"your",
"subscription",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L745-L756 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.getOperationStatus | public function getOperationStatus(AsynchronousOperationResult $requestInfo)
{
Validate::notNullOrEmpty($requestInfo, 'requestInfo');
Validate::notNullOrEmpty($requestInfo->getRequestId(), 'requestId');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getOperationPath($requestInfo->getRequestId()));
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return GetOperationStatusResult::create($serialized);
} | php | public function getOperationStatus(AsynchronousOperationResult $requestInfo)
{
Validate::notNullOrEmpty($requestInfo, 'requestInfo');
Validate::notNullOrEmpty($requestInfo->getRequestId(), 'requestId');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getOperationPath($requestInfo->getRequestId()));
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return GetOperationStatusResult::create($serialized);
} | [
"public",
"function",
"getOperationStatus",
"(",
"AsynchronousOperationResult",
"$",
"requestInfo",
")",
"{",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"requestInfo",
",",
"'requestInfo'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"requestInfo",
"-... | Returns the status of the specified operation. After calling an asynchronous
operation, you can call Get Operation Status to determine whether the
operation has succeeded, failed, or is still in progress.
@param AsynchronousOperationResult $requestInfo The request information for
the REST call you want to track
@return GetOperationStatusResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx | [
"Returns",
"the",
"status",
"of",
"the",
"specified",
"operation",
".",
"After",
"calling",
"an",
"asynchronous",
"operation",
"you",
"can",
"call",
"Get",
"Operation",
"Status",
"to",
"determine",
"whether",
"the",
"operation",
"has",
"succeeded",
"failed",
"or... | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L770-L784 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.listHostedServices | public function listHostedServices()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getHostedServicePath());
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return ListHostedServicesResult::create($serialized);
} | php | public function listHostedServices()
{
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getHostedServicePath());
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$serialized = $this->dataSerializer->unserialize($response->getBody());
return ListHostedServicesResult::create($serialized);
} | [
"public",
"function",
"listHostedServices",
"(",
")",
"{",
"$",
"context",
"=",
"new",
"HttpCallContext",
"(",
")",
";",
"$",
"context",
"->",
"setMethod",
"(",
"Resources",
"::",
"HTTP_GET",
")",
";",
"$",
"context",
"->",
"setPath",
"(",
"$",
"this",
"... | Lists the hosted services available under the current subscription.
@return ListHostedServicesResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460781.aspx | [
"Lists",
"the",
"hosted",
"services",
"available",
"under",
"the",
"current",
"subscription",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L793-L804 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.createHostedService | public function createHostedService($name, $label, CreateServiceOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
Validate::notNullOrEmpty($options, 'options');
// User have to set affinity group or location.
$affinityGroup = $options->getAffinityGroup();
$location = $options->getLocation();
Validate::isTrue(
!empty($location) || !empty($affinityGroup),
Resources::INVALID_CREATE_SERVICE_OPTIONS_MSG
);
$hostedService = new HostedService();
$hostedService->setName($name);
$hostedService->setLabel($label);
$hostedService->setLocation($options->getLocation());
$hostedService->setAffinityGroup($options->getAffinityGroup());
$hostedService->setDescription($options->getDescription());
$hostedService->addSerializationProperty(
XmlSerializer::ROOT_NAME,
Resources::XTAG_CREATE_HOSTED_SERVICE
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getHostedServicePath());
$context->addStatusCode(Resources::STATUS_CREATED);
$context->setBody($hostedService->serialize($this->dataSerializer));
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$this->sendHttpContext($context);
} | php | public function createHostedService($name, $label, CreateServiceOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
Validate::notNullOrEmpty($options, 'options');
// User have to set affinity group or location.
$affinityGroup = $options->getAffinityGroup();
$location = $options->getLocation();
Validate::isTrue(
!empty($location) || !empty($affinityGroup),
Resources::INVALID_CREATE_SERVICE_OPTIONS_MSG
);
$hostedService = new HostedService();
$hostedService->setName($name);
$hostedService->setLabel($label);
$hostedService->setLocation($options->getLocation());
$hostedService->setAffinityGroup($options->getAffinityGroup());
$hostedService->setDescription($options->getDescription());
$hostedService->addSerializationProperty(
XmlSerializer::ROOT_NAME,
Resources::XTAG_CREATE_HOSTED_SERVICE
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getHostedServicePath());
$context->addStatusCode(Resources::STATUS_CREATED);
$context->setBody($hostedService->serialize($this->dataSerializer));
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$this->sendHttpContext($context);
} | [
"public",
"function",
"createHostedService",
"(",
"$",
"name",
",",
"$",
"label",
",",
"CreateServiceOptions",
"$",
"options",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
... | Creates a new hosted service in Windows Azure.
@param string $name The name for the hosted service that is unique within Windows Azure. This
name is the DNS prefix name and can be used to access the hosted service
@param string $label The name for the hosted service that is base-64 encoded. The name can be
used identify the storage account for your tracking purposes
@param CreateServiceOptions $options The optional parameters
@see http://msdn.microsoft.com/en-us/library/windowsazure/gg441304.aspx | [
"Creates",
"a",
"new",
"hosted",
"service",
"in",
"Windows",
"Azure",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L817-L855 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.deleteHostedService | public function deleteHostedService($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_DELETE);
$context->setPath($this->_getHostedServicePath($name));
$context->addStatusCode(Resources::STATUS_OK);
$this->sendHttpContext($context);
} | php | public function deleteHostedService($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_DELETE);
$context->setPath($this->_getHostedServicePath($name));
$context->addStatusCode(Resources::STATUS_OK);
$this->sendHttpContext($context);
} | [
"public",
"function",
"deleteHostedService",
"(",
"$",
"name",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"$",
"context",
"=",
"new",
... | Deletes the specified hosted service from Windows Azure.
Before you can delete a hosted service, you must delete any deployments it
has. Attempting to delete a hosted service that has deployments results in
an error. You can call the deleteDeployment API to delete a hosted service's
deployments.
@param string $name The name for the hosted service
@see http://msdn.microsoft.com/en-us/library/windowsazure/gg441305.aspx | [
"Deletes",
"the",
"specified",
"hosted",
"service",
"from",
"Windows",
"Azure",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L911-L922 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.getHostedServiceProperties | public function getHostedServiceProperties($name, GetHostedServicePropertiesOptions $options = null)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
if (is_null($options)) {
$options = new GetHostedServicePropertiesOptions();
}
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getHostedServicePath($name));
$context->addStatusCode(Resources::STATUS_OK);
$context->addQueryParameter(
Resources::QP_EMBED_DETAIL,
Utilities::booleanToString($options->getEmbedDetail())
);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetHostedServicePropertiesResult::create($parsed);
} | php | public function getHostedServiceProperties($name, GetHostedServicePropertiesOptions $options = null)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
if (is_null($options)) {
$options = new GetHostedServicePropertiesOptions();
}
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_GET);
$context->setPath($this->_getHostedServicePath($name));
$context->addStatusCode(Resources::STATUS_OK);
$context->addQueryParameter(
Resources::QP_EMBED_DETAIL,
Utilities::booleanToString($options->getEmbedDetail())
);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetHostedServicePropertiesResult::create($parsed);
} | [
"public",
"function",
"getHostedServiceProperties",
"(",
"$",
"name",
",",
"GetHostedServicePropertiesOptions",
"$",
"options",
"=",
"null",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(... | Retrieves system properties for the specified hosted service. These properties
include the service name and service type; the name of the affinity group to
which the service belongs, or its location if it is not part of an affinity
group; and optionally, information on the service's deployments.
@param string $name The name for the hosted
service
@param GetHostedServicePropertiesOptions $options The optional parameters
@return GetHostedServicePropertiesResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460806.aspx | [
"Retrieves",
"system",
"properties",
"for",
"the",
"specified",
"hosted",
"service",
".",
"These",
"properties",
"include",
"the",
"service",
"name",
"and",
"service",
"type",
";",
"the",
"name",
"of",
"the",
"affinity",
"group",
"to",
"which",
"the",
"service... | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L938-L960 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.createDeployment | public function createDeployment(
$name,
$deploymentName,
$slot,
$packageUrl,
$configuration,
$label,
CreateDeploymentOptions $options = null
) {
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($deploymentName, 'deploymentName');
Validate::notNullOrEmpty($deploymentName, 'deploymentName');
Validate::isString($slot, 'slot');
Validate::notNullOrEmpty($slot, 'slot');
Validate::isTrue(
DeploymentSlot::isValid($slot),
sprintf(Resources::INVALID_SLOT, $slot)
);
Validate::isString($packageUrl, 'packageUrl');
Validate::notNullOrEmpty($packageUrl, 'packageUrl');
Validate::isString($configuration, 'configuration');
Validate::notNullOrEmpty($configuration, 'configuration');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
if (is_null($options)) {
$options = new CreateDeploymentOptions();
}
$configuration = $this->_encodeConfiguration($configuration);
$startDeployment = Utilities::booleanToString(
$options->getStartDeployment()
);
$treatWarningsAsErrors = Utilities::booleanToString(
$options->getTreatWarningsAsErrors()
);
$xmlElements = [
Resources::XTAG_NAME => $deploymentName,
Resources::XTAG_PACKAGE_URL => $packageUrl,
Resources::XTAG_LABEL => $label,
Resources::XTAG_CONFIGURATION => $configuration,
Resources::XTAG_START_DEPLOYMENT => $startDeployment,
Resources::XTAG_TREAT_WARNINGS_AS_ERROR => $treatWarningsAsErrors,
];
$requestXml = $this->_createRequestXml(
$xmlElements,
Resources::XTAG_CREATE_DEPLOYMENT
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPathUsingSlot($name, $slot));
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->setBody($requestXml);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | public function createDeployment(
$name,
$deploymentName,
$slot,
$packageUrl,
$configuration,
$label,
CreateDeploymentOptions $options = null
) {
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($deploymentName, 'deploymentName');
Validate::notNullOrEmpty($deploymentName, 'deploymentName');
Validate::isString($slot, 'slot');
Validate::notNullOrEmpty($slot, 'slot');
Validate::isTrue(
DeploymentSlot::isValid($slot),
sprintf(Resources::INVALID_SLOT, $slot)
);
Validate::isString($packageUrl, 'packageUrl');
Validate::notNullOrEmpty($packageUrl, 'packageUrl');
Validate::isString($configuration, 'configuration');
Validate::notNullOrEmpty($configuration, 'configuration');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
if (is_null($options)) {
$options = new CreateDeploymentOptions();
}
$configuration = $this->_encodeConfiguration($configuration);
$startDeployment = Utilities::booleanToString(
$options->getStartDeployment()
);
$treatWarningsAsErrors = Utilities::booleanToString(
$options->getTreatWarningsAsErrors()
);
$xmlElements = [
Resources::XTAG_NAME => $deploymentName,
Resources::XTAG_PACKAGE_URL => $packageUrl,
Resources::XTAG_LABEL => $label,
Resources::XTAG_CONFIGURATION => $configuration,
Resources::XTAG_START_DEPLOYMENT => $startDeployment,
Resources::XTAG_TREAT_WARNINGS_AS_ERROR => $treatWarningsAsErrors,
];
$requestXml = $this->_createRequestXml(
$xmlElements,
Resources::XTAG_CREATE_DEPLOYMENT
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPathUsingSlot($name, $slot));
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->setBody($requestXml);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"public",
"function",
"createDeployment",
"(",
"$",
"name",
",",
"$",
"deploymentName",
",",
"$",
"slot",
",",
"$",
"packageUrl",
",",
"$",
"configuration",
",",
"$",
"label",
",",
"CreateDeploymentOptions",
"$",
"options",
"=",
"null",
")",
"{",
"Validate",... | Uploads a new service package and creates a new deployment on staging or
production.
The createDeployment API is an asynchronous operation. To determine whether
the management service has finished processing the request, call
getOperationStatus API.
@param string $name The name for the hosted service
that is unique within Windows Azure
@param string $deploymentName The name for the deployment. The deployment name must be unique
among other deployments for the hosted service
@param string $slot The name of the deployment slot
This can be "production" or "staging"
@param string $packageUrl The URL that refers to the location of the service package in the
Blob service. The service package can be located in a storage
account beneath the same subscription
@param string|resource $configuration The configuration file contents or file stream
@param string $label The name for the hosted service that is base-64 encoded. The name
can be up to 100 characters in length. It is recommended that the
label be unique within the subscription. The name can be used
identify the hosted service for your tracking purposes
@param CreateDeploymentOptions $options The optional parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460813.aspx | [
"Uploads",
"a",
"new",
"service",
"package",
"and",
"creates",
"a",
"new",
"deployment",
"on",
"staging",
"or",
"production",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L990-L1054 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.getDeployment | public function getDeployment($name, GetDeploymentOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::notNullOrEmpty($options, 'options');
$context = new HttpCallContext();
$path = $this->_getDeploymentPath($name, $options);
$context->setMethod(Resources::HTTP_GET);
$context->setPath($path);
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetDeploymentResult::create($parsed);
} | php | public function getDeployment($name, GetDeploymentOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::notNullOrEmpty($options, 'options');
$context = new HttpCallContext();
$path = $this->_getDeploymentPath($name, $options);
$context->setMethod(Resources::HTTP_GET);
$context->setPath($path);
$context->addStatusCode(Resources::STATUS_OK);
$response = $this->sendHttpContext($context);
$parsed = $this->dataSerializer->unserialize($response->getBody());
return GetDeploymentResult::create($parsed);
} | [
"public",
"function",
"getDeployment",
"(",
"$",
"name",
",",
"GetDeploymentOptions",
"$",
"options",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")... | Returns configuration information, status, and system properties for a
deployment.
The getDeployment API can be used to retrieve information for a specific
deployment or for all deployments in the staging or production environment.
If you want to retrieve information about a specific deployment, you must
first get the unique name for the deployment. This unique name is part of the
response when you make a request to get all deployments in an environment.
@param string $name The hosted service name
@param GetDeploymentOptions $options The optional parameters
@return GetDeploymentResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx | [
"Returns",
"configuration",
"information",
"status",
"and",
"system",
"properties",
"for",
"a",
"deployment",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1073-L1089 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.swapDeployment | public function swapDeployment($name, $source, $destination)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($destination, 'destination');
Validate::notNullOrEmpty($destination, 'destination');
Validate::isString($source, 'source');
Validate::notNullOrEmpty($source, 'source');
$xmlElements = [
Resources::XTAG_PRODUCTION => $destination,
Resources::XTAG_SOURCE_DEPLOYMENT => $source,
];
$body = $this->_createRequestXml($xmlElements, Resources::XTAG_SWAP);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getHostedServicePath($name));
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | public function swapDeployment($name, $source, $destination)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($destination, 'destination');
Validate::notNullOrEmpty($destination, 'destination');
Validate::isString($source, 'source');
Validate::notNullOrEmpty($source, 'source');
$xmlElements = [
Resources::XTAG_PRODUCTION => $destination,
Resources::XTAG_SOURCE_DEPLOYMENT => $source,
];
$body = $this->_createRequestXml($xmlElements, Resources::XTAG_SWAP);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getHostedServicePath($name));
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"public",
"function",
"swapDeployment",
"(",
"$",
"name",
",",
"$",
"source",
",",
"$",
"destination",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",... | Initiates a virtual IP swap between the staging and production deployment
environments for a service. If the service is currently running in the staging
environment, it will be swapped to the production environment. If it is
running in the production environment, it will be swapped to staging.
You can swap VIPs only if the number of endpoints specified by the service
definition is identical for both deployments. For example, if you add an HTTPS
endpoint to a web role that previously exposed only an HTTP endpoint, you
cannot upgrade your service using a VIP swap; you must delete your production
deployment and redeploy instead. You can obtain information about endpoints
that are used by using the Get Deployment operation.
@param string $name The hosted service name
@param string $source The name of the source deployment
@param string $destination The name of the destination deployment
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460814.aspx | [
"Initiates",
"a",
"virtual",
"IP",
"swap",
"between",
"the",
"staging",
"and",
"production",
"deployment",
"environments",
"for",
"a",
"service",
".",
"If",
"the",
"service",
"is",
"currently",
"running",
"in",
"the",
"staging",
"environment",
"it",
"will",
"b... | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1112-L1139 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.deleteDeployment | public function deleteDeployment($name, GetDeploymentOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::notNullOrEmpty($options, 'options');
$context = new HttpCallContext();
$path = $this->_getDeploymentPath($name, $options);
$context->setMethod(Resources::HTTP_DELETE);
$context->setPath($path);
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | public function deleteDeployment($name, GetDeploymentOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::notNullOrEmpty($options, 'options');
$context = new HttpCallContext();
$path = $this->_getDeploymentPath($name, $options);
$context->setMethod(Resources::HTTP_DELETE);
$context->setPath($path);
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"public",
"function",
"deleteDeployment",
"(",
"$",
"name",
",",
"GetDeploymentOptions",
"$",
"options",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
... | Deletes the specified deployment.
Note that you can delete a deployment either by specifying the deployment
environment (staging or production), or by specifying the deployment's unique
name.
@param string $name The hosted service name
@param GetDeploymentOptions $options The optional parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460815.aspx | [
"Deletes",
"the",
"specified",
"deployment",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1155-L1170 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.changeDeploymentConfiguration | public function changeDeploymentConfiguration(
$name, $configuration, ChangeDeploymentConfigurationOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($configuration, 'configuration');
Validate::notNullOrEmpty($configuration, 'configuration');
Validate::notNullOrEmpty($options, 'options');
$configuration = $this->_encodeConfiguration($configuration);
$warningsTreatment = Utilities::booleanToString(
$options->getTreatWarningsAsErrors()
);
$xmlElements = [
Resources::XTAG_CONFIGURATION => $configuration,
Resources::XTAG_TREAT_WARNINGS_AS_ERROR => $warningsTreatment,
Resources::XTAG_MODE => $options->getMode(),
];
$body = $this->_createRequestXml(
$xmlElements,
Resources::XTAG_CHANGE_CONFIGURATION
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPath($name, $options).'/');
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(
Resources::QP_COMP,
Resources::QPV_CONFIG
);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
assert(Utilities::endsWith($context->getPath(), '/'));
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | public function changeDeploymentConfiguration(
$name, $configuration, ChangeDeploymentConfigurationOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($configuration, 'configuration');
Validate::notNullOrEmpty($configuration, 'configuration');
Validate::notNullOrEmpty($options, 'options');
$configuration = $this->_encodeConfiguration($configuration);
$warningsTreatment = Utilities::booleanToString(
$options->getTreatWarningsAsErrors()
);
$xmlElements = [
Resources::XTAG_CONFIGURATION => $configuration,
Resources::XTAG_TREAT_WARNINGS_AS_ERROR => $warningsTreatment,
Resources::XTAG_MODE => $options->getMode(),
];
$body = $this->_createRequestXml(
$xmlElements,
Resources::XTAG_CHANGE_CONFIGURATION
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPath($name, $options).'/');
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(
Resources::QP_COMP,
Resources::QPV_CONFIG
);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
assert(Utilities::endsWith($context->getPath(), '/'));
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"public",
"function",
"changeDeploymentConfiguration",
"(",
"$",
"name",
",",
"$",
"configuration",
",",
"ChangeDeploymentConfigurationOptions",
"$",
"options",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
... | Initiates a change to the deployment configuration.
Note that you can change a deployment's configuration either by specifying the
deployment environment (staging or production), or by specifying the
deployment's unique name.
@param string $name The hosted service
name
@param string|resource $configuration The configuration
file contents or file stream
@param ChangeDeploymentConfigurationOptions $options The optional
parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460809.aspx | [
"Initiates",
"a",
"change",
"to",
"the",
"deployment",
"configuration",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1190-L1230 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.updateDeploymentStatus | public function updateDeploymentStatus($name, $status, GetDeploymentOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isTrue(
DeploymentStatus::isValid($status),
Resources::INVALID_DEPLOYMENT_STATUS_MSG
);
Validate::notNullOrEmpty($options, 'options');
$body = $this->_createRequestXml(
[Resources::XTAG_STATUS => $status],
Resources::XTAG_UPDATE_DEPLOYMENT_STATUS
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPath($name, $options).'/');
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(
Resources::QP_COMP,
Resources::QPV_STATUS
);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
assert(Utilities::endsWith($context->getPath(), '/'));
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | public function updateDeploymentStatus($name, $status, GetDeploymentOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isTrue(
DeploymentStatus::isValid($status),
Resources::INVALID_DEPLOYMENT_STATUS_MSG
);
Validate::notNullOrEmpty($options, 'options');
$body = $this->_createRequestXml(
[Resources::XTAG_STATUS => $status],
Resources::XTAG_UPDATE_DEPLOYMENT_STATUS
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPath($name, $options).'/');
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(
Resources::QP_COMP,
Resources::QPV_STATUS
);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
assert(Utilities::endsWith($context->getPath(), '/'));
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"public",
"function",
"updateDeploymentStatus",
"(",
"$",
"name",
",",
"$",
"status",
",",
"GetDeploymentOptions",
"$",
"options",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$"... | Initiates a change in deployment status.
Note that you can change deployment status either by specifying the deployment
environment (staging or production), or by specifying the deployment's unique
name.
@param string $name The hosted service name
@param string $status The change to initiate to the
deployment status.
Possible values include Running or Suspended
@param GetDeploymentOptions $options The optional parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460808.aspx | [
"Initiates",
"a",
"change",
"in",
"deployment",
"status",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1249-L1281 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.upgradeDeployment | public function upgradeDeployment(
$name,
$mode,
$packageUrl,
$configuration,
$label,
$force,
UpgradeDeploymentOptions $options
) {
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($mode, 'mode');
Validate::isTrue(Mode::isValid($mode), Resources::INVALID_CHANGE_MODE_MSG);
Validate::isString($packageUrl, 'packageUrl');
Validate::notNullOrEmpty($packageUrl, 'packageUrl');
Validate::isString($configuration, 'configuration');
Validate::notNullOrEmpty($configuration, 'configuration');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
Validate::isBoolean($force, 'force');
Validate::notNullOrEmpty($force, 'force');
Validate::notNullOrEmpty($options, 'options');
$configuration = $this->_encodeConfiguration($configuration);
$xmlElements = [
Resources::XTAG_MODE => $mode,
Resources::XTAG_PACKAGE_URL => $packageUrl,
Resources::XTAG_CONFIGURATION => $configuration,
Resources::XTAG_LABEL => $label,
Resources::XTAG_ROLE_TO_UPGRADE => $options->getRoleToUpgrade(),
Resources::XTAG_FORCE => Utilities::booleanToString($force),
];
$body = $this->_createRequestXml(
$xmlElements,
Resources::XTAG_UPGRADE_DEPLOYMENT
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPath($name, $options).'/');
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(
Resources::QP_COMP,
Resources::QPV_UPGRADE
);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
assert(Utilities::endsWith($context->getPath(), '/'));
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | public function upgradeDeployment(
$name,
$mode,
$packageUrl,
$configuration,
$label,
$force,
UpgradeDeploymentOptions $options
) {
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isString($mode, 'mode');
Validate::isTrue(Mode::isValid($mode), Resources::INVALID_CHANGE_MODE_MSG);
Validate::isString($packageUrl, 'packageUrl');
Validate::notNullOrEmpty($packageUrl, 'packageUrl');
Validate::isString($configuration, 'configuration');
Validate::notNullOrEmpty($configuration, 'configuration');
Validate::isString($label, 'label');
Validate::notNullOrEmpty($label, 'label');
Validate::isBoolean($force, 'force');
Validate::notNullOrEmpty($force, 'force');
Validate::notNullOrEmpty($options, 'options');
$configuration = $this->_encodeConfiguration($configuration);
$xmlElements = [
Resources::XTAG_MODE => $mode,
Resources::XTAG_PACKAGE_URL => $packageUrl,
Resources::XTAG_CONFIGURATION => $configuration,
Resources::XTAG_LABEL => $label,
Resources::XTAG_ROLE_TO_UPGRADE => $options->getRoleToUpgrade(),
Resources::XTAG_FORCE => Utilities::booleanToString($force),
];
$body = $this->_createRequestXml(
$xmlElements,
Resources::XTAG_UPGRADE_DEPLOYMENT
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPath($name, $options).'/');
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(
Resources::QP_COMP,
Resources::QPV_UPGRADE
);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
assert(Utilities::endsWith($context->getPath(), '/'));
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"public",
"function",
"upgradeDeployment",
"(",
"$",
"name",
",",
"$",
"mode",
",",
"$",
"packageUrl",
",",
"$",
"configuration",
",",
"$",
"label",
",",
"$",
"force",
",",
"UpgradeDeploymentOptions",
"$",
"options",
")",
"{",
"Validate",
"::",
"isString",
... | Initiates an upgrade to a deployment.
Note that you can upgrade a deployment either by specifying the deployment
environment (staging or production), or by specifying the deployment's unique
name.
@param string $name The hosted service name
@param string $mode The type of upgrade to initiate. If not specified the default
value is Auto. If set to Manual, walkUpgradeDomain API must be
called to apply the update. If set to Auto, the Windows Azure
platform will automatically apply the update to each Upgrade
Domain in sequence
@param string $packageUrl The URL that refers to the location of the service package in the
Blob service. The service package can be located in a storage
account beneath the same subscription
@param string|resource $configuration The configuration file contents
or file stream
@param string $label The name for the hosted service that is base-64 encoded. The name
may be up to 100 characters in length
@param bool $force Specifies whether the rollback should proceed even when it will
cause local data to be lost from some role instances. True if the
rollback should proceed; otherwise false if the rollback should
fail
@param UpgradeDeploymentOptions $options The optional parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460793.aspx | [
"Initiates",
"an",
"upgrade",
"to",
"a",
"deployment",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1313-L1368 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.walkUpgradeDomain | public function walkUpgradeDomain(
$name, $upgradeDomain, GetDeploymentOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isInteger($upgradeDomain, 'upgradeDomain');
Validate::notNullOrEmpty($options, 'options');
$body = $this->_createRequestXml(
[Resources::XTAG_UPGRADE_DOMAIN => $upgradeDomain],
Resources::XTAG_WALK_UPGRADE_DOMAIN
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPath($name, $options).'/');
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(
Resources::QP_COMP,
Resources::QPV_WALK_UPGRADE_DOMAIN
);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
assert(Utilities::endsWith($context->getPath(), '/'));
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | php | public function walkUpgradeDomain(
$name, $upgradeDomain, GetDeploymentOptions $options)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
Validate::isInteger($upgradeDomain, 'upgradeDomain');
Validate::notNullOrEmpty($options, 'options');
$body = $this->_createRequestXml(
[Resources::XTAG_UPGRADE_DOMAIN => $upgradeDomain],
Resources::XTAG_WALK_UPGRADE_DOMAIN
);
$context = new HttpCallContext();
$context->setMethod(Resources::HTTP_POST);
$context->setPath($this->_getDeploymentPath($name, $options).'/');
$context->addStatusCode(Resources::STATUS_ACCEPTED);
$context->addQueryParameter(
Resources::QP_COMP,
Resources::QPV_WALK_UPGRADE_DOMAIN
);
$context->setBody($body);
$context->addHeader(
Resources::CONTENT_TYPE,
Resources::XML_CONTENT_TYPE
);
assert(Utilities::endsWith($context->getPath(), '/'));
$response = $this->sendHttpContext($context);
return AsynchronousOperationResult::create(HttpClient::getResponseHeaders($response));
} | [
"public",
"function",
"walkUpgradeDomain",
"(",
"$",
"name",
",",
"$",
"upgradeDomain",
",",
"GetDeploymentOptions",
"$",
"options",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"... | Specifies the next upgrade domain to be walked during manual in-place upgrade
or configuration change.
Note that you can walk an upgrade domain either by specifying the deployment
environment (staging or production), or by specifying the deployment's unique
name.
@param string $name The hosted service name
@param int $upgradeDomain The integer value that identifies the upgrade domain to walk. Upgrade
domains are identified with a zero-based index: the first upgrade
domain has an ID of 0, the second has an ID of 1, and so on
@param GetDeploymentOptions $options The optional parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/ee460800.aspx | [
"Specifies",
"the",
"next",
"upgrade",
"domain",
"to",
"be",
"walked",
"during",
"manual",
"in",
"-",
"place",
"upgrade",
"or",
"configuration",
"change",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1388-L1418 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.rebootRoleInstance | public function rebootRoleInstance($name, $roleName, $options)
{
return $this->_sendRoleInstanceOrder(
$name,
$roleName,
$options,
Resources::QPV_REBOOT
);
} | php | public function rebootRoleInstance($name, $roleName, $options)
{
return $this->_sendRoleInstanceOrder(
$name,
$roleName,
$options,
Resources::QPV_REBOOT
);
} | [
"public",
"function",
"rebootRoleInstance",
"(",
"$",
"name",
",",
"$",
"roleName",
",",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"_sendRoleInstanceOrder",
"(",
"$",
"name",
",",
"$",
"roleName",
",",
"$",
"options",
",",
"Resources",
"::",
... | Requests a reboot of a role instance that is running in a deployment.
Note that you can reboot role instance either by specifying the deployment
environment (staging or production), or by specifying the deployment's unique
name.
@param string $name The hosted service name
@param string $roleName The role instance name
@param GetDeploymentOptions $options The optional parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/gg441298.aspx | [
"Requests",
"a",
"reboot",
"of",
"a",
"role",
"instance",
"that",
"is",
"running",
"in",
"a",
"deployment",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1435-L1443 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/ServiceManagementRestProxy.php | ServiceManagementRestProxy.reimageRoleInstance | public function reimageRoleInstance($name, $roleName, $options)
{
return $this->_sendRoleInstanceOrder(
$name,
$roleName,
$options,
Resources::QPV_REIMAGE
);
} | php | public function reimageRoleInstance($name, $roleName, $options)
{
return $this->_sendRoleInstanceOrder(
$name,
$roleName,
$options,
Resources::QPV_REIMAGE
);
} | [
"public",
"function",
"reimageRoleInstance",
"(",
"$",
"name",
",",
"$",
"roleName",
",",
"$",
"options",
")",
"{",
"return",
"$",
"this",
"->",
"_sendRoleInstanceOrder",
"(",
"$",
"name",
",",
"$",
"roleName",
",",
"$",
"options",
",",
"Resources",
"::",
... | Requests a reimage of a role instance that is running in a deployment.
Note that you can reimage role instance either by specifying the deployment
environment (staging or production), or by specifying the deployment's unique
name.
@param string $name The hosted service name
@param string $roleName The role instance name
@param GetDeploymentOptions $options The optional parameters
@return AsynchronousOperationResult
@see http://msdn.microsoft.com/en-us/library/windowsazure/gg441292.aspx | [
"Requests",
"a",
"reimage",
"of",
"a",
"role",
"instance",
"that",
"is",
"running",
"in",
"a",
"deployment",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/ServiceManagementRestProxy.php#L1460-L1468 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/UpgradeDeploymentOptions.php | UpgradeDeploymentOptions.setRoleToUpgrade | public function setRoleToUpgrade($roleToUpgrade)
{
Validate::isString($roleToUpgrade, 'roleToUpgrade');
Validate::notNullOrEmpty($roleToUpgrade, 'roleToUpgrade');
$this->_roleToUpgrade = $roleToUpgrade;
} | php | public function setRoleToUpgrade($roleToUpgrade)
{
Validate::isString($roleToUpgrade, 'roleToUpgrade');
Validate::notNullOrEmpty($roleToUpgrade, 'roleToUpgrade');
$this->_roleToUpgrade = $roleToUpgrade;
} | [
"public",
"function",
"setRoleToUpgrade",
"(",
"$",
"roleToUpgrade",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"roleToUpgrade",
",",
"'roleToUpgrade'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"roleToUpgrade",
",",
"'roleToUpgrade'",
")",
... | Sets the role to upgrade name.
@param string $roleToUpgrade The role to upgrade name | [
"Sets",
"the",
"role",
"to",
"upgrade",
"name",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/UpgradeDeploymentOptions.php#L67-L73 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/ListLocationsResult.php | ListLocationsResult.create | public static function create($parsed)
{
$result = new self();
$result->_locations = [];
$entries = [];
if (!empty($parsed)) {
$entries = Utilities::getArray($parsed[Resources::XTAG_LOCATION]);
}
foreach ($entries as $value) {
$location = new Location();
$location->setName(Utilities::tryGetValue($value, Resources::XTAG_NAME));
$location->setDisplayName(
Utilities::tryGetValue($value, Resources::XTAG_DISPLAY_NAME)
);
$result->_locations[] = $location;
}
return $result;
} | php | public static function create($parsed)
{
$result = new self();
$result->_locations = [];
$entries = [];
if (!empty($parsed)) {
$entries = Utilities::getArray($parsed[Resources::XTAG_LOCATION]);
}
foreach ($entries as $value) {
$location = new Location();
$location->setName(Utilities::tryGetValue($value, Resources::XTAG_NAME));
$location->setDisplayName(
Utilities::tryGetValue($value, Resources::XTAG_DISPLAY_NAME)
);
$result->_locations[] = $location;
}
return $result;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"result",
"=",
"new",
"self",
"(",
")",
";",
"$",
"result",
"->",
"_locations",
"=",
"[",
"]",
";",
"$",
"entries",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"... | Creates new ListLocationsResult from parsed response body.
@param array $parsed The parsed response body
@return ListLocationsResult | [
"Creates",
"new",
"ListLocationsResult",
"from",
"parsed",
"response",
"body",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/ListLocationsResult.php#L58-L79 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/AudioStream.php | AudioStream.fromArray | public function fromArray($options)
{
if (isset($options['Index'])) {
Validate::isInteger($options['Index'], 'options[Index]');
$this->_index = (int) $options['Index'];
}
if (isset($options['Language'])) {
Validate::isString($options['Language'], 'options[Language]');
$this->_language = $options['Language'];
}
} | php | public function fromArray($options)
{
if (isset($options['Index'])) {
Validate::isInteger($options['Index'], 'options[Index]');
$this->_index = (int) $options['Index'];
}
if (isset($options['Language'])) {
Validate::isString($options['Language'], 'options[Language]');
$this->_language = $options['Language'];
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Index'",
"]",
")",
")",
"{",
"Validate",
"::",
"isInteger",
"(",
"$",
"options",
"[",
"'Index'",
"]",
",",
"'options[Index]'",
")",
";",
... | Fill AudioStreams from array.
@param array $options Array containing values for object properties | [
"Fill",
"AudioStreams",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/AudioStream.php#L96-L107 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/RuntimeKernel.php | RuntimeKernel.getKernel | public static function getKernel($forceNewInstance = false)
{
if (is_null(self::$_theKernel) || $forceNewInstance) {
self::$_theKernel = new self();
}
return self::$_theKernel;
} | php | public static function getKernel($forceNewInstance = false)
{
if (is_null(self::$_theKernel) || $forceNewInstance) {
self::$_theKernel = new self();
}
return self::$_theKernel;
} | [
"public",
"static",
"function",
"getKernel",
"(",
"$",
"forceNewInstance",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_theKernel",
")",
"||",
"$",
"forceNewInstance",
")",
"{",
"self",
"::",
"$",
"_theKernel",
"=",
"new",
"sel... | Gets the current kernel instance.
@param bool $forceNewInstance Boolean value indicating if a new instance
should be obtained even if a previous one exists
@return RuntimeKernel | [
"Gets",
"the",
"current",
"kernel",
"instance",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/RuntimeKernel.php#L157-L164 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Http/BatchRequest.php | BatchRequest.encode | public function encode()
{
$mimeType = Resources::MULTIPART_MIXED_TYPE;
$batchGuid = Utilities::getGuid();
$batchId = sprintf('batch_%s', $batchGuid);
$contentType1 = ['content_type' => "$mimeType"];
$changeSetGuid = Utilities::getGuid();
$changeSetId = sprintf('changeset_%s', $changeSetGuid);
$contentType2 = ['content_type' => "$mimeType; boundary=$changeSetId"];
$options = [
'encoding' => 'binary',
'content_type' => Resources::HTTP_TYPE,
];
// Create changeset MIME part
$changeSet = new Mail_mimePart();
$i = 1;
foreach ($this->_contexts as $context) {
$context->addHeader(Resources::CONTENT_ID, $i);
$changeSet->addSubpart((string) $context, $options);
++$i;
}
// Encode the changeset MIME part
$changeSetEncoded = $changeSet->encode($changeSetId);
// Create the batch MIME part
$batch = new Mail_mimePart(Resources::EMPTY_STRING, $contentType1);
// Add changeset encoded to batch MIME part
$batch->addSubpart($changeSetEncoded['body'], $contentType2);
// Encode batch MIME part
$batchEncoded = $batch->encode($batchId);
$this->_headers = $batchEncoded['headers'];
$this->_body = $batchEncoded['body'];
} | php | public function encode()
{
$mimeType = Resources::MULTIPART_MIXED_TYPE;
$batchGuid = Utilities::getGuid();
$batchId = sprintf('batch_%s', $batchGuid);
$contentType1 = ['content_type' => "$mimeType"];
$changeSetGuid = Utilities::getGuid();
$changeSetId = sprintf('changeset_%s', $changeSetGuid);
$contentType2 = ['content_type' => "$mimeType; boundary=$changeSetId"];
$options = [
'encoding' => 'binary',
'content_type' => Resources::HTTP_TYPE,
];
// Create changeset MIME part
$changeSet = new Mail_mimePart();
$i = 1;
foreach ($this->_contexts as $context) {
$context->addHeader(Resources::CONTENT_ID, $i);
$changeSet->addSubpart((string) $context, $options);
++$i;
}
// Encode the changeset MIME part
$changeSetEncoded = $changeSet->encode($changeSetId);
// Create the batch MIME part
$batch = new Mail_mimePart(Resources::EMPTY_STRING, $contentType1);
// Add changeset encoded to batch MIME part
$batch->addSubpart($changeSetEncoded['body'], $contentType2);
// Encode batch MIME part
$batchEncoded = $batch->encode($batchId);
$this->_headers = $batchEncoded['headers'];
$this->_body = $batchEncoded['body'];
} | [
"public",
"function",
"encode",
"(",
")",
"{",
"$",
"mimeType",
"=",
"Resources",
"::",
"MULTIPART_MIXED_TYPE",
";",
"$",
"batchGuid",
"=",
"Utilities",
"::",
"getGuid",
"(",
")",
";",
"$",
"batchId",
"=",
"sprintf",
"(",
"'batch_%s'",
",",
"$",
"batchGuid... | Encode contexts. | [
"Encode",
"contexts",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Http/BatchRequest.php#L81-L120 | train |
Azure/azure-sdk-for-php | src/Common/Internal/OAuthRestProxy.php | OAuthRestProxy.getAccessToken | public function getAccessToken($grantType, $clientId, $clientSecret, $scope)
{
$method = Resources::HTTP_POST;
$headers = [];
$queryParams = [];
$postParameters = [];
$statusCode = Resources::STATUS_OK;
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_GRANT_TYPE,
$grantType
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ID,
$clientId
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_SECRET,
$clientSecret
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_SCOPE,
$scope
);
$response = $this->sendHttp(
$method,
$headers,
$queryParams,
$postParameters,
Resources::EMPTY_STRING,
$statusCode
);
return OAuthAccessToken::create(
$this->dataSerializer->unserialize($response->getBody())
);
} | php | public function getAccessToken($grantType, $clientId, $clientSecret, $scope)
{
$method = Resources::HTTP_POST;
$headers = [];
$queryParams = [];
$postParameters = [];
$statusCode = Resources::STATUS_OK;
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_GRANT_TYPE,
$grantType
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ID,
$clientId
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_SECRET,
$clientSecret
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_SCOPE,
$scope
);
$response = $this->sendHttp(
$method,
$headers,
$queryParams,
$postParameters,
Resources::EMPTY_STRING,
$statusCode
);
return OAuthAccessToken::create(
$this->dataSerializer->unserialize($response->getBody())
);
} | [
"public",
"function",
"getAccessToken",
"(",
"$",
"grantType",
",",
"$",
"clientId",
",",
"$",
"clientSecret",
",",
"$",
"scope",
")",
"{",
"$",
"method",
"=",
"Resources",
"::",
"HTTP_POST",
";",
"$",
"headers",
"=",
"[",
"]",
";",
"$",
"queryParams",
... | Get OAuth access token.
@param string $grantType OAuth request grant_type field value
@param string $clientId OAuth request client_id field value
@param string $clientSecret OAuth request client_secret field value
@param string $scope OAuth request scope field value
@return OAuthAccessToken | [
"Get",
"OAuth",
"access",
"token",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/OAuthRestProxy.php#L73-L117 | train |
Azure/azure-sdk-for-php | src/Common/Models/ServiceProperties.php | ServiceProperties.create | public static function create(array $parsedResponse)
{
$result = new self();
$result->setLogging(Logging::create($parsedResponse['Logging']));
$result->setMetrics(Metrics::create($parsedResponse['Metrics']));
return $result;
} | php | public static function create(array $parsedResponse)
{
$result = new self();
$result->setLogging(Logging::create($parsedResponse['Logging']));
$result->setMetrics(Metrics::create($parsedResponse['Metrics']));
return $result;
} | [
"public",
"static",
"function",
"create",
"(",
"array",
"$",
"parsedResponse",
")",
"{",
"$",
"result",
"=",
"new",
"self",
"(",
")",
";",
"$",
"result",
"->",
"setLogging",
"(",
"Logging",
"::",
"create",
"(",
"$",
"parsedResponse",
"[",
"'Logging'",
"]... | Creates ServiceProperties object from parsed XML response.
@param array $parsedResponse XML response parsed into array
@return ServiceProperties | [
"Creates",
"ServiceProperties",
"object",
"from",
"parsed",
"XML",
"response",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Models/ServiceProperties.php#L64-L71 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/Protocol1RuntimeClientFactory.php | Protocol1RuntimeClientFactory.createRuntimeClient | public function createRuntimeClient($path)
{
$kernel = RuntimeKernel::getKernel();
return new Protocol1RuntimeClient(
$kernel->getProtocol1RuntimeGoalStateClient(),
$kernel->getProtocol1RuntimeCurrentStateClient(),
$path
);
} | php | public function createRuntimeClient($path)
{
$kernel = RuntimeKernel::getKernel();
return new Protocol1RuntimeClient(
$kernel->getProtocol1RuntimeGoalStateClient(),
$kernel->getProtocol1RuntimeCurrentStateClient(),
$path
);
} | [
"public",
"function",
"createRuntimeClient",
"(",
"$",
"path",
")",
"{",
"$",
"kernel",
"=",
"RuntimeKernel",
"::",
"getKernel",
"(",
")",
";",
"return",
"new",
"Protocol1RuntimeClient",
"(",
"$",
"kernel",
"->",
"getProtocol1RuntimeGoalStateClient",
"(",
")",
"... | Creates a new runtime client instance.
@param string $path The goal state path
@return Protocol1RuntimeClient | [
"Creates",
"a",
"new",
"runtime",
"client",
"instance",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/Protocol1RuntimeClientFactory.php#L60-L69 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ChannelSlate.php | ChannelSlate.fromArray | public function fromArray($options)
{
if (isset($options['InsertSlateOnAdMarker'])) {
Validate::isBoolean($options['InsertSlateOnAdMarker'], 'options[InsertSlateOnAdMarker]');
$this->_insertSlateOnAdMarker = (bool) $options['InsertSlateOnAdMarker'];
}
if (isset($options['DefaultSlateAssetId'])) {
Validate::isString($options['DefaultSlateAssetId'], 'options[DefaultSlateAssetIdUrl]');
$this->_defaultSlateAssetId = $options['DefaultSlateAssetId'];
}
} | php | public function fromArray($options)
{
if (isset($options['InsertSlateOnAdMarker'])) {
Validate::isBoolean($options['InsertSlateOnAdMarker'], 'options[InsertSlateOnAdMarker]');
$this->_insertSlateOnAdMarker = (bool) $options['InsertSlateOnAdMarker'];
}
if (isset($options['DefaultSlateAssetId'])) {
Validate::isString($options['DefaultSlateAssetId'], 'options[DefaultSlateAssetIdUrl]');
$this->_defaultSlateAssetId = $options['DefaultSlateAssetId'];
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'InsertSlateOnAdMarker'",
"]",
")",
")",
"{",
"Validate",
"::",
"isBoolean",
"(",
"$",
"options",
"[",
"'InsertSlateOnAdMarker'",
"]",
",",
"'o... | Fill ChannelSlate from array.
@param array $options Array containing values for object properties | [
"Fill",
"ChannelSlate",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ChannelSlate.php#L86-L97 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Authentication/TableSharedKeyLiteAuthScheme.php | TableSharedKeyLiteAuthScheme.computeSignature | protected function computeSignature($headers, $url, $queryParams, $httpMethod)
{
$canonicalizedResource = parent::computeCanonicalizedResourceForTable(
$url, $queryParams
);
$stringToSign = [];
foreach ($this->includedHeaders as $header) {
$stringToSign[] = Utilities::tryGetValue($headers, $header);
}
$stringToSign[] = $canonicalizedResource;
$stringToSign = implode("\n", $stringToSign);
return $stringToSign;
} | php | protected function computeSignature($headers, $url, $queryParams, $httpMethod)
{
$canonicalizedResource = parent::computeCanonicalizedResourceForTable(
$url, $queryParams
);
$stringToSign = [];
foreach ($this->includedHeaders as $header) {
$stringToSign[] = Utilities::tryGetValue($headers, $header);
}
$stringToSign[] = $canonicalizedResource;
$stringToSign = implode("\n", $stringToSign);
return $stringToSign;
} | [
"protected",
"function",
"computeSignature",
"(",
"$",
"headers",
",",
"$",
"url",
",",
"$",
"queryParams",
",",
"$",
"httpMethod",
")",
"{",
"$",
"canonicalizedResource",
"=",
"parent",
"::",
"computeCanonicalizedResourceForTable",
"(",
"$",
"url",
",",
"$",
... | Computes the authorization signature for blob and queue shared key.
@param array $headers request headers
@param string $url request URL
@param array $queryParams query variables
@param string $httpMethod request http method
@see Blob and Queue Services (Shared Key Authentication) at
http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx
@return string | [
"Computes",
"the",
"authorization",
"signature",
"for",
"blob",
"and",
"queue",
"shared",
"key",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Authentication/TableSharedKeyLiteAuthScheme.php#L76-L92 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/ListRulesResult.php | ListRulesResult.parseXml | public function parseXml($response)
{
parent::parseXml($response);
$listRulesResultXml = new \SimpleXMLElement($response);
$this->_ruleInfos = [];
foreach ($listRulesResultXml->entry as $entry) {
$ruleInfo = new RuleInfo();
$ruleInfo->parseXml($entry->asXML());
$this->_ruleInfos[] = $ruleInfo;
}
} | php | public function parseXml($response)
{
parent::parseXml($response);
$listRulesResultXml = new \SimpleXMLElement($response);
$this->_ruleInfos = [];
foreach ($listRulesResultXml->entry as $entry) {
$ruleInfo = new RuleInfo();
$ruleInfo->parseXml($entry->asXML());
$this->_ruleInfos[] = $ruleInfo;
}
} | [
"public",
"function",
"parseXml",
"(",
"$",
"response",
")",
"{",
"parent",
"::",
"parseXml",
"(",
"$",
"response",
")",
";",
"$",
"listRulesResultXml",
"=",
"new",
"\\",
"SimpleXMLElement",
"(",
"$",
"response",
")",
";",
"$",
"this",
"->",
"_ruleInfos",
... | Populates the properties with the response from the list rules request.
@param string $response The body of the response of the list rules request | [
"Populates",
"the",
"properties",
"with",
"the",
"response",
"from",
"the",
"list",
"rules",
"request",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/ListRulesResult.php#L57-L68 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/Task.php | Task.createFromOptions | public static function createFromOptions(array $options)
{
Validate::notNull($options['TaskBody'], 'options[TaskBody]');
Validate::notNull($options['Options'], 'options[Options]');
Validate::notNull($options['MediaProcessorId'], 'options[MediaProcessorId]');
$task = new self(
$options['TaskBody'],
$options['MediaProcessorId'],
$options['Options']
);
$task->fromArray($options);
return $task;
} | php | public static function createFromOptions(array $options)
{
Validate::notNull($options['TaskBody'], 'options[TaskBody]');
Validate::notNull($options['Options'], 'options[Options]');
Validate::notNull($options['MediaProcessorId'], 'options[MediaProcessorId]');
$task = new self(
$options['TaskBody'],
$options['MediaProcessorId'],
$options['Options']
);
$task->fromArray($options);
return $task;
} | [
"public",
"static",
"function",
"createFromOptions",
"(",
"array",
"$",
"options",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"[",
"'TaskBody'",
"]",
",",
"'options[TaskBody]'",
")",
";",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"["... | Create task from array.
@param array $options Array containing values for object properties
@return Task | [
"Create",
"task",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/Task.php#L213-L227 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/QueueDescription.php | QueueDescription.create | public static function create($queueDescriptionXml)
{
$queueDescription = new self();
$root = simplexml_load_string(
$queueDescriptionXml
);
$queueDescriptionArray = (array) $root;
if (array_key_exists('LockDuration', $queueDescriptionArray)) {
$queueDescription->setLockDuration(
(string) $queueDescriptionArray['LockDuration']
);
}
if (array_key_exists('MaxSizeInMegabytes', $queueDescriptionArray)) {
$queueDescription->setMaxSizeInMegabytes(
(int) $queueDescriptionArray['MaxSizeInMegabytes']
);
}
if (array_key_exists(
'RequiresDuplicateDetection',
$queueDescriptionArray
)
) {
$queueDescription->setRequiresDuplicateDetection(
(bool) $queueDescriptionArray['RequiresDuplicateDetection']
);
}
if (array_key_exists('RequiresSession', $queueDescriptionArray)) {
$queueDescription->setRequiresSession(
(bool) $queueDescriptionArray['RequiresSession']
);
}
if (array_key_exists(
'DefaultMessageTimeToLive',
$queueDescriptionArray
)
) {
$queueDescription->setDefaultMessageTimeToLive(
(string) $queueDescriptionArray['DefaultMessageTimeToLive']
);
}
if (array_key_exists(
'DeadLetteringOnMessageExpiration',
$queueDescriptionArray
)
) {
$queueDescription->setDeadLetteringOnMessageExpiration(
(string) $queueDescriptionArray['DeadLetteringOnMessageExpiration']
);
}
if (array_key_exists(
'DuplicateDetectionHistoryTimeWindow',
$queueDescriptionArray
)
) {
$queueDescription->setDuplicateDetectionHistoryTimeWindow(
(string) $queueDescriptionArray['DuplicateDetectionHistoryTimeWindow']
);
}
if (array_key_exists('MaxDeliveryCount', $queueDescriptionArray)) {
$queueDescription->setMaxDeliveryCount(
(int) $queueDescriptionArray['MaxDeliveryCount']
);
}
if (array_key_exists('EnableBatchedOperations', $queueDescriptionArray)) {
$queueDescription->setEnableBatchedOperations(
(bool) $queueDescriptionArray['EnableBatchedOperations']
);
}
if (array_key_exists('SizeInBytes', $queueDescriptionArray)) {
$queueDescription->setSizeInBytes(
(int) $queueDescriptionArray['SizeInBytes']
);
}
if (array_key_exists('MessageCount', $queueDescriptionArray)) {
$queueDescription->setMessageCount(
(int) $queueDescriptionArray['MessageCount']
);
}
return $queueDescription;
} | php | public static function create($queueDescriptionXml)
{
$queueDescription = new self();
$root = simplexml_load_string(
$queueDescriptionXml
);
$queueDescriptionArray = (array) $root;
if (array_key_exists('LockDuration', $queueDescriptionArray)) {
$queueDescription->setLockDuration(
(string) $queueDescriptionArray['LockDuration']
);
}
if (array_key_exists('MaxSizeInMegabytes', $queueDescriptionArray)) {
$queueDescription->setMaxSizeInMegabytes(
(int) $queueDescriptionArray['MaxSizeInMegabytes']
);
}
if (array_key_exists(
'RequiresDuplicateDetection',
$queueDescriptionArray
)
) {
$queueDescription->setRequiresDuplicateDetection(
(bool) $queueDescriptionArray['RequiresDuplicateDetection']
);
}
if (array_key_exists('RequiresSession', $queueDescriptionArray)) {
$queueDescription->setRequiresSession(
(bool) $queueDescriptionArray['RequiresSession']
);
}
if (array_key_exists(
'DefaultMessageTimeToLive',
$queueDescriptionArray
)
) {
$queueDescription->setDefaultMessageTimeToLive(
(string) $queueDescriptionArray['DefaultMessageTimeToLive']
);
}
if (array_key_exists(
'DeadLetteringOnMessageExpiration',
$queueDescriptionArray
)
) {
$queueDescription->setDeadLetteringOnMessageExpiration(
(string) $queueDescriptionArray['DeadLetteringOnMessageExpiration']
);
}
if (array_key_exists(
'DuplicateDetectionHistoryTimeWindow',
$queueDescriptionArray
)
) {
$queueDescription->setDuplicateDetectionHistoryTimeWindow(
(string) $queueDescriptionArray['DuplicateDetectionHistoryTimeWindow']
);
}
if (array_key_exists('MaxDeliveryCount', $queueDescriptionArray)) {
$queueDescription->setMaxDeliveryCount(
(int) $queueDescriptionArray['MaxDeliveryCount']
);
}
if (array_key_exists('EnableBatchedOperations', $queueDescriptionArray)) {
$queueDescription->setEnableBatchedOperations(
(bool) $queueDescriptionArray['EnableBatchedOperations']
);
}
if (array_key_exists('SizeInBytes', $queueDescriptionArray)) {
$queueDescription->setSizeInBytes(
(int) $queueDescriptionArray['SizeInBytes']
);
}
if (array_key_exists('MessageCount', $queueDescriptionArray)) {
$queueDescription->setMessageCount(
(int) $queueDescriptionArray['MessageCount']
);
}
return $queueDescription;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"queueDescriptionXml",
")",
"{",
"$",
"queueDescription",
"=",
"new",
"self",
"(",
")",
";",
"$",
"root",
"=",
"simplexml_load_string",
"(",
"$",
"queueDescriptionXml",
")",
";",
"$",
"queueDescriptionArray",
... | Creates a queue description object with specified XML string.
@param string $queueDescriptionXml A XML based string describing
the queue
@return QueueDescription | [
"Creates",
"a",
"queue",
"description",
"object",
"with",
"specified",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/QueueDescription.php#L130-L220 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/TopicInfo.php | TopicInfo.parseXml | public function parseXml($xmlString)
{
$this->_entry->parseXml($xmlString);
$content = $this->_entry->getContent();
if (is_null($content)) {
$this->_topicDescription = null;
} else {
$this->_topicDescription = TopicDescription::create($content->getText());
}
} | php | public function parseXml($xmlString)
{
$this->_entry->parseXml($xmlString);
$content = $this->_entry->getContent();
if (is_null($content)) {
$this->_topicDescription = null;
} else {
$this->_topicDescription = TopicDescription::create($content->getText());
}
} | [
"public",
"function",
"parseXml",
"(",
"$",
"xmlString",
")",
"{",
"$",
"this",
"->",
"_entry",
"->",
"parseXml",
"(",
"$",
"xmlString",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"_entry",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"is_nul... | Populates properties with a specified XML string.
@param string $xmlString An XML string representing the topic information | [
"Populates",
"properties",
"with",
"a",
"specified",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/TopicInfo.php#L93-L102 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/TopicInfo.php | TopicInfo.writeXml | public function writeXml(\XMLWriter $xmlWriter)
{
$content = null;
if (!is_null($this->_topicDescription)) {
$content = new Content();
$content->setText(
XmlSerializer::objectSerialize(
$this->_topicDescription,
'TopicDescription'
)
);
$content->setType(Resources::XML_CONTENT_TYPE);
}
$this->_entry->setContent($content);
$this->_entry->writeXml($xmlWriter);
} | php | public function writeXml(\XMLWriter $xmlWriter)
{
$content = null;
if (!is_null($this->_topicDescription)) {
$content = new Content();
$content->setText(
XmlSerializer::objectSerialize(
$this->_topicDescription,
'TopicDescription'
)
);
$content->setType(Resources::XML_CONTENT_TYPE);
}
$this->_entry->setContent($content);
$this->_entry->writeXml($xmlWriter);
} | [
"public",
"function",
"writeXml",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
")",
"{",
"$",
"content",
"=",
"null",
";",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_topicDescription",
")",
")",
"{",
"$",
"content",
"=",
"new",
"Content",
"(",
... | Writes an XML string.
@param \XMLWriter $xmlWriter The XML writer | [
"Writes",
"an",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/TopicInfo.php#L109-L124 | train |
Azure/azure-sdk-for-php | src/Common/Internal/ServiceSettings.php | ServiceSettings.getValidator | protected static function getValidator($requirements, $isRequired, $atLeastOne)
{
// @codingStandardsIgnoreStart
return function ($userSettings) use ($requirements, $isRequired, $atLeastOne) {
$oneFound = false;
$result = array_change_key_case($userSettings);
foreach ($requirements as $requirement) {
$settingName = strtolower($requirement[Resources::SETTING_NAME]);
// Check if the setting name exists in the provided user settings.
if (array_key_exists($settingName, $result)) {
// Check if the provided user setting value is valid.
$validationFunc = $requirement[Resources::SETTING_CONSTRAINT];
$isValid = $validationFunc($result[$settingName]);
if ($isValid) {
// Remove the setting as indicator for successful validation.
unset($result[$settingName]);
$oneFound = true;
}
} else {
// If required then fail because the setting does not exist
if ($isRequired) {
return null;
}
}
}
if ($atLeastOne) {
// At least one requirement must succeed, otherwise fail.
return $oneFound ? $result : null;
} else {
return $result;
}
};
// @codingStandardsIgnoreEnd
} | php | protected static function getValidator($requirements, $isRequired, $atLeastOne)
{
// @codingStandardsIgnoreStart
return function ($userSettings) use ($requirements, $isRequired, $atLeastOne) {
$oneFound = false;
$result = array_change_key_case($userSettings);
foreach ($requirements as $requirement) {
$settingName = strtolower($requirement[Resources::SETTING_NAME]);
// Check if the setting name exists in the provided user settings.
if (array_key_exists($settingName, $result)) {
// Check if the provided user setting value is valid.
$validationFunc = $requirement[Resources::SETTING_CONSTRAINT];
$isValid = $validationFunc($result[$settingName]);
if ($isValid) {
// Remove the setting as indicator for successful validation.
unset($result[$settingName]);
$oneFound = true;
}
} else {
// If required then fail because the setting does not exist
if ($isRequired) {
return null;
}
}
}
if ($atLeastOne) {
// At least one requirement must succeed, otherwise fail.
return $oneFound ? $result : null;
} else {
return $result;
}
};
// @codingStandardsIgnoreEnd
} | [
"protected",
"static",
"function",
"getValidator",
"(",
"$",
"requirements",
",",
"$",
"isRequired",
",",
"$",
"atLeastOne",
")",
"{",
"// @codingStandardsIgnoreStart",
"return",
"function",
"(",
"$",
"userSettings",
")",
"use",
"(",
"$",
"requirements",
",",
"$... | Creates an anonymous function that acts as predicate.
@param array $requirements The array of conditions to satisfy
@param bool $isRequired Either these conditions are all required or all
optional
@param bool $atLeastOne Indicates that at least one requirement must
succeed
@return callable | [
"Creates",
"an",
"anonymous",
"function",
"that",
"acts",
"as",
"predicate",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/ServiceSettings.php#L117-L155 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Internal/Filter.php | Filter.create | public static function create($filterXmlString)
{
$filterXml = simplexml_load_string($filterXmlString);
$attributes = (array) $filterXml->attributes();
if (array_key_exists('i:type', $attributes)) {
$type = (string) $attributes['i:type'];
if ($type === 'TrueFilter') {
return new TrueFilter();
}
if ($type === 'FalseFilter') {
return new FalseFilter();
}
return new self();
}
return null;
} | php | public static function create($filterXmlString)
{
$filterXml = simplexml_load_string($filterXmlString);
$attributes = (array) $filterXml->attributes();
if (array_key_exists('i:type', $attributes)) {
$type = (string) $attributes['i:type'];
if ($type === 'TrueFilter') {
return new TrueFilter();
}
if ($type === 'FalseFilter') {
return new FalseFilter();
}
return new self();
}
return null;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"filterXmlString",
")",
"{",
"$",
"filterXml",
"=",
"simplexml_load_string",
"(",
"$",
"filterXmlString",
")",
";",
"$",
"attributes",
"=",
"(",
"array",
")",
"$",
"filterXml",
"->",
"attributes",
"(",
")",... | Creates a Filter with specified XML based string.
@param string $filterXmlString An XML based filter string
@return Filter|null | [
"Creates",
"a",
"Filter",
"with",
"specified",
"XML",
"based",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Internal/Filter.php#L69-L88 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/DeploymentSlot.php | DeploymentSlot.isValid | public static function isValid($slot)
{
switch (strtolower($slot)) {
case self::STAGING:
case self::PRODUCTION:
return true;
default:
return false;
}
} | php | public static function isValid($slot)
{
switch (strtolower($slot)) {
case self::STAGING:
case self::PRODUCTION:
return true;
default:
return false;
}
} | [
"public",
"static",
"function",
"isValid",
"(",
"$",
"slot",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"slot",
")",
")",
"{",
"case",
"self",
"::",
"STAGING",
":",
"case",
"self",
"::",
"PRODUCTION",
":",
"return",
"true",
";",
"default",
":",
... | Validates the provided slot name.
@param string $slot The deployment slot name
@return bool | [
"Validates",
"the",
"provided",
"slot",
"name",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/DeploymentSlot.php#L53-L63 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Serialization/XmlSerializer.php | XmlSerializer._sxml2arr | private function _sxml2arr($sXml, $arr = null)
{
foreach ((array) $sXml as $key => $value) {
if (is_object($value) || (is_array($value))) {
$arr[$key] = $this->_sxml2arr($value);
} else {
$arr[$key] = $value;
}
}
return $arr;
} | php | private function _sxml2arr($sXml, $arr = null)
{
foreach ((array) $sXml as $key => $value) {
if (is_object($value) || (is_array($value))) {
$arr[$key] = $this->_sxml2arr($value);
} else {
$arr[$key] = $value;
}
}
return $arr;
} | [
"private",
"function",
"_sxml2arr",
"(",
"$",
"sXml",
",",
"$",
"arr",
"=",
"null",
")",
"{",
"foreach",
"(",
"(",
"array",
")",
"$",
"sXml",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"value",
")",
"||",
... | Converts a SimpleXML object to an Array recursively
ensuring all sub-elements are arrays as well.
@param string $sXml The SimpleXML object
@param array $arr The array into which to store results
@return array | [
"Converts",
"a",
"SimpleXML",
"object",
"to",
"an",
"Array",
"recursively",
"ensuring",
"all",
"sub",
"-",
"elements",
"are",
"arrays",
"as",
"well",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Serialization/XmlSerializer.php#L61-L72 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Serialization/XmlSerializer.php | XmlSerializer._arr2xml | private function _arr2xml(XMLWriter $xmlW, array $data, $defaultTag = null)
{
foreach ($data as $key => $value) {
if ($key === Resources::XTAG_ATTRIBUTES) {
foreach ($value as $attributeName => $attributeValue) {
$xmlW->writeAttribute($attributeName, $attributeValue);
}
} elseif (is_array($value)) {
if (!is_int($key)) {
if ($key != Resources::EMPTY_STRING) {
$xmlW->startElement($key);
} else {
$xmlW->startElement($defaultTag);
}
}
$this->_arr2xml($xmlW, $value);
if (!is_int($key)) {
$xmlW->endElement();
}
} else {
$xmlW->writeElement($key, $value);
}
}
} | php | private function _arr2xml(XMLWriter $xmlW, array $data, $defaultTag = null)
{
foreach ($data as $key => $value) {
if ($key === Resources::XTAG_ATTRIBUTES) {
foreach ($value as $attributeName => $attributeValue) {
$xmlW->writeAttribute($attributeName, $attributeValue);
}
} elseif (is_array($value)) {
if (!is_int($key)) {
if ($key != Resources::EMPTY_STRING) {
$xmlW->startElement($key);
} else {
$xmlW->startElement($defaultTag);
}
}
$this->_arr2xml($xmlW, $value);
if (!is_int($key)) {
$xmlW->endElement();
}
} else {
$xmlW->writeElement($key, $value);
}
}
} | [
"private",
"function",
"_arr2xml",
"(",
"XMLWriter",
"$",
"xmlW",
",",
"array",
"$",
"data",
",",
"$",
"defaultTag",
"=",
"null",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"key",
"===",
... | Takes an array and produces XML based on it.
@param XMLWriter $xmlW XMLWriter object that was previously instanted
and is used for creating the XML
@param array $data Array to be converted to XML
@param string $defaultTag Default XML tag to be used if none specified | [
"Takes",
"an",
"array",
"and",
"produces",
"XML",
"based",
"on",
"it",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Serialization/XmlSerializer.php#L82-L107 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlGoalStateDeserializer.php | XmlGoalStateDeserializer.deserialize | public function deserialize($document)
{
$goalStateInfo = Utilities::unserialize($document);
return new GoalState(
$goalStateInfo['Incarnation'],
$goalStateInfo['ExpectedState'],
$goalStateInfo['RoleEnvironmentPath'],
new \DateTime($goalStateInfo['Deadline']),
$goalStateInfo['CurrentStateEndpoint']
);
} | php | public function deserialize($document)
{
$goalStateInfo = Utilities::unserialize($document);
return new GoalState(
$goalStateInfo['Incarnation'],
$goalStateInfo['ExpectedState'],
$goalStateInfo['RoleEnvironmentPath'],
new \DateTime($goalStateInfo['Deadline']),
$goalStateInfo['CurrentStateEndpoint']
);
} | [
"public",
"function",
"deserialize",
"(",
"$",
"document",
")",
"{",
"$",
"goalStateInfo",
"=",
"Utilities",
"::",
"unserialize",
"(",
"$",
"document",
")",
";",
"return",
"new",
"GoalState",
"(",
"$",
"goalStateInfo",
"[",
"'Incarnation'",
"]",
",",
"$",
... | Deserializes a goal state.
@param string $document The goal state document
@return GoalState | [
"Deserializes",
"a",
"goal",
"state",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlGoalStateDeserializer.php#L52-L63 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/CrossSiteAccessPolicies.php | CrossSiteAccessPolicies.fromArray | public function fromArray($options)
{
if (isset($options['ClientAccessPolicy'])) {
Validate::isString($options['ClientAccessPolicy'], 'options[ClientAccessPolicy]');
$this->_clientAccessPolicy = $options['ClientAccessPolicy'];
}
if (isset($options['CrossDomainPolicy'])) {
Validate::isString($options['CrossDomainPolicy'], 'options[CrossDomainPolicy]');
$this->_crossDomainPolicy = $options['CrossDomainPolicy'];
}
} | php | public function fromArray($options)
{
if (isset($options['ClientAccessPolicy'])) {
Validate::isString($options['ClientAccessPolicy'], 'options[ClientAccessPolicy]');
$this->_clientAccessPolicy = $options['ClientAccessPolicy'];
}
if (isset($options['CrossDomainPolicy'])) {
Validate::isString($options['CrossDomainPolicy'], 'options[CrossDomainPolicy]');
$this->_crossDomainPolicy = $options['CrossDomainPolicy'];
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'ClientAccessPolicy'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'ClientAccessPolicy'",
"]",
",",
"'options[... | Fill CrossSiteAccessPolicies from array.
@param array $options Array containing values for object properties | [
"Fill",
"CrossSiteAccessPolicies",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/CrossSiteAccessPolicies.php#L86-L97 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ChannelOutputHls.php | ChannelOutputHls.fromArray | public function fromArray($options)
{
if (isset($options['FragmentsPerSegment'])) {
Validate::isInteger($options['FragmentsPerSegment'], 'options[FragmentsPerSegment]');
$this->_fragmentsPerSegment = (int) $options['FragmentsPerSegment'];
}
} | php | public function fromArray($options)
{
if (isset($options['FragmentsPerSegment'])) {
Validate::isInteger($options['FragmentsPerSegment'], 'options[FragmentsPerSegment]');
$this->_fragmentsPerSegment = (int) $options['FragmentsPerSegment'];
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'FragmentsPerSegment'",
"]",
")",
")",
"{",
"Validate",
"::",
"isInteger",
"(",
"$",
"options",
"[",
"'FragmentsPerSegment'",
"]",
",",
"'optio... | Fill ChannelOutputHls from array.
@param array $options Array containing values for object properties | [
"Fill",
"ChannelOutputHls",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ChannelOutputHls.php#L79-L85 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/Deployment.php | Deployment.create | public static function create($parsed)
{
$result = new self();
$name = Utilities::tryGetValue($parsed, Resources::XTAG_NAME);
$label = Utilities::tryGetValue($parsed, Resources::XTAG_LABEL);
$url = Utilities::tryGetValue($parsed, Resources::XTAG_URL);
$locked = Utilities::tryGetValue(
$parsed,
Resources::XTAG_LOCKED
);
$rollbackAllowed = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ROLLBACK_ALLOWED
);
$sdkVersion = Utilities::tryGetValue(
$parsed,
Resources::XTAG_SDK_VERSION
);
$inputEndpointList = Utilities::tryGetKeysChainValue(
$parsed,
Resources::XTAG_INPUT_ENDPOINT_LIST,
Resources::XTAG_INPUT_ENDPOINT
);
$roleList = Utilities::tryGetKeysChainValue(
$parsed,
Resources::XTAG_ROLE_LIST,
Resources::XTAG_ROLE
);
$roleInstanceList = Utilities::tryGetKeysChainValue(
$parsed,
Resources::XTAG_ROLE_INSTANCE_LIST,
Resources::XTAG_ROLE_INSTANCE
);
$status = Utilities::tryGetValue(
$parsed,
Resources::XTAG_STATUS
);
$slot = Utilities::tryGetValue(
$parsed,
Resources::XTAG_DEPLOYMENT_SLOT
);
$privateId = Utilities::tryGetValue(
$parsed,
Resources::XTAG_PRIVATE_ID
);
$configuration = Utilities::tryGetValue(
$parsed,
Resources::XTAG_CONFIGURATION
);
$upgradeDomainCount = Utilities::tryGetValue(
$parsed,
Resources::XTAG_UPGRADE_DOMAIN_COUNT
);
$upgradeStatus = Utilities::tryGetValue(
$parsed,
Resources::XTAG_UPGRADE_STATUS
);
$result->setConfiguration($configuration);
$result->setLabel($label);
$result->setLocked(Utilities::toBoolean($locked));
$result->setName($name);
$result->setPrivateId($privateId);
$result->setRollbackAllowed(Utilities::toBoolean($rollbackAllowed));
$result->setSdkVersion($sdkVersion);
$result->setSlot($slot);
$result->setStatus($status);
$result->setUpgradeDomainCount(intval($upgradeDomainCount));
$result->setUpgradeStatus(UpgradeStatus::create($upgradeStatus));
$result->setUrl($url);
$result->setRoleInstanceList(
Utilities::createInstanceList(
Utilities::getArray($roleInstanceList),
'WindowsAzure\ServiceManagement\Models\RoleInstance'
)
);
$result->setRoleList(
Utilities::createInstanceList(
Utilities::getArray($roleList),
'WindowsAzure\ServiceManagement\Models\Role'
)
);
$result->setInputEndpointList(
Utilities::createInstanceList(
Utilities::getArray($inputEndpointList),
'WindowsAzure\ServiceManagement\Models\InputEndpoint'
)
);
return $result;
} | php | public static function create($parsed)
{
$result = new self();
$name = Utilities::tryGetValue($parsed, Resources::XTAG_NAME);
$label = Utilities::tryGetValue($parsed, Resources::XTAG_LABEL);
$url = Utilities::tryGetValue($parsed, Resources::XTAG_URL);
$locked = Utilities::tryGetValue(
$parsed,
Resources::XTAG_LOCKED
);
$rollbackAllowed = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ROLLBACK_ALLOWED
);
$sdkVersion = Utilities::tryGetValue(
$parsed,
Resources::XTAG_SDK_VERSION
);
$inputEndpointList = Utilities::tryGetKeysChainValue(
$parsed,
Resources::XTAG_INPUT_ENDPOINT_LIST,
Resources::XTAG_INPUT_ENDPOINT
);
$roleList = Utilities::tryGetKeysChainValue(
$parsed,
Resources::XTAG_ROLE_LIST,
Resources::XTAG_ROLE
);
$roleInstanceList = Utilities::tryGetKeysChainValue(
$parsed,
Resources::XTAG_ROLE_INSTANCE_LIST,
Resources::XTAG_ROLE_INSTANCE
);
$status = Utilities::tryGetValue(
$parsed,
Resources::XTAG_STATUS
);
$slot = Utilities::tryGetValue(
$parsed,
Resources::XTAG_DEPLOYMENT_SLOT
);
$privateId = Utilities::tryGetValue(
$parsed,
Resources::XTAG_PRIVATE_ID
);
$configuration = Utilities::tryGetValue(
$parsed,
Resources::XTAG_CONFIGURATION
);
$upgradeDomainCount = Utilities::tryGetValue(
$parsed,
Resources::XTAG_UPGRADE_DOMAIN_COUNT
);
$upgradeStatus = Utilities::tryGetValue(
$parsed,
Resources::XTAG_UPGRADE_STATUS
);
$result->setConfiguration($configuration);
$result->setLabel($label);
$result->setLocked(Utilities::toBoolean($locked));
$result->setName($name);
$result->setPrivateId($privateId);
$result->setRollbackAllowed(Utilities::toBoolean($rollbackAllowed));
$result->setSdkVersion($sdkVersion);
$result->setSlot($slot);
$result->setStatus($status);
$result->setUpgradeDomainCount(intval($upgradeDomainCount));
$result->setUpgradeStatus(UpgradeStatus::create($upgradeStatus));
$result->setUrl($url);
$result->setRoleInstanceList(
Utilities::createInstanceList(
Utilities::getArray($roleInstanceList),
'WindowsAzure\ServiceManagement\Models\RoleInstance'
)
);
$result->setRoleList(
Utilities::createInstanceList(
Utilities::getArray($roleList),
'WindowsAzure\ServiceManagement\Models\Role'
)
);
$result->setInputEndpointList(
Utilities::createInstanceList(
Utilities::getArray($inputEndpointList),
'WindowsAzure\ServiceManagement\Models\InputEndpoint'
)
);
return $result;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"result",
"=",
"new",
"self",
"(",
")",
";",
"$",
"name",
"=",
"Utilities",
"::",
"tryGetValue",
"(",
"$",
"parsed",
",",
"Resources",
"::",
"XTAG_NAME",
")",
";",
"$",
"lab... | Creates a new Deployment from parsed response body.
@param array $parsed The parsed response body in array representation
@return Deployment | [
"Creates",
"a",
"new",
"Deployment",
"from",
"parsed",
"response",
"body",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/Deployment.php#L128-L218 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/Generator.php | Generator.parseXml | public function parseXml($xmlString)
{
$generatorXml = new \SimpleXMLElement($xmlString);
$attributes = $generatorXml->attributes();
if (!empty($attributes['uri'])) {
$this->uri = (string) $attributes['uri'];
}
if (!empty($attributes['version'])) {
$this->version = (string) $attributes['version'];
}
$this->text = (string) $generatorXml;
} | php | public function parseXml($xmlString)
{
$generatorXml = new \SimpleXMLElement($xmlString);
$attributes = $generatorXml->attributes();
if (!empty($attributes['uri'])) {
$this->uri = (string) $attributes['uri'];
}
if (!empty($attributes['version'])) {
$this->version = (string) $attributes['version'];
}
$this->text = (string) $generatorXml;
} | [
"public",
"function",
"parseXml",
"(",
"$",
"xmlString",
")",
"{",
"$",
"generatorXml",
"=",
"new",
"\\",
"SimpleXMLElement",
"(",
"$",
"xmlString",
")",
";",
"$",
"attributes",
"=",
"$",
"generatorXml",
"->",
"attributes",
"(",
")",
";",
"if",
"(",
"!",... | Creates a generator instance with specified XML string.
@param string $xmlString A string representing a generator
instance | [
"Creates",
"a",
"generator",
"instance",
"with",
"specified",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/Generator.php#L72-L85 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/Generator.php | Generator.writeXml | public function writeXml($xmlWriter)
{
$xmlWriter->startElementNS(
'atom',
Resources::CATEGORY,
Resources::ATOM_NAMESPACE
);
$this->writeOptionalAttribute(
$xmlWriter,
'uri',
$this->uri
);
$this->writeOptionalAttribute(
$xmlWriter,
'version',
$this->version
);
$xmlWriter->writeRaw($this->text);
$xmlWriter->endElement();
} | php | public function writeXml($xmlWriter)
{
$xmlWriter->startElementNS(
'atom',
Resources::CATEGORY,
Resources::ATOM_NAMESPACE
);
$this->writeOptionalAttribute(
$xmlWriter,
'uri',
$this->uri
);
$this->writeOptionalAttribute(
$xmlWriter,
'version',
$this->version
);
$xmlWriter->writeRaw($this->text);
$xmlWriter->endElement();
} | [
"public",
"function",
"writeXml",
"(",
"$",
"xmlWriter",
")",
"{",
"$",
"xmlWriter",
"->",
"startElementNS",
"(",
"'atom'",
",",
"Resources",
"::",
"CATEGORY",
",",
"Resources",
"::",
"ATOM_NAMESPACE",
")",
";",
"$",
"this",
"->",
"writeOptionalAttribute",
"("... | Writes an XML representing the generator.
@param \XMLWriter $xmlWriter The XML writer | [
"Writes",
"an",
"XML",
"representing",
"the",
"generator",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/Generator.php#L164-L186 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ChannelOutput.php | ChannelOutput.fromArray | public function fromArray($options)
{
if (isset($options['Hls'])) {
Validate::isArray($options['Hls'], 'options[Hls]');
$this->_hls = ChannelOutputHls::createFromOptions($options['Hls']);
}
} | php | public function fromArray($options)
{
if (isset($options['Hls'])) {
Validate::isArray($options['Hls'], 'options[Hls]');
$this->_hls = ChannelOutputHls::createFromOptions($options['Hls']);
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Hls'",
"]",
")",
")",
"{",
"Validate",
"::",
"isArray",
"(",
"$",
"options",
"[",
"'Hls'",
"]",
",",
"'options[Hls]'",
")",
";",
"$",
... | Fill ChannelOutput from array.
@param array $options Array containing values for object properties | [
"Fill",
"ChannelOutput",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ChannelOutput.php#L79-L85 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/ListSubscriptionsResult.php | ListSubscriptionsResult.parseXml | public function parseXml($response)
{
parent::parseXml($response);
$listSubscriptionsResultXml = new \SimpleXMLElement($response);
$this->_subscriptionInfos = [];
foreach ($listSubscriptionsResultXml->entry as $entry) {
$subscriptionInfo = new SubscriptionInfo();
$subscriptionInfo->parseXml($entry->asXML());
$this->_subscriptionInfos[] = $subscriptionInfo;
}
} | php | public function parseXml($response)
{
parent::parseXml($response);
$listSubscriptionsResultXml = new \SimpleXMLElement($response);
$this->_subscriptionInfos = [];
foreach ($listSubscriptionsResultXml->entry as $entry) {
$subscriptionInfo = new SubscriptionInfo();
$subscriptionInfo->parseXml($entry->asXML());
$this->_subscriptionInfos[] = $subscriptionInfo;
}
} | [
"public",
"function",
"parseXml",
"(",
"$",
"response",
")",
"{",
"parent",
"::",
"parseXml",
"(",
"$",
"response",
")",
";",
"$",
"listSubscriptionsResultXml",
"=",
"new",
"\\",
"SimpleXMLElement",
"(",
"$",
"response",
")",
";",
"$",
"this",
"->",
"_subs... | Populates the properties with the response from the list
subscriptions request.
@param string $response The body of the response of the list
subscriptions request | [
"Populates",
"the",
"properties",
"with",
"the",
"response",
"from",
"the",
"list",
"subscriptions",
"request",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/ListSubscriptionsResult.php#L59-L69 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/IngestManifestAsset.php | IngestManifestAsset.createFromOptions | public static function createFromOptions(array $options)
{
Validate::notNull(
$options['ParentIngestManifestId'],
'options[ParentIngestManifestId]'
);
$asset = new self($options['ParentIngestManifestId']);
$asset->fromArray($options);
return $asset;
} | php | public static function createFromOptions(array $options)
{
Validate::notNull(
$options['ParentIngestManifestId'],
'options[ParentIngestManifestId]'
);
$asset = new self($options['ParentIngestManifestId']);
$asset->fromArray($options);
return $asset;
} | [
"public",
"static",
"function",
"createFromOptions",
"(",
"array",
"$",
"options",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"[",
"'ParentIngestManifestId'",
"]",
",",
"'options[ParentIngestManifestId]'",
")",
";",
"$",
"asset",
"=",
"new",
"se... | Create IngestManifestAsset from array.
@param array $options Array containing values for object properties
@return IngestManifestAsset | [
"Create",
"IngestManifestAsset",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/IngestManifestAsset.php#L80-L91 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/IngestManifestAsset.php | IngestManifestAsset.fromArray | public function fromArray(array $options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['Created'])) {
Validate::isDateString($options['Created'], 'options[Created]');
$this->_created = new \DateTime($options['Created']);
}
if (isset($options['LastModified'])) {
Validate::isDateString(
$options['LastModified'],
'options[LastModified]'
);
$this->_lastModified = new \DateTime($options['LastModified']);
}
if (isset($options['ParentIngestManifestId'])) {
Validate::isString(
$options['ParentIngestManifestId'],
'options[ParentIngestManifestId]'
);
$this->_parentIngestManifestId = $options['ParentIngestManifestId'];
}
} | php | public function fromArray(array $options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['Created'])) {
Validate::isDateString($options['Created'], 'options[Created]');
$this->_created = new \DateTime($options['Created']);
}
if (isset($options['LastModified'])) {
Validate::isDateString(
$options['LastModified'],
'options[LastModified]'
);
$this->_lastModified = new \DateTime($options['LastModified']);
}
if (isset($options['ParentIngestManifestId'])) {
Validate::isString(
$options['ParentIngestManifestId'],
'options[ParentIngestManifestId]'
);
$this->_parentIngestManifestId = $options['ParentIngestManifestId'];
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Id'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'Id'",
"]",
",",
"'options[Id]'",
")",
";",
... | Fill IngestManifestAsset from array.
@param array $options Array containing values for object properties | [
"Fill",
"IngestManifestAsset",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/IngestManifestAsset.php#L108-L135 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/Entry.php | Entry.fromXml | public function fromXml(\SimpleXMLElement $entryXml)
{
Validate::notNull($entryXml, 'entryXml');
$this->attributes = (array) $entryXml->attributes();
$entryArray = (array) $entryXml;
if (array_key_exists(Resources::AUTHOR, $entryArray)) {
$this->author = $this->processAuthorNode($entryArray);
}
if (array_key_exists(Resources::CATEGORY, $entryArray)) {
$this->category = $this->processCategoryNode($entryArray);
}
if (array_key_exists('content', $entryArray)) {
$content = new Content();
$content->fromXml($entryArray['content']);
$this->content = $content;
}
if (array_key_exists(Resources::CONTRIBUTOR, $entryArray)) {
$this->contributor = $this->processContributorNode($entryArray);
}
if (array_key_exists('id', $entryArray)) {
$this->id = (string) $entryArray['id'];
}
if (array_key_exists(Resources::LINK, $entryArray)) {
$this->link = $this->processLinkNode($entryArray);
}
if (array_key_exists('published', $entryArray)) {
$this->published = $entryArray['published'];
}
if (array_key_exists('rights', $entryArray)) {
$this->rights = $entryArray['rights'];
}
if (array_key_exists('source', $entryArray)) {
$source = new Source();
$source->parseXml($entryArray['source']->asXML());
$this->source = $source;
}
if (array_key_exists('title', $entryArray)) {
$this->title = $entryArray['title'];
}
if (array_key_exists('updated', $entryArray)) {
$this->updated = \DateTime::createFromFormat(
\DateTime::ATOM,
(string) $entryArray['updated']
);
}
} | php | public function fromXml(\SimpleXMLElement $entryXml)
{
Validate::notNull($entryXml, 'entryXml');
$this->attributes = (array) $entryXml->attributes();
$entryArray = (array) $entryXml;
if (array_key_exists(Resources::AUTHOR, $entryArray)) {
$this->author = $this->processAuthorNode($entryArray);
}
if (array_key_exists(Resources::CATEGORY, $entryArray)) {
$this->category = $this->processCategoryNode($entryArray);
}
if (array_key_exists('content', $entryArray)) {
$content = new Content();
$content->fromXml($entryArray['content']);
$this->content = $content;
}
if (array_key_exists(Resources::CONTRIBUTOR, $entryArray)) {
$this->contributor = $this->processContributorNode($entryArray);
}
if (array_key_exists('id', $entryArray)) {
$this->id = (string) $entryArray['id'];
}
if (array_key_exists(Resources::LINK, $entryArray)) {
$this->link = $this->processLinkNode($entryArray);
}
if (array_key_exists('published', $entryArray)) {
$this->published = $entryArray['published'];
}
if (array_key_exists('rights', $entryArray)) {
$this->rights = $entryArray['rights'];
}
if (array_key_exists('source', $entryArray)) {
$source = new Source();
$source->parseXml($entryArray['source']->asXML());
$this->source = $source;
}
if (array_key_exists('title', $entryArray)) {
$this->title = $entryArray['title'];
}
if (array_key_exists('updated', $entryArray)) {
$this->updated = \DateTime::createFromFormat(
\DateTime::ATOM,
(string) $entryArray['updated']
);
}
} | [
"public",
"function",
"fromXml",
"(",
"\\",
"SimpleXMLElement",
"$",
"entryXml",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"entryXml",
",",
"'entryXml'",
")",
";",
"$",
"this",
"->",
"attributes",
"=",
"(",
"array",
")",
"$",
"entryXml",
"->",
"at... | Creates an ATOM ENTRY instance with specified simpleXML object.
@param \SimpleXMLElement $entryXml xml element of ATOM ENTRY | [
"Creates",
"an",
"ATOM",
"ENTRY",
"instance",
"with",
"specified",
"simpleXML",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/Entry.php#L155-L212 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/GetHostedServicePropertiesResult.php | GetHostedServicePropertiesResult.create | public static function create($parsed)
{
$result = new self();
$properties = Utilities::tryGetValue(
$parsed,
Resources::XTAG_HOSTED_SERVICE_PROPERTIES
);
$result->_hostedService = new HostedService($parsed, $properties);
return $result;
} | php | public static function create($parsed)
{
$result = new self();
$properties = Utilities::tryGetValue(
$parsed,
Resources::XTAG_HOSTED_SERVICE_PROPERTIES
);
$result->_hostedService = new HostedService($parsed, $properties);
return $result;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"result",
"=",
"new",
"self",
"(",
")",
";",
"$",
"properties",
"=",
"Utilities",
"::",
"tryGetValue",
"(",
"$",
"parsed",
",",
"Resources",
"::",
"XTAG_HOSTED_SERVICE_PROPERTIES",
... | Creates GetHostedServicePropertiesResult from parsed response.
@param array $parsed The parsed response in array representation
@return GetHostedServicePropertiesResult | [
"Creates",
"GetHostedServicePropertiesResult",
"from",
"parsed",
"response",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/GetHostedServicePropertiesResult.php#L58-L68 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/EncodingReservedUnit.php | EncodingReservedUnit.fromArray | public function fromArray($options)
{
if (isset($options['AccountId'])) {
Validate::isString($options['AccountId'], 'options[AccountId]');
$this->_accountId = $options['AccountId'];
}
if (isset($options['ReservedUnitType'])) {
Validate::isInteger($options['ReservedUnitType'], 'options[ReservedUnitType]');
$this->_reservedUnitType = intval($options['ReservedUnitType']);
}
if (isset($options['MaxReservableUnits'])) {
Validate::isInteger($options['MaxReservableUnits'], 'options[MaxReservableUnits]');
$this->_maxReservableUnits = intval($options['MaxReservableUnits']);
}
if (isset($options['CurrentReservedUnits'])) {
Validate::isString($options['CurrentReservedUnits'], 'options[CurrentReservedUnits]');
$this->_currentReservedUnits = intval($options['CurrentReservedUnits']);
}
} | php | public function fromArray($options)
{
if (isset($options['AccountId'])) {
Validate::isString($options['AccountId'], 'options[AccountId]');
$this->_accountId = $options['AccountId'];
}
if (isset($options['ReservedUnitType'])) {
Validate::isInteger($options['ReservedUnitType'], 'options[ReservedUnitType]');
$this->_reservedUnitType = intval($options['ReservedUnitType']);
}
if (isset($options['MaxReservableUnits'])) {
Validate::isInteger($options['MaxReservableUnits'], 'options[MaxReservableUnits]');
$this->_maxReservableUnits = intval($options['MaxReservableUnits']);
}
if (isset($options['CurrentReservedUnits'])) {
Validate::isString($options['CurrentReservedUnits'], 'options[CurrentReservedUnits]');
$this->_currentReservedUnits = intval($options['CurrentReservedUnits']);
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'AccountId'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'AccountId'",
"]",
",",
"'options[AccountId]'",
")... | Fill EncodingReservedUnitType from array.
@param array $options Array containing values for object properties | [
"Fill",
"EncodingReservedUnitType",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/EncodingReservedUnit.php#L84-L105 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ContentKey.php | ContentKey.fromArray | public function fromArray(array $options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['Created'])) {
Validate::isDateString($options['Created'], 'options[Created]');
$this->_created = new \DateTime($options['Created']);
}
if (isset($options['LastModified'])) {
Validate::isDateString(
$options['LastModified'],
'options[LastModified]'
);
$this->_lastModified = new \DateTime($options['LastModified']);
}
if (isset($options['ContentKeyType'])) {
Validate::isInteger(
$options['ContentKeyType'],
'options[ContentKeyType]'
);
$this->_contentKeyType = $options['ContentKeyType'];
}
if (isset($options['EncryptedContentKey'])) {
Validate::isString(
$options['EncryptedContentKey'],
'options[EncryptedContentKey]'
);
$this->_encryptedContentKey = $options['EncryptedContentKey'];
}
if (isset($options['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['ProtectionKeyId'])) {
Validate::isString(
$options['ProtectionKeyId'],
'options[ProtectionKeyId]'
);
$this->_protectionKeyId = $options['ProtectionKeyId'];
}
if (isset($options['ProtectionKeyType'])) {
Validate::isInteger(
$options['ProtectionKeyType'],
'options[ProtectionKeyType]'
);
$this->_protectionKeyType = $options['ProtectionKeyType'];
}
if (isset($options['Checksum'])) {
Validate::isString($options['Checksum'], 'options[Checksum]');
$this->_checksum = $options['Checksum'];
}
if (isset($options['AuthorizationPolicyId'])) {
Validate::isString($options['AuthorizationPolicyId'], 'options[AuthorizationPolicyId]');
$this->_authorizationPolicyId = $options['AuthorizationPolicyId'];
}
} | php | public function fromArray(array $options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['Created'])) {
Validate::isDateString($options['Created'], 'options[Created]');
$this->_created = new \DateTime($options['Created']);
}
if (isset($options['LastModified'])) {
Validate::isDateString(
$options['LastModified'],
'options[LastModified]'
);
$this->_lastModified = new \DateTime($options['LastModified']);
}
if (isset($options['ContentKeyType'])) {
Validate::isInteger(
$options['ContentKeyType'],
'options[ContentKeyType]'
);
$this->_contentKeyType = $options['ContentKeyType'];
}
if (isset($options['EncryptedContentKey'])) {
Validate::isString(
$options['EncryptedContentKey'],
'options[EncryptedContentKey]'
);
$this->_encryptedContentKey = $options['EncryptedContentKey'];
}
if (isset($options['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['ProtectionKeyId'])) {
Validate::isString(
$options['ProtectionKeyId'],
'options[ProtectionKeyId]'
);
$this->_protectionKeyId = $options['ProtectionKeyId'];
}
if (isset($options['ProtectionKeyType'])) {
Validate::isInteger(
$options['ProtectionKeyType'],
'options[ProtectionKeyType]'
);
$this->_protectionKeyType = $options['ProtectionKeyType'];
}
if (isset($options['Checksum'])) {
Validate::isString($options['Checksum'], 'options[Checksum]');
$this->_checksum = $options['Checksum'];
}
if (isset($options['AuthorizationPolicyId'])) {
Validate::isString($options['AuthorizationPolicyId'], 'options[AuthorizationPolicyId]');
$this->_authorizationPolicyId = $options['AuthorizationPolicyId'];
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Id'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'Id'",
"]",
",",
"'options[Id]'",
")",
";",
... | Fill contentKey from array.
@param array $options Array containing values for object properties | [
"Fill",
"contentKey",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ContentKey.php#L144-L210 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ContentKey.php | ContentKey._generateEncryptedContentKey | private function _generateEncryptedContentKey($aesKey, $protectionKey)
{
$cert = openssl_x509_read($protectionKey);
$cryptedContentKey = '';
openssl_public_encrypt(
$aesKey,
$cryptedContentKey,
$cert,
OPENSSL_PKCS1_OAEP_PADDING
);
$this->_encryptedContentKey = base64_encode($cryptedContentKey);
} | php | private function _generateEncryptedContentKey($aesKey, $protectionKey)
{
$cert = openssl_x509_read($protectionKey);
$cryptedContentKey = '';
openssl_public_encrypt(
$aesKey,
$cryptedContentKey,
$cert,
OPENSSL_PKCS1_OAEP_PADDING
);
$this->_encryptedContentKey = base64_encode($cryptedContentKey);
} | [
"private",
"function",
"_generateEncryptedContentKey",
"(",
"$",
"aesKey",
",",
"$",
"protectionKey",
")",
"{",
"$",
"cert",
"=",
"openssl_x509_read",
"(",
"$",
"protectionKey",
")",
";",
"$",
"cryptedContentKey",
"=",
"''",
";",
"openssl_public_encrypt",
"(",
"... | Generate encryption content key. Encrypt aes key with protection key from WAMS.
@param string $aesKey Content key to encrypt
@param string $protectionKey Protection key (public key) from WAMS | [
"Generate",
"encryption",
"content",
"key",
".",
"Encrypt",
"aes",
"key",
"with",
"protection",
"key",
"from",
"WAMS",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ContentKey.php#L378-L391 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ContentKey.php | ContentKey._generateChecksum | private function _generateChecksum($aesKey, $usePadding = false)
{
if ($usePadding) {
$aesKey = $this->pkcs5_pad($aesKey, 16);
}
$encrypted = openssl_encrypt($this->_id, 'aes-256-ecb', $aesKey, OPENSSL_RAW_DATA);
$this->_checksum = base64_encode(substr($encrypted, 0, 8));
} | php | private function _generateChecksum($aesKey, $usePadding = false)
{
if ($usePadding) {
$aesKey = $this->pkcs5_pad($aesKey, 16);
}
$encrypted = openssl_encrypt($this->_id, 'aes-256-ecb', $aesKey, OPENSSL_RAW_DATA);
$this->_checksum = base64_encode(substr($encrypted, 0, 8));
} | [
"private",
"function",
"_generateChecksum",
"(",
"$",
"aesKey",
",",
"$",
"usePadding",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"usePadding",
")",
"{",
"$",
"aesKey",
"=",
"$",
"this",
"->",
"pkcs5_pad",
"(",
"$",
"aesKey",
",",
"16",
")",
";",
"}",
... | Generate checksum for content key.
@param string $aesKey Content key
@param bool $usePadding | [
"Generate",
"checksum",
"for",
"content",
"key",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ContentKey.php#L399-L408 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ContentKey.php | ContentKey.pkcs5_pad | private function pkcs5_pad($text, $blockSize)
{
$pad = $blockSize - (strlen($text) % $blockSize);
return $text.str_repeat(chr($pad), $pad);
} | php | private function pkcs5_pad($text, $blockSize)
{
$pad = $blockSize - (strlen($text) % $blockSize);
return $text.str_repeat(chr($pad), $pad);
} | [
"private",
"function",
"pkcs5_pad",
"(",
"$",
"text",
",",
"$",
"blockSize",
")",
"{",
"$",
"pad",
"=",
"$",
"blockSize",
"-",
"(",
"strlen",
"(",
"$",
"text",
")",
"%",
"$",
"blockSize",
")",
";",
"return",
"$",
"text",
".",
"str_repeat",
"(",
"ch... | checksum padding.
@param string $text
@param int $blockSize
@return string | [
"checksum",
"padding",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ContentKey.php#L418-L423 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ContentKey.php | ContentKey.setContentKey | public function setContentKey($value, $protectionKey, $usePadding = false)
{
$this->_generateEncryptedContentKey($value, $protectionKey);
$this->_generateChecksum($value, $usePadding);
} | php | public function setContentKey($value, $protectionKey, $usePadding = false)
{
$this->_generateEncryptedContentKey($value, $protectionKey);
$this->_generateChecksum($value, $usePadding);
} | [
"public",
"function",
"setContentKey",
"(",
"$",
"value",
",",
"$",
"protectionKey",
",",
"$",
"usePadding",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"_generateEncryptedContentKey",
"(",
"$",
"value",
",",
"$",
"protectionKey",
")",
";",
"$",
"this",
"->... | Set not encrypted content key. Automatically encrypted content key and
set checksum.
@param string $value Content key
@param string $protectionKey Protection key (public key) from WAMS
@param bool $usePadding Set to true to automatically use padding while is generating the checksum | [
"Set",
"not",
"encrypted",
"content",
"key",
".",
"Automatically",
"encrypted",
"content",
"key",
"and",
"set",
"checksum",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ContentKey.php#L433-L438 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/AssetDeliveryPolicy.php | AssetDeliveryPolicy.fromArray | public function fromArray($options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['AssetDeliveryProtocol'])) {
Validate::isInteger($options['AssetDeliveryProtocol'], 'options[AssetDeliveryProtocol]');
$this->_protocol = $options['AssetDeliveryProtocol'];
}
if (isset($options['AssetDeliveryPolicyType'])) {
Validate::isInteger($options['AssetDeliveryPolicyType'], 'options[AssetDeliveryPolicyType]');
$this->_policyType = $options['AssetDeliveryPolicyType'];
}
if (isset($options['AssetDeliveryConfiguration'])) {
Validate::isString($options['AssetDeliveryConfiguration'], 'options[AssetDeliveryConfiguration]');
$this->_configuration = $options['AssetDeliveryConfiguration'];
}
if (isset($options['Created'])) {
Validate::isDateString($options['Created'], 'options[Created]');
$this->_created = new \DateTime($options['Created']);
}
if (isset($options['LastModified'])) {
Validate::isDateString(
$options['LastModified'],
'options[LastModified]'
);
$this->_lastModified = new \DateTime($options['LastModified']);
}
} | php | public function fromArray($options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['AssetDeliveryProtocol'])) {
Validate::isInteger($options['AssetDeliveryProtocol'], 'options[AssetDeliveryProtocol]');
$this->_protocol = $options['AssetDeliveryProtocol'];
}
if (isset($options['AssetDeliveryPolicyType'])) {
Validate::isInteger($options['AssetDeliveryPolicyType'], 'options[AssetDeliveryPolicyType]');
$this->_policyType = $options['AssetDeliveryPolicyType'];
}
if (isset($options['AssetDeliveryConfiguration'])) {
Validate::isString($options['AssetDeliveryConfiguration'], 'options[AssetDeliveryConfiguration]');
$this->_configuration = $options['AssetDeliveryConfiguration'];
}
if (isset($options['Created'])) {
Validate::isDateString($options['Created'], 'options[Created]');
$this->_created = new \DateTime($options['Created']);
}
if (isset($options['LastModified'])) {
Validate::isDateString(
$options['LastModified'],
'options[LastModified]'
);
$this->_lastModified = new \DateTime($options['LastModified']);
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Id'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'Id'",
"]",
",",
"'options[Id]'",
")",
";",
"$",
"t... | Fill AssetDeliveryPolicy from array.
@param array $options Array containing values for object properties | [
"Fill",
"AssetDeliveryPolicy",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/AssetDeliveryPolicy.php#L121-L160 | train |
Azure/azure-sdk-for-php | src/MediaServices/Authentication/AzureAdClient.php | AzureAdClient.acquireTokenWithSymmetricKey | public function acquireTokenWithSymmetricKey($resource, $clientId, $clientSecret)
{
$method = Resources::HTTP_POST;
$headers = [];
$queryParams = [];
$postParameters = [];
$statusCode = Resources::STATUS_OK;
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_RESOURCE,
$resource
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_GRANT_TYPE,
'client_credentials'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_SCOPE,
'openid'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_SECRET,
$clientSecret
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ID,
$clientId
);
$response = $this->sendHttp(
$method,
$headers,
$queryParams,
$postParameters,
Resources::EMPTY_STRING,
$statusCode
);
$data = $this->dataSerializer->unserialize($response->getBody());
$accessToken = $data['access_token'];
$expirationTime = time() + intval($data['expires_in']);
return new AccessToken($accessToken, $expirationTime);
} | php | public function acquireTokenWithSymmetricKey($resource, $clientId, $clientSecret)
{
$method = Resources::HTTP_POST;
$headers = [];
$queryParams = [];
$postParameters = [];
$statusCode = Resources::STATUS_OK;
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_RESOURCE,
$resource
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_GRANT_TYPE,
'client_credentials'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_SCOPE,
'openid'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_SECRET,
$clientSecret
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ID,
$clientId
);
$response = $this->sendHttp(
$method,
$headers,
$queryParams,
$postParameters,
Resources::EMPTY_STRING,
$statusCode
);
$data = $this->dataSerializer->unserialize($response->getBody());
$accessToken = $data['access_token'];
$expirationTime = time() + intval($data['expires_in']);
return new AccessToken($accessToken, $expirationTime);
} | [
"public",
"function",
"acquireTokenWithSymmetricKey",
"(",
"$",
"resource",
",",
"$",
"clientId",
",",
"$",
"clientSecret",
")",
"{",
"$",
"method",
"=",
"Resources",
"::",
"HTTP_POST",
";",
"$",
"headers",
"=",
"[",
"]",
";",
"$",
"queryParams",
"=",
"[",... | Acquire an Azure AD access token given the Client ID and Client Secret
@param string $resource AzureAD resource asking for access to
@param string $clientId AzureAD client Id
@param string $clientSecret OAuth request client_secret field value
@return OAuthAccessToken | [
"Acquire",
"an",
"Azure",
"AD",
"access",
"token",
"given",
"the",
"Client",
"ID",
"and",
"Client",
"Secret"
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Authentication/AzureAdClient.php#L75-L127 | train |
Azure/azure-sdk-for-php | src/MediaServices/Authentication/AzureAdClient.php | AzureAdClient.acquireTokenWithAsymmetricKey | public function acquireTokenWithAsymmetricKey($resource, $credentials)
{
$method = Resources::HTTP_POST;
$headers = [];
$queryParams = [];
$postParameters = [];
$statusCode = Resources::STATUS_OK;
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ASSERTION_TYPE,
'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_RESOURCE,
$resource
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_GRANT_TYPE,
'client_credentials'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_SCOPE,
'openid'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ASSERTION,
$this->encodeCertificateAsJWT($credentials)
);
$response = $this->sendHttp(
$method,
$headers,
$queryParams,
$postParameters,
Resources::EMPTY_STRING,
$statusCode
);
$data = $this->dataSerializer->unserialize($response->getBody());
$accessToken = $data['access_token'];
$expirationTime = time() + intval($data['expires_in']);
return new AccessToken($accessToken, $expirationTime);
} | php | public function acquireTokenWithAsymmetricKey($resource, $credentials)
{
$method = Resources::HTTP_POST;
$headers = [];
$queryParams = [];
$postParameters = [];
$statusCode = Resources::STATUS_OK;
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ASSERTION_TYPE,
'urn:ietf:params:oauth:client-assertion-type:jwt-bearer'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_RESOURCE,
$resource
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_GRANT_TYPE,
'client_credentials'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_SCOPE,
'openid'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ASSERTION,
$this->encodeCertificateAsJWT($credentials)
);
$response = $this->sendHttp(
$method,
$headers,
$queryParams,
$postParameters,
Resources::EMPTY_STRING,
$statusCode
);
$data = $this->dataSerializer->unserialize($response->getBody());
$accessToken = $data['access_token'];
$expirationTime = time() + intval($data['expires_in']);
return new AccessToken($accessToken, $expirationTime);
} | [
"public",
"function",
"acquireTokenWithAsymmetricKey",
"(",
"$",
"resource",
",",
"$",
"credentials",
")",
"{",
"$",
"method",
"=",
"Resources",
"::",
"HTTP_POST",
";",
"$",
"headers",
"=",
"[",
"]",
";",
"$",
"queryParams",
"=",
"[",
"]",
";",
"$",
"pos... | Get access token using an asymmetric key
@param string $grantType OAuth request grant_type field value
@param string $credentials Asymmetrict Credentials
@return OAuthAccessToken | [
"Get",
"access",
"token",
"using",
"an",
"asymmetric",
"key"
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Authentication/AzureAdClient.php#L137-L189 | train |
Azure/azure-sdk-for-php | src/MediaServices/Authentication/AzureAdClient.php | AzureAdClient.acquireTokenWithUserCredentials | public function acquireTokenWithUserCredentials($resource, $clientId, $username, $password)
{
$method = Resources::HTTP_POST;
$headers = [];
$queryParams = [];
$postParameters = [];
$statusCode = Resources::STATUS_OK;
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_RESOURCE,
$resource
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_GRANT_TYPE,
'password'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_SCOPE,
'openid'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_USERNAME,
$username
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_PASSWORD,
$password
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ID,
$clientId
);
$response = $this->sendHttp(
$method,
$headers,
$queryParams,
$postParameters,
Resources::EMPTY_STRING,
$statusCode
);
$data = $this->dataSerializer->unserialize($response->getBody());
$accessToken = $data['access_token'];
$expirationTime = time() + intval($data['expires_in']);
return new AccessToken($accessToken, $expirationTime);
} | php | public function acquireTokenWithUserCredentials($resource, $clientId, $username, $password)
{
$method = Resources::HTTP_POST;
$headers = [];
$queryParams = [];
$postParameters = [];
$statusCode = Resources::STATUS_OK;
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_RESOURCE,
$resource
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_GRANT_TYPE,
'password'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_SCOPE,
'openid'
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_USERNAME,
$username
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_PASSWORD,
$password
);
$postParameters = $this->addPostParameter(
$postParameters,
Resources::OAUTH_CLIENT_ID,
$clientId
);
$response = $this->sendHttp(
$method,
$headers,
$queryParams,
$postParameters,
Resources::EMPTY_STRING,
$statusCode
);
$data = $this->dataSerializer->unserialize($response->getBody());
$accessToken = $data['access_token'];
$expirationTime = time() + intval($data['expires_in']);
return new AccessToken($accessToken, $expirationTime);
} | [
"public",
"function",
"acquireTokenWithUserCredentials",
"(",
"$",
"resource",
",",
"$",
"clientId",
",",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"method",
"=",
"Resources",
"::",
"HTTP_POST",
";",
"$",
"headers",
"=",
"[",
"]",
";",
"$",
"... | Acquire an Azure AD access token given the username and password
@param string $resource AzureAD resource asking for access to
@param string $clientId AzureAD client Id
@param string $username Username
@param string $password Password
@return OAuthAccessToken | [
"Acquire",
"an",
"Azure",
"AD",
"access",
"token",
"given",
"the",
"username",
"and",
"password"
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Authentication/AzureAdClient.php#L201-L259 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Authentication/StorageAuthScheme.php | StorageAuthScheme.computeCanonicalizedResource | protected function computeCanonicalizedResource($url, $queryParams)
{
$queryParams = array_change_key_case($queryParams);
// 1. Beginning with an empty string (""), append a forward slash (/),
// followed by the name of the account that owns the accessed resource.
$canonicalizedResource = '/'.$this->accountName;
// 2. Append the resource's encoded URI path, without any query parameters.
$canonicalizedResource .= parse_url($url, PHP_URL_PATH);
// 3. Retrieve all query parameters on the resource URI, including the comp
// parameter if it exists.
// 4. Sort the query parameters lexicographically by parameter name, in
// ascending order.
if (count($queryParams) > 0) {
ksort($queryParams);
}
// 5. Convert all parameter names to lowercase.
// 6. URL-decode each query parameter name and value.
// 7. Append each query parameter name and value to the string in the
// following format:
// parameter-name:parameter-value
// 9. Group query parameters
// 10. Append a new line character (\n) after each name-value pair.
foreach ($queryParams as $key => $value) {
// Grouping query parameters
$values = explode(Resources::SEPARATOR, $value);
sort($values);
$separated = implode(Resources::SEPARATOR, $values);
$canonicalizedResource .= "\n".$key.':'.$separated;
}
return $canonicalizedResource;
} | php | protected function computeCanonicalizedResource($url, $queryParams)
{
$queryParams = array_change_key_case($queryParams);
// 1. Beginning with an empty string (""), append a forward slash (/),
// followed by the name of the account that owns the accessed resource.
$canonicalizedResource = '/'.$this->accountName;
// 2. Append the resource's encoded URI path, without any query parameters.
$canonicalizedResource .= parse_url($url, PHP_URL_PATH);
// 3. Retrieve all query parameters on the resource URI, including the comp
// parameter if it exists.
// 4. Sort the query parameters lexicographically by parameter name, in
// ascending order.
if (count($queryParams) > 0) {
ksort($queryParams);
}
// 5. Convert all parameter names to lowercase.
// 6. URL-decode each query parameter name and value.
// 7. Append each query parameter name and value to the string in the
// following format:
// parameter-name:parameter-value
// 9. Group query parameters
// 10. Append a new line character (\n) after each name-value pair.
foreach ($queryParams as $key => $value) {
// Grouping query parameters
$values = explode(Resources::SEPARATOR, $value);
sort($values);
$separated = implode(Resources::SEPARATOR, $values);
$canonicalizedResource .= "\n".$key.':'.$separated;
}
return $canonicalizedResource;
} | [
"protected",
"function",
"computeCanonicalizedResource",
"(",
"$",
"url",
",",
"$",
"queryParams",
")",
"{",
"$",
"queryParams",
"=",
"array_change_key_case",
"(",
"$",
"queryParams",
")",
";",
"// 1. Beginning with an empty string (\"\"), append a forward slash (/),",
"// ... | Computes canonicalized resources from URL.
@param string $url request url
@param array $queryParams request query variables
@see Constructing the Canonicalized Resource String section at
http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx
@return string | [
"Computes",
"canonicalized",
"resources",
"from",
"URL",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Authentication/StorageAuthScheme.php#L156-L192 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/InputEndpoint.php | InputEndpoint.create | public static function create($parsed)
{
$inputEndpoint = new self();
$vip = Utilities::tryGetValue($parsed, Resources::XTAG_VIP);
$port = Utilities::tryGetValue($parsed, Resources::XTAG_PORT);
$roleName = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ROLE_NAME
);
$inputEndpoint->setPort($port);
$inputEndpoint->setRoleName($roleName);
$inputEndpoint->setVip($vip);
return $inputEndpoint;
} | php | public static function create($parsed)
{
$inputEndpoint = new self();
$vip = Utilities::tryGetValue($parsed, Resources::XTAG_VIP);
$port = Utilities::tryGetValue($parsed, Resources::XTAG_PORT);
$roleName = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ROLE_NAME
);
$inputEndpoint->setPort($port);
$inputEndpoint->setRoleName($roleName);
$inputEndpoint->setVip($vip);
return $inputEndpoint;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"inputEndpoint",
"=",
"new",
"self",
"(",
")",
";",
"$",
"vip",
"=",
"Utilities",
"::",
"tryGetValue",
"(",
"$",
"parsed",
",",
"Resources",
"::",
"XTAG_VIP",
")",
";",
"$",
... | Creates a new InputEndpoint from parsed response body.
@param array $parsed The parsed response body in array representation
@return InputEndpoint | [
"Creates",
"a",
"new",
"InputEndpoint",
"from",
"parsed",
"response",
"body",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/InputEndpoint.php#L68-L83 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Utilities.php | Utilities.tryAddUrlScheme | public static function tryAddUrlScheme($url, $scheme = 'http')
{
$urlScheme = parse_url($url, PHP_URL_SCHEME);
if (empty($urlScheme)) {
$url = "$scheme://".$url;
}
return $url;
} | php | public static function tryAddUrlScheme($url, $scheme = 'http')
{
$urlScheme = parse_url($url, PHP_URL_SCHEME);
if (empty($urlScheme)) {
$url = "$scheme://".$url;
}
return $url;
} | [
"public",
"static",
"function",
"tryAddUrlScheme",
"(",
"$",
"url",
",",
"$",
"scheme",
"=",
"'http'",
")",
"{",
"$",
"urlScheme",
"=",
"parse_url",
"(",
"$",
"url",
",",
"PHP_URL_SCHEME",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"urlScheme",
")",
")",
... | Adds a url scheme if there is no scheme.
@param string $url The URL
@param string $scheme The scheme. By default HTTP
@static
@return string | [
"Adds",
"a",
"url",
"scheme",
"if",
"there",
"is",
"no",
"scheme",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Utilities.php#L72-L81 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Utilities.php | Utilities.isoDate | public static function isoDate($timestamp = null)
{
$tz = date_default_timezone_get();
date_default_timezone_set('UTC');
if (is_null($timestamp)) {
$timestamp = time();
}
$returnValue = str_replace(
'+00:00', '.0000000Z', date('c', $timestamp)
);
date_default_timezone_set($tz);
return $returnValue;
} | php | public static function isoDate($timestamp = null)
{
$tz = date_default_timezone_get();
date_default_timezone_set('UTC');
if (is_null($timestamp)) {
$timestamp = time();
}
$returnValue = str_replace(
'+00:00', '.0000000Z', date('c', $timestamp)
);
date_default_timezone_set($tz);
return $returnValue;
} | [
"public",
"static",
"function",
"isoDate",
"(",
"$",
"timestamp",
"=",
"null",
")",
"{",
"$",
"tz",
"=",
"date_default_timezone_get",
"(",
")",
";",
"date_default_timezone_set",
"(",
"'UTC'",
")",
";",
"if",
"(",
"is_null",
"(",
"$",
"timestamp",
")",
")",... | Generate ISO 8601 compliant date string in UTC time zone.
@param int $timestamp The unix timestamp to convert
(for DateTime check date_timestamp_get)
@static
@return string | [
"Generate",
"ISO",
"8601",
"compliant",
"date",
"string",
"in",
"UTC",
"time",
"zone",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Utilities.php#L373-L388 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Utilities.php | Utilities.convertToEdmDateTime | public static function convertToEdmDateTime($value)
{
if (empty($value)) {
return $value;
}
if (is_string($value)) {
$value = self::convertToDateTime($value);
}
Validate::isDate($value, 'value');
$cloned = clone $value;
$cloned->setTimezone(new \DateTimeZone('UTC'));
return str_replace('+0000', 'Z', $cloned->format(\DateTime::ISO8601));
} | php | public static function convertToEdmDateTime($value)
{
if (empty($value)) {
return $value;
}
if (is_string($value)) {
$value = self::convertToDateTime($value);
}
Validate::isDate($value, 'value');
$cloned = clone $value;
$cloned->setTimezone(new \DateTimeZone('UTC'));
return str_replace('+0000', 'Z', $cloned->format(\DateTime::ISO8601));
} | [
"public",
"static",
"function",
"convertToEdmDateTime",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"return",
"$",
"value",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"="... | Converts a DateTime object into an Edm.DaeTime value in UTC timezone,
represented as a string.
@param \DateTime $value The datetime value
@static
@return string | [
"Converts",
"a",
"DateTime",
"object",
"into",
"an",
"Edm",
".",
"DaeTime",
"value",
"in",
"UTC",
"timezone",
"represented",
"as",
"a",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Utilities.php#L400-L416 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Utilities.php | Utilities.orderArray | public static function orderArray($array, $order)
{
$ordered = [];
foreach ($order as $key) {
if (array_key_exists($key, $array)) {
$ordered[$key] = $array[$key];
}
}
return $ordered;
} | php | public static function orderArray($array, $order)
{
$ordered = [];
foreach ($order as $key) {
if (array_key_exists($key, $array)) {
$ordered[$key] = $array[$key];
}
}
return $ordered;
} | [
"public",
"static",
"function",
"orderArray",
"(",
"$",
"array",
",",
"$",
"order",
")",
"{",
"$",
"ordered",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"order",
"as",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
... | Sorts an array based on given keys order.
@param array $array The array to sort
@param array $order The keys order array
@return array | [
"Sorts",
"an",
"array",
"based",
"on",
"given",
"keys",
"order",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Utilities.php#L462-L473 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Utilities.php | Utilities.generateCryptoKey | public static function generateCryptoKey($length)
{
// PHP>=7.0
if (function_exists('random_bytes')) {
return random_bytes($length);
}
$buf = openssl_random_pseudo_bytes($length, $secure);
if ($buf !== false) {
return $buf;
}
throw new \Exception('PRNG failure');
} | php | public static function generateCryptoKey($length)
{
// PHP>=7.0
if (function_exists('random_bytes')) {
return random_bytes($length);
}
$buf = openssl_random_pseudo_bytes($length, $secure);
if ($buf !== false) {
return $buf;
}
throw new \Exception('PRNG failure');
} | [
"public",
"static",
"function",
"generateCryptoKey",
"(",
"$",
"length",
")",
"{",
"// PHP>=7.0",
"if",
"(",
"function_exists",
"(",
"'random_bytes'",
")",
")",
"{",
"return",
"random_bytes",
"(",
"$",
"length",
")",
";",
"}",
"$",
"buf",
"=",
"openssl_rando... | Generate a pseudo-random string of bytes using a cryptographically strong
algorithm.
@param int $length Length of the string in bytes
@return string|bool Generated string of bytes on success, or FALSE on
failure | [
"Generate",
"a",
"pseudo",
"-",
"random",
"string",
"of",
"bytes",
"using",
"a",
"cryptographically",
"strong",
"algorithm",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Utilities.php#L642-L656 | train |
Azure/azure-sdk-for-php | src/MediaServices/Internal/ContentPropertiesSerializer.php | ContentPropertiesSerializer.serialize | public static function serialize($object)
{
Validate::notNull($object, 'object');
$xmlWriter = new \XMLWriter();
$xmlWriter->openMemory();
$xmlWriter->startElementNS(
'meta',
Resources::PROPERTIES,
Resources::DSM_XML_NAMESPACE
);
self::_serializeRecursive($object, $xmlWriter);
$xmlWriter->endElement();
return $xmlWriter->outputMemory();
} | php | public static function serialize($object)
{
Validate::notNull($object, 'object');
$xmlWriter = new \XMLWriter();
$xmlWriter->openMemory();
$xmlWriter->startElementNS(
'meta',
Resources::PROPERTIES,
Resources::DSM_XML_NAMESPACE
);
self::_serializeRecursive($object, $xmlWriter);
$xmlWriter->endElement();
return $xmlWriter->outputMemory();
} | [
"public",
"static",
"function",
"serialize",
"(",
"$",
"object",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"object",
",",
"'object'",
")",
";",
"$",
"xmlWriter",
"=",
"new",
"\\",
"XMLWriter",
"(",
")",
";",
"$",
"xmlWriter",
"->",
"openMemory",
... | Get properties XML from object.
@param object $object The object to get properties
@return string | [
"Get",
"properties",
"XML",
"from",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Internal/ContentPropertiesSerializer.php#L68-L84 | train |
Azure/azure-sdk-for-php | src/MediaServices/Internal/ContentPropertiesSerializer.php | ContentPropertiesSerializer._unserializeRecursive | private static function _unserializeRecursive(SimpleXMLElement $xml)
{
$result = [];
$dataNamespace = Resources::DS_XML_NAMESPACE;
/** @var SimpleXMLElement $child */
foreach ($xml->children($dataNamespace) as $child) {
if (count($child->children($dataNamespace)) > 0) {
$value = [];
$children = $child->children($dataNamespace);
/** @var SimpleXMLElement $firstChild */
$firstChild = $children[0];
if ($firstChild->getName() == 'element') {
foreach ($children as $subChild) {
$value[] = self::_unserializeRecursive(
$subChild
);
}
} else {
$value = self::_unserializeRecursive(
$child
);
}
} else {
$value = (string) $child;
}
$result[$child->getName()] = $value;
}
return $result;
} | php | private static function _unserializeRecursive(SimpleXMLElement $xml)
{
$result = [];
$dataNamespace = Resources::DS_XML_NAMESPACE;
/** @var SimpleXMLElement $child */
foreach ($xml->children($dataNamespace) as $child) {
if (count($child->children($dataNamespace)) > 0) {
$value = [];
$children = $child->children($dataNamespace);
/** @var SimpleXMLElement $firstChild */
$firstChild = $children[0];
if ($firstChild->getName() == 'element') {
foreach ($children as $subChild) {
$value[] = self::_unserializeRecursive(
$subChild
);
}
} else {
$value = self::_unserializeRecursive(
$child
);
}
} else {
$value = (string) $child;
}
$result[$child->getName()] = $value;
}
return $result;
} | [
"private",
"static",
"function",
"_unserializeRecursive",
"(",
"SimpleXMLElement",
"$",
"xml",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"dataNamespace",
"=",
"Resources",
"::",
"DS_XML_NAMESPACE",
";",
"/** @var SimpleXMLElement $child */",
"foreach",
"(",
... | Parse properties recursively.
@param SimpleXMLElement $xml XML object to parse
@return array | [
"Parse",
"properties",
"recursively",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Internal/ContentPropertiesSerializer.php#L93-L123 | train |
Azure/azure-sdk-for-php | src/MediaServices/Internal/ContentPropertiesSerializer.php | ContentPropertiesSerializer._isRequired | private static function _isRequired($object, $fieldName)
{
$reflectionClass = new \ReflectionClass($object);
if ($reflectionClass->hasMethod('requiredFields')) {
return in_array($fieldName, $object->requiredFields());
}
return false;
} | php | private static function _isRequired($object, $fieldName)
{
$reflectionClass = new \ReflectionClass($object);
if ($reflectionClass->hasMethod('requiredFields')) {
return in_array($fieldName, $object->requiredFields());
}
return false;
} | [
"private",
"static",
"function",
"_isRequired",
"(",
"$",
"object",
",",
"$",
"fieldName",
")",
"{",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"object",
")",
";",
"if",
"(",
"$",
"reflectionClass",
"->",
"hasMethod",
"(",
"'req... | Returns true if the specified filed y required for the specified entity.
@param mixed $object the entity
@param string $fieldName the property name to verify if it's required or not
@return bool | [
"Returns",
"true",
"if",
"the",
"specified",
"filed",
"y",
"required",
"for",
"the",
"specified",
"entity",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Internal/ContentPropertiesSerializer.php#L133-L141 | train |
Azure/azure-sdk-for-php | src/MediaServices/Internal/ContentPropertiesSerializer.php | ContentPropertiesSerializer._serializeRecursive | private static function _serializeRecursive($object, \XMLWriter $xmlWriter)
{
Validate::notNull($object, 'object');
$reflectionClass = new \ReflectionClass($object);
$methodArray = $reflectionClass->getMethods();
$result = [];
foreach ($methodArray as $method) {
if ((strpos($method->name, 'get') === 0)
&& $method->isPublic()
) {
$variableName = substr($method->name, 3);
$variableValue = $method->invoke($object);
if (!empty($variableValue) || self::_isRequired($object, $variableName)) {
if (is_a($variableValue, '\DateTime')) {
$variableValue = $variableValue->format(\DateTime::ATOM);
}
if (is_a($variableValue, '\DateInterval')) {
$variableValue = self::dateIntervalToString($variableValue);
}
if (gettype($variableValue) == 'array') {
$xmlWriter->startElementNS(
'data',
$variableName,
Resources::DS_XML_NAMESPACE
);
foreach ($variableValue as $item) {
$xmlWriter->startElementNS(
'data',
Resources::ELEMENT,
Resources::DS_XML_NAMESPACE
);
self::_serializeRecursive(
$item,
$xmlWriter
);
$xmlWriter->endElement();
}
$xmlWriter->endElement();
} elseif (gettype($variableValue) == 'object') {
$xmlWriter->startElementNS(
'data',
$variableName,
Resources::DS_XML_NAMESPACE
);
self::_serializeRecursive(
$variableValue,
$xmlWriter
);
$xmlWriter->endElement();
} else {
$xmlWriter->writeElementNS(
'data',
$variableName,
Resources::DS_XML_NAMESPACE,
(string) $variableValue
);
}
}
}
}
return $result;
} | php | private static function _serializeRecursive($object, \XMLWriter $xmlWriter)
{
Validate::notNull($object, 'object');
$reflectionClass = new \ReflectionClass($object);
$methodArray = $reflectionClass->getMethods();
$result = [];
foreach ($methodArray as $method) {
if ((strpos($method->name, 'get') === 0)
&& $method->isPublic()
) {
$variableName = substr($method->name, 3);
$variableValue = $method->invoke($object);
if (!empty($variableValue) || self::_isRequired($object, $variableName)) {
if (is_a($variableValue, '\DateTime')) {
$variableValue = $variableValue->format(\DateTime::ATOM);
}
if (is_a($variableValue, '\DateInterval')) {
$variableValue = self::dateIntervalToString($variableValue);
}
if (gettype($variableValue) == 'array') {
$xmlWriter->startElementNS(
'data',
$variableName,
Resources::DS_XML_NAMESPACE
);
foreach ($variableValue as $item) {
$xmlWriter->startElementNS(
'data',
Resources::ELEMENT,
Resources::DS_XML_NAMESPACE
);
self::_serializeRecursive(
$item,
$xmlWriter
);
$xmlWriter->endElement();
}
$xmlWriter->endElement();
} elseif (gettype($variableValue) == 'object') {
$xmlWriter->startElementNS(
'data',
$variableName,
Resources::DS_XML_NAMESPACE
);
self::_serializeRecursive(
$variableValue,
$xmlWriter
);
$xmlWriter->endElement();
} else {
$xmlWriter->writeElementNS(
'data',
$variableName,
Resources::DS_XML_NAMESPACE,
(string) $variableValue
);
}
}
}
}
return $result;
} | [
"private",
"static",
"function",
"_serializeRecursive",
"(",
"$",
"object",
",",
"\\",
"XMLWriter",
"$",
"xmlWriter",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"object",
",",
"'object'",
")",
";",
"$",
"reflectionClass",
"=",
"new",
"\\",
"ReflectionC... | Get object properties as array.
@param object $object Source object
@param \XMLWriter $xmlWriter Xml writer to use
@return array | [
"Get",
"object",
"properties",
"as",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Internal/ContentPropertiesSerializer.php#L151-L221 | train |
Azure/azure-sdk-for-php | src/Common/Internal/ConnectionStringParser.php | ConnectionStringParser._skipWhiteSpaces | private function _skipWhiteSpaces()
{
while ($this->_pos < strlen($this->_value)
&& ctype_space($this->_value[$this->_pos])
) {
++$this->_pos;
}
} | php | private function _skipWhiteSpaces()
{
while ($this->_pos < strlen($this->_value)
&& ctype_space($this->_value[$this->_pos])
) {
++$this->_pos;
}
} | [
"private",
"function",
"_skipWhiteSpaces",
"(",
")",
"{",
"while",
"(",
"$",
"this",
"->",
"_pos",
"<",
"strlen",
"(",
"$",
"this",
"->",
"_value",
")",
"&&",
"ctype_space",
"(",
"$",
"this",
"->",
"_value",
"[",
"$",
"this",
"->",
"_pos",
"]",
")",
... | Skips whitespaces at the current position. | [
"Skips",
"whitespaces",
"at",
"the",
"current",
"position",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/ConnectionStringParser.php#L204-L211 | train |
Azure/azure-sdk-for-php | src/Common/Internal/ConnectionStringParser.php | ConnectionStringParser._extractValue | private function _extractValue()
{
$value = Resources::EMPTY_STRING;
if ($this->_pos < strlen($this->_value)) {
$ch = $this->_value[$this->_pos];
if ($ch == '"' || $ch == '\'') {
// Value is contained between double quotes or skipped single quotes.
++$this->_pos;
$value = $this->_extractString($ch);
} else {
$firstPos = $this->_pos;
$isFound = false;
while ($this->_pos < strlen($this->_value) && !$isFound) {
$ch = $this->_value[$this->_pos];
if ($ch == ';') {
$isFound = true;
} else {
++$this->_pos;
}
}
$value = rtrim(
substr($this->_value, $firstPos, $this->_pos - $firstPos)
);
}
}
return $value;
} | php | private function _extractValue()
{
$value = Resources::EMPTY_STRING;
if ($this->_pos < strlen($this->_value)) {
$ch = $this->_value[$this->_pos];
if ($ch == '"' || $ch == '\'') {
// Value is contained between double quotes or skipped single quotes.
++$this->_pos;
$value = $this->_extractString($ch);
} else {
$firstPos = $this->_pos;
$isFound = false;
while ($this->_pos < strlen($this->_value) && !$isFound) {
$ch = $this->_value[$this->_pos];
if ($ch == ';') {
$isFound = true;
} else {
++$this->_pos;
}
}
$value = rtrim(
substr($this->_value, $firstPos, $this->_pos - $firstPos)
);
}
}
return $value;
} | [
"private",
"function",
"_extractValue",
"(",
")",
"{",
"$",
"value",
"=",
"Resources",
"::",
"EMPTY_STRING",
";",
"if",
"(",
"$",
"this",
"->",
"_pos",
"<",
"strlen",
"(",
"$",
"this",
"->",
"_value",
")",
")",
"{",
"$",
"ch",
"=",
"$",
"this",
"->... | Extracts the key's value.
@return string | [
"Extracts",
"the",
"key",
"s",
"value",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/ConnectionStringParser.php#L218-L250 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/Person.php | Person.parseXml | public function parseXml($xmlString)
{
$personXml = simplexml_load_string($xmlString);
$personArray = (array) $personXml;
if (array_key_exists('name', $personArray)) {
$this->name = (string) $personArray['name'];
}
if (array_key_exists('uri', $personArray)) {
$this->uri = (string) $personArray['uri'];
}
if (array_key_exists('email', $personArray)) {
$this->email = (string) $personArray['email'];
}
} | php | public function parseXml($xmlString)
{
$personXml = simplexml_load_string($xmlString);
$personArray = (array) $personXml;
if (array_key_exists('name', $personArray)) {
$this->name = (string) $personArray['name'];
}
if (array_key_exists('uri', $personArray)) {
$this->uri = (string) $personArray['uri'];
}
if (array_key_exists('email', $personArray)) {
$this->email = (string) $personArray['email'];
}
} | [
"public",
"function",
"parseXml",
"(",
"$",
"xmlString",
")",
"{",
"$",
"personXml",
"=",
"simplexml_load_string",
"(",
"$",
"xmlString",
")",
";",
"$",
"personArray",
"=",
"(",
"array",
")",
"$",
"personXml",
";",
"if",
"(",
"array_key_exists",
"(",
"'nam... | Populates the properties with a specified XML string.
@param string $xmlString An XML based string representing
the Person instance | [
"Populates",
"the",
"properties",
"with",
"a",
"specified",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/Person.php#L83-L99 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/Person.php | Person.writeInnerXml | public function writeInnerXml(\XMLWriter $xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
$xmlWriter->writeElementNS(
'atom',
'name',
Resources::ATOM_NAMESPACE,
$this->name
);
$this->writeOptionalElementNS(
$xmlWriter,
'atom',
'uri',
Resources::ATOM_NAMESPACE,
$this->uri
);
$this->writeOptionalElementNS(
$xmlWriter,
'atom',
'email',
Resources::ATOM_NAMESPACE,
$this->email
);
} | php | public function writeInnerXml(\XMLWriter $xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
$xmlWriter->writeElementNS(
'atom',
'name',
Resources::ATOM_NAMESPACE,
$this->name
);
$this->writeOptionalElementNS(
$xmlWriter,
'atom',
'uri',
Resources::ATOM_NAMESPACE,
$this->uri
);
$this->writeOptionalElementNS(
$xmlWriter,
'atom',
'email',
Resources::ATOM_NAMESPACE,
$this->email
);
} | [
"public",
"function",
"writeInnerXml",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"xmlWriter",
",",
"'xmlWriter'",
")",
";",
"$",
"xmlWriter",
"->",
"writeElementNS",
"(",
"'atom'",
",",
"'name'",
",",
"Resourc... | Writes a inner XML representing the person.
@param \XMLWriter $xmlWriter The XML writer | [
"Writes",
"a",
"inner",
"XML",
"representing",
"the",
"person",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/Person.php#L183-L208 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.