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/Templates/MediaServicesLicenseTemplateSerializer.php | MediaServicesLicenseTemplateSerializer.deserialize | public static function deserialize($template)
{
$xml = simplexml_load_string($template);
$result = new PlayReadyLicenseResponseTemplate();
// Validation
if ($xml->getName() !== 'PlayReadyLicenseResponseTemplate') {
throw new \RuntimeException("This is not a PlayReadyLicenseResponseTemplate, it is a '{$xml->getName()}'");
}
if (!isset($xml->LicenseTemplates)) {
throw new \RuntimeException(
"The PlayReadyLicenseResponseTemplate must contains an 'LicenseTemplates' element"
);
}
// decoding
$result->setLicenseTemplates(self::deserializeLicenseTemplates($xml->LicenseTemplates));
if (isset($xml->ResponseCustomData)) {
$result->setResponseCustomData((string) $xml->ResponseCustomData);
}
self::ValidateLicenseResponseTemplate($result);
return $result;
} | php | public static function deserialize($template)
{
$xml = simplexml_load_string($template);
$result = new PlayReadyLicenseResponseTemplate();
// Validation
if ($xml->getName() !== 'PlayReadyLicenseResponseTemplate') {
throw new \RuntimeException("This is not a PlayReadyLicenseResponseTemplate, it is a '{$xml->getName()}'");
}
if (!isset($xml->LicenseTemplates)) {
throw new \RuntimeException(
"The PlayReadyLicenseResponseTemplate must contains an 'LicenseTemplates' element"
);
}
// decoding
$result->setLicenseTemplates(self::deserializeLicenseTemplates($xml->LicenseTemplates));
if (isset($xml->ResponseCustomData)) {
$result->setResponseCustomData((string) $xml->ResponseCustomData);
}
self::ValidateLicenseResponseTemplate($result);
return $result;
} | [
"public",
"static",
"function",
"deserialize",
"(",
"$",
"template",
")",
"{",
"$",
"xml",
"=",
"simplexml_load_string",
"(",
"$",
"template",
")",
";",
"$",
"result",
"=",
"new",
"PlayReadyLicenseResponseTemplate",
"(",
")",
";",
"// Validation",
"if",
"(",
... | Deserialize a PlayReadyLicenseResponseTemplate xml into a PlayReadyLicenseResponseTemplate object.
@param string $template Array containing values for object properties
@return PlayReadyLicenseResponseTemplate | [
"Deserialize",
"a",
"PlayReadyLicenseResponseTemplate",
"xml",
"into",
"a",
"PlayReadyLicenseResponseTemplate",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Templates/MediaServicesLicenseTemplateSerializer.php#L52-L77 | train |
Azure/azure-sdk-for-php | src/MediaServices/Templates/MediaServicesLicenseTemplateSerializer.php | MediaServicesLicenseTemplateSerializer.serialize | public static function serialize($template)
{
self::ValidateLicenseResponseTemplate($template);
$writer = new \XMLWriter();
$writer->openMemory();
$writer->startElementNS(null, 'PlayReadyLicenseResponseTemplate', Resources::PRL_XML_NAMESPACE);
$writer->writeAttributeNS('xmlns', 'i', null, Resources::XSI_XML_NAMESPACE);
self::serializeLicenseTemplates($writer, $template->getLicenseTemplates());
$writer->writeElement('ResponseCustomData', $template->getResponseCustomData());
$writer->endElement();
return $writer->outputMemory();
} | php | public static function serialize($template)
{
self::ValidateLicenseResponseTemplate($template);
$writer = new \XMLWriter();
$writer->openMemory();
$writer->startElementNS(null, 'PlayReadyLicenseResponseTemplate', Resources::PRL_XML_NAMESPACE);
$writer->writeAttributeNS('xmlns', 'i', null, Resources::XSI_XML_NAMESPACE);
self::serializeLicenseTemplates($writer, $template->getLicenseTemplates());
$writer->writeElement('ResponseCustomData', $template->getResponseCustomData());
$writer->endElement();
return $writer->outputMemory();
} | [
"public",
"static",
"function",
"serialize",
"(",
"$",
"template",
")",
"{",
"self",
"::",
"ValidateLicenseResponseTemplate",
"(",
"$",
"template",
")",
";",
"$",
"writer",
"=",
"new",
"\\",
"XMLWriter",
"(",
")",
";",
"$",
"writer",
"->",
"openMemory",
"(... | Serialize a PlayReadyLicenseResponseTemplate object into a PlayReadyLicenseResponseTemplate XML.
@param PlayReadyLicenseResponseTemplate $template
@return string The PlayReadyLicenseResponseTemplate XML | [
"Serialize",
"a",
"PlayReadyLicenseResponseTemplate",
"object",
"into",
"a",
"PlayReadyLicenseResponseTemplate",
"XML",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Templates/MediaServicesLicenseTemplateSerializer.php#L86-L102 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/BrokerProperties.php | BrokerProperties.create | public static function create($brokerPropertiesJson)
{
Validate::isString($brokerPropertiesJson, 'brokerPropertiesJson');
$brokerProperties = new self();
$brokerPropertiesArray = (array) json_decode($brokerPropertiesJson);
if (array_key_exists('CorrelationId', $brokerPropertiesArray)) {
$brokerProperties->setCorrelationId(
$brokerPropertiesArray['CorrelationId']
);
}
if (array_key_exists('SessionId', $brokerPropertiesArray)) {
$brokerProperties->setSessionId(
$brokerPropertiesArray['SessionId']
);
}
if (array_key_exists('DeliveryCount', $brokerPropertiesArray)) {
$brokerProperties->setDeliveryCount(
$brokerPropertiesArray['DeliveryCount']
);
}
if (array_key_exists('LockedUntilUtc', $brokerPropertiesArray)) {
$brokerProperties->setLockedUntilUtc(
\DateTime::createFromFormat(
Resources::AZURE_DATE_FORMAT,
$brokerPropertiesArray['LockedUntilUtc']
)
);
}
if (array_key_exists('LockToken', $brokerPropertiesArray)) {
$brokerProperties->setLockToken(
$brokerPropertiesArray['LockToken']
);
}
if (array_key_exists('MessageId', $brokerPropertiesArray)) {
$brokerProperties->setMessageId(
$brokerPropertiesArray['MessageId']
);
}
if (array_key_exists('Label', $brokerPropertiesArray)) {
$brokerProperties->setLabel($brokerPropertiesArray['Label']);
}
if (array_key_exists('ReplyTo', $brokerPropertiesArray)) {
$brokerProperties->setReplyTo($brokerPropertiesArray['ReplyTo']);
}
if (array_key_exists('SequenceNumber', $brokerPropertiesArray)) {
$brokerProperties->setSequenceNumber(
$brokerPropertiesArray['SequenceNumber']
);
}
if (array_key_exists('TimeToLive', $brokerPropertiesArray)) {
$brokerProperties->setTimeToLive(
doubleval($brokerPropertiesArray['TimeToLive'])
);
}
if (array_key_exists('To', $brokerPropertiesArray)) {
$brokerProperties->setTo($brokerPropertiesArray['To']);
}
if (array_key_exists(
'ScheduledEnqueueTimeUtc',
$brokerPropertiesArray
)
) {
$brokerProperties->setScheduledEnqueueTimeUtc(
\DateTime::createFromFormat(
Resources::AZURE_DATE_FORMAT,
$brokerPropertiesArray['ScheduledEnqueueTimeUtc']
)
);
}
if (array_key_exists('ReplyToSessionId', $brokerPropertiesArray)) {
$brokerProperties->setReplyToSessionId(
$brokerPropertiesArray['ReplyToSessionId']
);
}
if (array_key_exists('MessageLocation', $brokerPropertiesArray)) {
$brokerProperties->setMessageLocation(
$brokerPropertiesArray['MessageLocation']
);
}
if (array_key_exists('LockLocation', $brokerPropertiesArray)) {
$brokerProperties->setLockLocation(
$brokerPropertiesArray['LockLocation']
);
}
return $brokerProperties;
} | php | public static function create($brokerPropertiesJson)
{
Validate::isString($brokerPropertiesJson, 'brokerPropertiesJson');
$brokerProperties = new self();
$brokerPropertiesArray = (array) json_decode($brokerPropertiesJson);
if (array_key_exists('CorrelationId', $brokerPropertiesArray)) {
$brokerProperties->setCorrelationId(
$brokerPropertiesArray['CorrelationId']
);
}
if (array_key_exists('SessionId', $brokerPropertiesArray)) {
$brokerProperties->setSessionId(
$brokerPropertiesArray['SessionId']
);
}
if (array_key_exists('DeliveryCount', $brokerPropertiesArray)) {
$brokerProperties->setDeliveryCount(
$brokerPropertiesArray['DeliveryCount']
);
}
if (array_key_exists('LockedUntilUtc', $brokerPropertiesArray)) {
$brokerProperties->setLockedUntilUtc(
\DateTime::createFromFormat(
Resources::AZURE_DATE_FORMAT,
$brokerPropertiesArray['LockedUntilUtc']
)
);
}
if (array_key_exists('LockToken', $brokerPropertiesArray)) {
$brokerProperties->setLockToken(
$brokerPropertiesArray['LockToken']
);
}
if (array_key_exists('MessageId', $brokerPropertiesArray)) {
$brokerProperties->setMessageId(
$brokerPropertiesArray['MessageId']
);
}
if (array_key_exists('Label', $brokerPropertiesArray)) {
$brokerProperties->setLabel($brokerPropertiesArray['Label']);
}
if (array_key_exists('ReplyTo', $brokerPropertiesArray)) {
$brokerProperties->setReplyTo($brokerPropertiesArray['ReplyTo']);
}
if (array_key_exists('SequenceNumber', $brokerPropertiesArray)) {
$brokerProperties->setSequenceNumber(
$brokerPropertiesArray['SequenceNumber']
);
}
if (array_key_exists('TimeToLive', $brokerPropertiesArray)) {
$brokerProperties->setTimeToLive(
doubleval($brokerPropertiesArray['TimeToLive'])
);
}
if (array_key_exists('To', $brokerPropertiesArray)) {
$brokerProperties->setTo($brokerPropertiesArray['To']);
}
if (array_key_exists(
'ScheduledEnqueueTimeUtc',
$brokerPropertiesArray
)
) {
$brokerProperties->setScheduledEnqueueTimeUtc(
\DateTime::createFromFormat(
Resources::AZURE_DATE_FORMAT,
$brokerPropertiesArray['ScheduledEnqueueTimeUtc']
)
);
}
if (array_key_exists('ReplyToSessionId', $brokerPropertiesArray)) {
$brokerProperties->setReplyToSessionId(
$brokerPropertiesArray['ReplyToSessionId']
);
}
if (array_key_exists('MessageLocation', $brokerPropertiesArray)) {
$brokerProperties->setMessageLocation(
$brokerPropertiesArray['MessageLocation']
);
}
if (array_key_exists('LockLocation', $brokerPropertiesArray)) {
$brokerProperties->setLockLocation(
$brokerPropertiesArray['LockLocation']
);
}
return $brokerProperties;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"brokerPropertiesJson",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"brokerPropertiesJson",
",",
"'brokerPropertiesJson'",
")",
";",
"$",
"brokerProperties",
"=",
"new",
"self",
"(",
")",
";",
"$",
"bro... | Creates a broker properties instance with specified JSON message.
@param string $brokerPropertiesJson A JSON message representing a
broker properties
@return BrokerProperties | [
"Creates",
"a",
"broker",
"properties",
"instance",
"with",
"specified",
"JSON",
"message",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/BrokerProperties.php#L167-L270 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/BrokerProperties.php | BrokerProperties.toString | public function toString()
{
$value = [];
$this->setValueArrayString(
$value,
'CorrelationId',
$this->_correlationId
);
$this->setValueArrayString(
$value,
'SessionId',
$this->_sessionId
);
$this->setValueArrayInt(
$value,
'DeliveryCount',
$this->_deliveryCount
);
$this->setValueArrayDateTime(
$value,
'LockedUntilUtc',
$this->_lockedUntilUtc
);
$this->setValueArrayString(
$value,
'LockToken',
$this->_lockToken
);
$this->setValueArrayString(
$value,
'MessageId',
$this->_messageId
);
$this->setValueArrayString(
$value,
'Label',
$this->_label
);
$this->setValueArrayString(
$value,
'ReplyTo',
$this->_replyTo
);
$this->setValueArrayString(
$value,
'SequenceNumber',
$this->_sequenceNumber
);
$this->setValueArrayFloat(
$value,
'TimeToLive',
$this->_timeToLive
);
$this->setValueArrayString(
$value,
'To',
$this->_to
);
$this->setValueArrayDateTime(
$value,
'ScheduledEnqueueTimeUtc',
$this->_scheduledEnqueueTimeUtc
);
$this->setValueArrayString(
$value,
'ReplyToSessionId',
$this->_replyToSessionId
);
$this->setValueArrayString(
$value,
'MessageLocation',
$this->_messageLocation
);
$this->setValueArrayString(
$value,
'LockLocation',
$this->_lockLocation
);
$result = json_encode($value);
return $result;
} | php | public function toString()
{
$value = [];
$this->setValueArrayString(
$value,
'CorrelationId',
$this->_correlationId
);
$this->setValueArrayString(
$value,
'SessionId',
$this->_sessionId
);
$this->setValueArrayInt(
$value,
'DeliveryCount',
$this->_deliveryCount
);
$this->setValueArrayDateTime(
$value,
'LockedUntilUtc',
$this->_lockedUntilUtc
);
$this->setValueArrayString(
$value,
'LockToken',
$this->_lockToken
);
$this->setValueArrayString(
$value,
'MessageId',
$this->_messageId
);
$this->setValueArrayString(
$value,
'Label',
$this->_label
);
$this->setValueArrayString(
$value,
'ReplyTo',
$this->_replyTo
);
$this->setValueArrayString(
$value,
'SequenceNumber',
$this->_sequenceNumber
);
$this->setValueArrayFloat(
$value,
'TimeToLive',
$this->_timeToLive
);
$this->setValueArrayString(
$value,
'To',
$this->_to
);
$this->setValueArrayDateTime(
$value,
'ScheduledEnqueueTimeUtc',
$this->_scheduledEnqueueTimeUtc
);
$this->setValueArrayString(
$value,
'ReplyToSessionId',
$this->_replyToSessionId
);
$this->setValueArrayString(
$value,
'MessageLocation',
$this->_messageLocation
);
$this->setValueArrayString(
$value,
'LockLocation',
$this->_lockLocation
);
$result = json_encode($value);
return $result;
} | [
"public",
"function",
"toString",
"(",
")",
"{",
"$",
"value",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"setValueArrayString",
"(",
"$",
"value",
",",
"'CorrelationId'",
",",
"$",
"this",
"->",
"_correlationId",
")",
";",
"$",
"this",
"->",
"setValueArrayS... | Gets a string representing the broker property.
@return string | [
"Gets",
"a",
"string",
"representing",
"the",
"broker",
"property",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/BrokerProperties.php#L579-L676 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/BrokerProperties.php | BrokerProperties.setValueArrayString | public function setValueArrayString(array &$valueArray, $key, $value)
{
Validate::isString($key, 'key');
if (!empty($value)) {
Validate::isString($value, 'value');
$valueArray[$key] = $value;
}
} | php | public function setValueArrayString(array &$valueArray, $key, $value)
{
Validate::isString($key, 'key');
if (!empty($value)) {
Validate::isString($value, 'value');
$valueArray[$key] = $value;
}
} | [
"public",
"function",
"setValueArrayString",
"(",
"array",
"&",
"$",
"valueArray",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"key",
",",
"'key'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
... | Sets a string in an array.
@param array &$valueArray The array of a set of values
@param string $key The key of the key value pair
@param string $value The value of the key value pair | [
"Sets",
"a",
"string",
"in",
"an",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/BrokerProperties.php#L685-L693 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/BrokerProperties.php | BrokerProperties.setValueArrayInt | public function setValueArrayInt(array &$valueArray, $key, $value)
{
Validate::isString($key, 'key');
if (!empty($value)) {
Validate::isInteger($value, 'value');
$valueArray[$key] = $value;
}
} | php | public function setValueArrayInt(array &$valueArray, $key, $value)
{
Validate::isString($key, 'key');
if (!empty($value)) {
Validate::isInteger($value, 'value');
$valueArray[$key] = $value;
}
} | [
"public",
"function",
"setValueArrayInt",
"(",
"array",
"&",
"$",
"valueArray",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"key",
",",
"'key'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
")... | Sets an integer value in an array.
@param array &$valueArray The array of a set of values
@param string $key The key of the key value pair
@param int $value The value of the key value pair | [
"Sets",
"an",
"integer",
"value",
"in",
"an",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/BrokerProperties.php#L702-L710 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/BrokerProperties.php | BrokerProperties.setValueArrayFloat | public function setValueArrayFloat(array &$valueArray, $key, $value)
{
Validate::isString($key, 'key');
if (!empty($value)) {
Validate::isDouble($value, 'value');
$valueArray[$key] = (float) $value;
}
} | php | public function setValueArrayFloat(array &$valueArray, $key, $value)
{
Validate::isString($key, 'key');
if (!empty($value)) {
Validate::isDouble($value, 'value');
$valueArray[$key] = (float) $value;
}
} | [
"public",
"function",
"setValueArrayFloat",
"(",
"array",
"&",
"$",
"valueArray",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"key",
",",
"'key'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
... | Sets a float value in an array.
@param array &$valueArray The array of a set of values
@param string $key The key of the key value pair
@param float $value The value of the key value pair | [
"Sets",
"a",
"float",
"value",
"in",
"an",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/BrokerProperties.php#L719-L727 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/BrokerProperties.php | BrokerProperties.setValueArrayDateTime | public function setValueArrayDateTime(array &$valueArray, $key, $value)
{
Validate::isString($key, 'key');
if (!empty($value)) {
Validate::isDate($value, 'value');
$valueArray[$key] = gmdate(
Resources::AZURE_DATE_FORMAT,
$value->getTimestamp()
);
}
} | php | public function setValueArrayDateTime(array &$valueArray, $key, $value)
{
Validate::isString($key, 'key');
if (!empty($value)) {
Validate::isDate($value, 'value');
$valueArray[$key] = gmdate(
Resources::AZURE_DATE_FORMAT,
$value->getTimestamp()
);
}
} | [
"public",
"function",
"setValueArrayDateTime",
"(",
"array",
"&",
"$",
"valueArray",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"key",
",",
"'key'",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",... | Sets a DateTime value in an array.
@param array &$valueArray The array of a set of values
@param string $key The key of the key value pair
@param \DateTime $value The value of the key value pair | [
"Sets",
"a",
"DateTime",
"value",
"in",
"an",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/BrokerProperties.php#L736-L747 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/DeploymentStatus.php | DeploymentStatus.isValid | public static function isValid($status)
{
switch (strtolower($status)) {
case strtolower(self::SUSPENDED):
case strtolower(self::RUNNING):
return true;
default:
return false;
}
} | php | public static function isValid($status)
{
switch (strtolower($status)) {
case strtolower(self::SUSPENDED):
case strtolower(self::RUNNING):
return true;
default:
return false;
}
} | [
"public",
"static",
"function",
"isValid",
"(",
"$",
"status",
")",
"{",
"switch",
"(",
"strtolower",
"(",
"$",
"status",
")",
")",
"{",
"case",
"strtolower",
"(",
"self",
"::",
"SUSPENDED",
")",
":",
"case",
"strtolower",
"(",
"self",
"::",
"RUNNING",
... | Validates the provided status.
@param string $status The deployment status
@return bool | [
"Validates",
"the",
"provided",
"status",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/DeploymentStatus.php#L53-L63 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/SubscriptionDescription.php | SubscriptionDescription.create | public static function create($subscriptionDescriptionXml)
{
$subscriptionDescription = new self();
$root = simplexml_load_string(
$subscriptionDescriptionXml
);
$subscriptionDescriptionArray = (array) $root;
if (array_key_exists('LockDuration', $subscriptionDescriptionArray)) {
$subscriptionDescription->setLockDuration(
(string) $subscriptionDescriptionArray['LockDuration']
);
}
if (array_key_exists('RequiresSession', $subscriptionDescriptionArray)) {
$subscriptionDescription->setRequiresSession(
(bool) $subscriptionDescriptionArray['RequiresSession']
);
}
if (array_key_exists(
'DefaultMessageTimeToLive',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setDefaultMessageTimeToLive(
(string) $subscriptionDescriptionArray['DefaultMessageTimeToLive']
);
}
if (array_key_exists(
'DeadLetteringOnMessageExpiration',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setDeadLetteringOnMessageExpiration(
(string) $subscriptionDescriptionArray[
'DeadLetteringOnMessageExpiration'
]
);
}
if (array_key_exists(
'DeadLetteringOnFilterEvaluationException',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setDeadLetteringOnFilterEvaluationExceptions(
(string) $subscriptionDescriptionArray[
'DeadLetteringOnFilterEvaluationException'
]
);
}
if (array_key_exists(
'DefaultRuleDescription',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setDefaultRuleDescription(
(string) $subscriptionDescriptionArray['DefaultRuleDescription']
);
}
if (array_key_exists('MessageCount', $subscriptionDescriptionArray)) {
$subscriptionDescription->setMessageCount(
(string) $subscriptionDescriptionArray['MessageCount']
);
}
if (array_key_exists('MaxDeliveryCount', $subscriptionDescriptionArray)) {
$subscriptionDescription->setMaxDeliveryCount(
(string) $subscriptionDescriptionArray['MaxDeliveryCount']
);
}
if (array_key_exists(
'EnableBatchedOperations',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setEnableBatchedOperations(
(bool) $subscriptionDescriptionArray['EnableBatchedOperations']
);
}
return $subscriptionDescription;
} | php | public static function create($subscriptionDescriptionXml)
{
$subscriptionDescription = new self();
$root = simplexml_load_string(
$subscriptionDescriptionXml
);
$subscriptionDescriptionArray = (array) $root;
if (array_key_exists('LockDuration', $subscriptionDescriptionArray)) {
$subscriptionDescription->setLockDuration(
(string) $subscriptionDescriptionArray['LockDuration']
);
}
if (array_key_exists('RequiresSession', $subscriptionDescriptionArray)) {
$subscriptionDescription->setRequiresSession(
(bool) $subscriptionDescriptionArray['RequiresSession']
);
}
if (array_key_exists(
'DefaultMessageTimeToLive',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setDefaultMessageTimeToLive(
(string) $subscriptionDescriptionArray['DefaultMessageTimeToLive']
);
}
if (array_key_exists(
'DeadLetteringOnMessageExpiration',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setDeadLetteringOnMessageExpiration(
(string) $subscriptionDescriptionArray[
'DeadLetteringOnMessageExpiration'
]
);
}
if (array_key_exists(
'DeadLetteringOnFilterEvaluationException',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setDeadLetteringOnFilterEvaluationExceptions(
(string) $subscriptionDescriptionArray[
'DeadLetteringOnFilterEvaluationException'
]
);
}
if (array_key_exists(
'DefaultRuleDescription',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setDefaultRuleDescription(
(string) $subscriptionDescriptionArray['DefaultRuleDescription']
);
}
if (array_key_exists('MessageCount', $subscriptionDescriptionArray)) {
$subscriptionDescription->setMessageCount(
(string) $subscriptionDescriptionArray['MessageCount']
);
}
if (array_key_exists('MaxDeliveryCount', $subscriptionDescriptionArray)) {
$subscriptionDescription->setMaxDeliveryCount(
(string) $subscriptionDescriptionArray['MaxDeliveryCount']
);
}
if (array_key_exists(
'EnableBatchedOperations',
$subscriptionDescriptionArray
)
) {
$subscriptionDescription->setEnableBatchedOperations(
(bool) $subscriptionDescriptionArray['EnableBatchedOperations']
);
}
return $subscriptionDescription;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"subscriptionDescriptionXml",
")",
"{",
"$",
"subscriptionDescription",
"=",
"new",
"self",
"(",
")",
";",
"$",
"root",
"=",
"simplexml_load_string",
"(",
"$",
"subscriptionDescriptionXml",
")",
";",
"$",
"subs... | Creates a subscription description with specified XML string.
@param string $subscriptionDescriptionXml An XML based subscription
description
@return SubscriptionDescription | [
"Creates",
"a",
"subscription",
"description",
"with",
"specified",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/SubscriptionDescription.php#L122-L208 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ChannelEncoding.php | ChannelEncoding.fromArray | public function fromArray($options)
{
if (isset($options['AdMarkerSource'])) {
Validate::isString($options['AdMarkerSource'], 'options[AdMarkerSource]');
$this->_adMarkerSource = $options['AdMarkerSource'];
}
if (isset($options['IgnoreCea708ClosedCaptions'])) {
Validate::isString($options['IgnoreCea708ClosedCaptions'], 'options[IgnoreCea708ClosedCaptions]');
$this->_ignoreCea708ClosedCaptions = (bool) $options['IgnoreCea708ClosedCaptions'];
}
if (!empty($options['VideoStreams'])) {
Validate::isArray($options['VideoStreams'], 'options[VideoStreams]');
foreach ($options['VideoStreams'] as $videoStream) {
$this->_videoStreams[] = VideoStream::createFromOptions($videoStream);
}
}
if (!empty($options['AudioStreams'])) {
Validate::isArray($options['AudioStreams'], 'options[AudioStreams]');
foreach ($options['AudioStreams'] as $audioStream) {
$this->_audioStreams[] = AudioStream::createFromOptions($audioStream);
}
}
if (isset($options['SystemPreset'])) {
Validate::isString($options['SystemPreset'], 'options[SystemPreset]');
$this->_systemPreset = $options['SystemPreset'];
}
} | php | public function fromArray($options)
{
if (isset($options['AdMarkerSource'])) {
Validate::isString($options['AdMarkerSource'], 'options[AdMarkerSource]');
$this->_adMarkerSource = $options['AdMarkerSource'];
}
if (isset($options['IgnoreCea708ClosedCaptions'])) {
Validate::isString($options['IgnoreCea708ClosedCaptions'], 'options[IgnoreCea708ClosedCaptions]');
$this->_ignoreCea708ClosedCaptions = (bool) $options['IgnoreCea708ClosedCaptions'];
}
if (!empty($options['VideoStreams'])) {
Validate::isArray($options['VideoStreams'], 'options[VideoStreams]');
foreach ($options['VideoStreams'] as $videoStream) {
$this->_videoStreams[] = VideoStream::createFromOptions($videoStream);
}
}
if (!empty($options['AudioStreams'])) {
Validate::isArray($options['AudioStreams'], 'options[AudioStreams]');
foreach ($options['AudioStreams'] as $audioStream) {
$this->_audioStreams[] = AudioStream::createFromOptions($audioStream);
}
}
if (isset($options['SystemPreset'])) {
Validate::isString($options['SystemPreset'], 'options[SystemPreset]');
$this->_systemPreset = $options['SystemPreset'];
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'AdMarkerSource'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'AdMarkerSource'",
"]",
",",
"'options[AdMarker... | Fill Encoding from array.
@param array $options Array containing values for object properties | [
"Fill",
"Encoding",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ChannelEncoding.php#L109-L139 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/IngestManifest.php | IngestManifest.fromArray | public function fromArray(array $options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['State'])) {
Validate::isInteger($options['State'], 'options[State]');
$this->_state = $options['State'];
}
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['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['BlobStorageUriForUpload'])) {
Validate::isValidUri(
$options['BlobStorageUriForUpload'],
'options[BlobStorageUriForUpload]'
);
$this->_blobStorageUriForUpload = $options['BlobStorageUriForUpload'];
}
if (isset($options['Statistics'])) {
$this->_statistics = null;
if (is_array($options['Statistics'])) {
$this->_statistics = IngestManifestStatistics::createFromOptions(
$options['Statistics']
);
}
}
if (isset($options['StorageAccountName'])) {
Validate::isString(
$options['StorageAccountName'],
'options[StorageAccountName]'
);
$this->_storageAccountName = $options['StorageAccountName'];
}
} | php | public function fromArray(array $options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['State'])) {
Validate::isInteger($options['State'], 'options[State]');
$this->_state = $options['State'];
}
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['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['BlobStorageUriForUpload'])) {
Validate::isValidUri(
$options['BlobStorageUriForUpload'],
'options[BlobStorageUriForUpload]'
);
$this->_blobStorageUriForUpload = $options['BlobStorageUriForUpload'];
}
if (isset($options['Statistics'])) {
$this->_statistics = null;
if (is_array($options['Statistics'])) {
$this->_statistics = IngestManifestStatistics::createFromOptions(
$options['Statistics']
);
}
}
if (isset($options['StorageAccountName'])) {
Validate::isString(
$options['StorageAccountName'],
'options[StorageAccountName]'
);
$this->_storageAccountName = $options['StorageAccountName'];
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Id'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'Id'",
"]",
",",
"'options[Id]'",
")",
";",
... | Fill manifest from array.
@param array $options Array containing values for object properties | [
"Fill",
"manifest",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/IngestManifest.php#L142-L196 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/Content.php | Content.parseXml | public function parseXml($xmlString)
{
Validate::notNull($xmlString, 'xmlString');
Validate::isString($xmlString, 'xmlString');
$this->fromXml(simplexml_load_string($xmlString));
} | php | public function parseXml($xmlString)
{
Validate::notNull($xmlString, 'xmlString');
Validate::isString($xmlString, 'xmlString');
$this->fromXml(simplexml_load_string($xmlString));
} | [
"public",
"function",
"parseXml",
"(",
"$",
"xmlString",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"xmlString",
",",
"'xmlString'",
")",
";",
"Validate",
"::",
"isString",
"(",
"$",
"xmlString",
",",
"'xmlString'",
")",
";",
"$",
"this",
"->",
"fr... | Creates an ATOM CONTENT instance with specified xml string.
@param string $xmlString an XML based string of ATOM CONTENT | [
"Creates",
"an",
"ATOM",
"CONTENT",
"instance",
"with",
"specified",
"xml",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/Content.php#L82-L88 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/Content.php | Content.fromXml | public function fromXml(\SimpleXMLElement $contentXml)
{
Validate::notNull($contentXml, 'contentXml');
$attributes = $contentXml->attributes();
if (!empty($attributes['type'])) {
$this->type = (string) $attributes['type'];
}
$text = '';
/** @var \SimpleXMLElement $child */
foreach ($contentXml->children() as $child) {
$text .= $child->asXML();
}
$this->text = $text;
$this->xml = $contentXml;
} | php | public function fromXml(\SimpleXMLElement $contentXml)
{
Validate::notNull($contentXml, 'contentXml');
$attributes = $contentXml->attributes();
if (!empty($attributes['type'])) {
$this->type = (string) $attributes['type'];
}
$text = '';
/** @var \SimpleXMLElement $child */
foreach ($contentXml->children() as $child) {
$text .= $child->asXML();
}
$this->text = $text;
$this->xml = $contentXml;
} | [
"public",
"function",
"fromXml",
"(",
"\\",
"SimpleXMLElement",
"$",
"contentXml",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"contentXml",
",",
"'contentXml'",
")",
";",
"$",
"attributes",
"=",
"$",
"contentXml",
"->",
"attributes",
"(",
")",
";",
"... | Creates an ATOM CONTENT instance with specified simpleXML object.
@param \SimpleXMLElement $contentXml xml element of ATOM CONTENT | [
"Creates",
"an",
"ATOM",
"CONTENT",
"instance",
"with",
"specified",
"simpleXML",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/Content.php#L95-L114 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/Content.php | Content.writeInnerXml | public function writeInnerXml(\XMLWriter $xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
$xmlWriter->writeRaw($this->text);
} | php | public function writeInnerXml(\XMLWriter $xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
$xmlWriter->writeRaw($this->text);
} | [
"public",
"function",
"writeInnerXml",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"xmlWriter",
",",
"'xmlWriter'",
")",
";",
"$",
"xmlWriter",
"->",
"writeRaw",
"(",
"$",
"this",
"->",
"text",
")",
";",
"}"... | Writes an inner XML representing the content.
@param \XMLWriter $xmlWriter The XML writer | [
"Writes",
"an",
"inner",
"XML",
"representing",
"the",
"content",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/Content.php#L195-L199 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/TopicDescription.php | TopicDescription.create | public static function create($topicDescriptionXml)
{
$topicDescription = new self();
$root = simplexml_load_string($topicDescriptionXml);
$topicDescriptionArray = (array) $root;
if (array_key_exists('DefaultMessageToLive', $topicDescriptionArray)) {
$topicDescription->setDefaultMessageTimeToLive(
(string) $topicDescriptionArray['DefaultMessageToLive']
);
}
if (array_key_exists('MaxSizeInMegabytes', $topicDescriptionArray)) {
$topicDescription->setMaxSizeInMegabytes(
(int) $topicDescriptionArray['MaxSizeInMegabytes']
);
}
if (array_key_exists(
'RequiresDuplicateDetection',
$topicDescriptionArray
)
) {
$topicDescription->setRequiresDuplicateDetection(
(bool) $topicDescriptionArray['RequiresDuplicateDetection']
);
}
if (array_key_exists(
'DuplicateDetectionHistoryTimeWindow',
$topicDescriptionArray
)
) {
$topicDescription->setDuplicateDetectionHistoryTimeWindow(
(string) $topicDescriptionArray['DuplicateDetectionHistoryTimeWindow']
);
}
if (array_key_exists(
'EnableBatchedOperations',
$topicDescriptionArray
)) {
$topicDescription->setEnableBatchedOperations(
(bool) $topicDescriptionArray['EnableBatchedOperations']
);
}
return $topicDescription;
} | php | public static function create($topicDescriptionXml)
{
$topicDescription = new self();
$root = simplexml_load_string($topicDescriptionXml);
$topicDescriptionArray = (array) $root;
if (array_key_exists('DefaultMessageToLive', $topicDescriptionArray)) {
$topicDescription->setDefaultMessageTimeToLive(
(string) $topicDescriptionArray['DefaultMessageToLive']
);
}
if (array_key_exists('MaxSizeInMegabytes', $topicDescriptionArray)) {
$topicDescription->setMaxSizeInMegabytes(
(int) $topicDescriptionArray['MaxSizeInMegabytes']
);
}
if (array_key_exists(
'RequiresDuplicateDetection',
$topicDescriptionArray
)
) {
$topicDescription->setRequiresDuplicateDetection(
(bool) $topicDescriptionArray['RequiresDuplicateDetection']
);
}
if (array_key_exists(
'DuplicateDetectionHistoryTimeWindow',
$topicDescriptionArray
)
) {
$topicDescription->setDuplicateDetectionHistoryTimeWindow(
(string) $topicDescriptionArray['DuplicateDetectionHistoryTimeWindow']
);
}
if (array_key_exists(
'EnableBatchedOperations',
$topicDescriptionArray
)) {
$topicDescription->setEnableBatchedOperations(
(bool) $topicDescriptionArray['EnableBatchedOperations']
);
}
return $topicDescription;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"topicDescriptionXml",
")",
"{",
"$",
"topicDescription",
"=",
"new",
"self",
"(",
")",
";",
"$",
"root",
"=",
"simplexml_load_string",
"(",
"$",
"topicDescriptionXml",
")",
";",
"$",
"topicDescriptionArray",
... | Creates a topic description object with specified XML string.
@param string $topicDescriptionXml A XML based string describing
the topic
@return TopicDescription | [
"Creates",
"a",
"topic",
"description",
"object",
"with",
"specified",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/TopicDescription.php#L100-L148 | train |
Azure/azure-sdk-for-php | src/Common/ServicesBuilder.php | ServicesBuilder.createWrapService | protected function createWrapService($wrapEndpointUri)
{
$httpClient = $this->httpClient();
$wrapWrapper = new WrapRestProxy($httpClient, $wrapEndpointUri);
return $wrapWrapper;
} | php | protected function createWrapService($wrapEndpointUri)
{
$httpClient = $this->httpClient();
$wrapWrapper = new WrapRestProxy($httpClient, $wrapEndpointUri);
return $wrapWrapper;
} | [
"protected",
"function",
"createWrapService",
"(",
"$",
"wrapEndpointUri",
")",
"{",
"$",
"httpClient",
"=",
"$",
"this",
"->",
"httpClient",
"(",
")",
";",
"$",
"wrapWrapper",
"=",
"new",
"WrapRestProxy",
"(",
"$",
"httpClient",
",",
"$",
"wrapEndpointUri",
... | Builds a WRAP client.
@param string $wrapEndpointUri The WRAP endpoint uri
@return IWrap | [
"Builds",
"a",
"WRAP",
"client",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/ServicesBuilder.php#L168-L174 | train |
Azure/azure-sdk-for-php | src/Common/ServicesBuilder.php | ServicesBuilder.createServiceBusService | public function createServiceBusService($connectionString)
{
$settings = ServiceBusSettings::createFromConnectionString(
$connectionString
);
$httpClient = $this->httpClient();
$serializer = $this->serializer();
$serviceBusWrapper = new ServiceBusRestProxy(
$httpClient,
$settings->getServiceBusEndpointUri(),
$serializer
);
// Adding headers filter
$headers = [];
$headersFilter = new HeadersFilter($headers);
$serviceBusWrapper = $serviceBusWrapper->withFilter($headersFilter);
$filter = $settings->getFilter();
return $serviceBusWrapper->withFilter($filter);
} | php | public function createServiceBusService($connectionString)
{
$settings = ServiceBusSettings::createFromConnectionString(
$connectionString
);
$httpClient = $this->httpClient();
$serializer = $this->serializer();
$serviceBusWrapper = new ServiceBusRestProxy(
$httpClient,
$settings->getServiceBusEndpointUri(),
$serializer
);
// Adding headers filter
$headers = [];
$headersFilter = new HeadersFilter($headers);
$serviceBusWrapper = $serviceBusWrapper->withFilter($headersFilter);
$filter = $settings->getFilter();
return $serviceBusWrapper->withFilter($filter);
} | [
"public",
"function",
"createServiceBusService",
"(",
"$",
"connectionString",
")",
"{",
"$",
"settings",
"=",
"ServiceBusSettings",
"::",
"createFromConnectionString",
"(",
"$",
"connectionString",
")",
";",
"$",
"httpClient",
"=",
"$",
"this",
"->",
"httpClient",
... | Builds a Service Bus object.
@param string $connectionString The configuration connection string
@return IServiceBus | [
"Builds",
"a",
"Service",
"Bus",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/ServicesBuilder.php#L219-L242 | train |
Azure/azure-sdk-for-php | src/Common/ServicesBuilder.php | ServicesBuilder.createServiceManagementService | public function createServiceManagementService($connectionString)
{
$settings = ServiceManagementSettings::createFromConnectionString(
$connectionString
);
$certificatePath = $settings->getCertificatePath();
$httpClient = new HttpClient($certificatePath);
$serializer = $this->serializer();
$uri = Utilities::tryAddUrlScheme(
$settings->getEndpointUri(),
Resources::HTTPS_SCHEME
);
$serviceManagementWrapper = new ServiceManagementRestProxy(
$httpClient,
$settings->getSubscriptionId(),
$uri,
$serializer
);
// Adding headers filter
$headers = [];
$headers[Resources::X_MS_VERSION] = Resources::SM_API_LATEST_VERSION;
$headersFilter = new HeadersFilter($headers);
$serviceManagementWrapper = $serviceManagementWrapper->withFilter(
$headersFilter
);
return $serviceManagementWrapper;
} | php | public function createServiceManagementService($connectionString)
{
$settings = ServiceManagementSettings::createFromConnectionString(
$connectionString
);
$certificatePath = $settings->getCertificatePath();
$httpClient = new HttpClient($certificatePath);
$serializer = $this->serializer();
$uri = Utilities::tryAddUrlScheme(
$settings->getEndpointUri(),
Resources::HTTPS_SCHEME
);
$serviceManagementWrapper = new ServiceManagementRestProxy(
$httpClient,
$settings->getSubscriptionId(),
$uri,
$serializer
);
// Adding headers filter
$headers = [];
$headers[Resources::X_MS_VERSION] = Resources::SM_API_LATEST_VERSION;
$headersFilter = new HeadersFilter($headers);
$serviceManagementWrapper = $serviceManagementWrapper->withFilter(
$headersFilter
);
return $serviceManagementWrapper;
} | [
"public",
"function",
"createServiceManagementService",
"(",
"$",
"connectionString",
")",
"{",
"$",
"settings",
"=",
"ServiceManagementSettings",
"::",
"createFromConnectionString",
"(",
"$",
"connectionString",
")",
";",
"$",
"certificatePath",
"=",
"$",
"settings",
... | Builds a service management object.
@param string $connectionString The configuration connection string
@return IServiceManagement | [
"Builds",
"a",
"service",
"management",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/ServicesBuilder.php#L251-L283 | train |
Azure/azure-sdk-for-php | src/Common/ServicesBuilder.php | ServicesBuilder.createMediaServicesService | public function createMediaServicesService(MediaServicesSettings $settings)
{
$httpClient = new HttpClient();
$serializer = $this->serializer();
$uri = Utilities::tryAddUrlScheme(
$settings->getEndpointUri(),
Resources::HTTPS_SCHEME
);
$mediaServicesWrapper = new MediaServicesRestProxy(
$httpClient,
$uri,
Resources::EMPTY_STRING,
$serializer
);
// Adding headers filter
$xMSVersion = Resources::MEDIA_SERVICES_API_LATEST_VERSION;
$dataVersion = Resources::MEDIA_SERVICES_DATA_SERVICE_VERSION_VALUE;
$dataMaxVersion = Resources::MEDIA_SERVICES_MAX_DATA_SERVICE_VERSION_VALUE;
$accept = Resources::ACCEPT_HEADER_VALUE;
$contentType = Resources::ATOM_ENTRY_CONTENT_TYPE;
$headers = [
Resources::X_MS_VERSION => $xMSVersion,
Resources::DATA_SERVICE_VERSION => $dataVersion,
Resources::MAX_DATA_SERVICE_VERSION => $dataMaxVersion,
Resources::ACCEPT_HEADER => $accept,
Resources::CONTENT_TYPE => $contentType,
];
$headersFilter = new HeadersFilter($headers);
$mediaServicesWrapper = $mediaServicesWrapper->withFilter($headersFilter);
// Adding Azure Active Directory Authentication filter
$authenticationFilter = new AuthenticationFilter($settings->getTokenProvider());
$mediaServicesWrapper = $mediaServicesWrapper->withFilter(
$authenticationFilter
);
return $mediaServicesWrapper;
} | php | public function createMediaServicesService(MediaServicesSettings $settings)
{
$httpClient = new HttpClient();
$serializer = $this->serializer();
$uri = Utilities::tryAddUrlScheme(
$settings->getEndpointUri(),
Resources::HTTPS_SCHEME
);
$mediaServicesWrapper = new MediaServicesRestProxy(
$httpClient,
$uri,
Resources::EMPTY_STRING,
$serializer
);
// Adding headers filter
$xMSVersion = Resources::MEDIA_SERVICES_API_LATEST_VERSION;
$dataVersion = Resources::MEDIA_SERVICES_DATA_SERVICE_VERSION_VALUE;
$dataMaxVersion = Resources::MEDIA_SERVICES_MAX_DATA_SERVICE_VERSION_VALUE;
$accept = Resources::ACCEPT_HEADER_VALUE;
$contentType = Resources::ATOM_ENTRY_CONTENT_TYPE;
$headers = [
Resources::X_MS_VERSION => $xMSVersion,
Resources::DATA_SERVICE_VERSION => $dataVersion,
Resources::MAX_DATA_SERVICE_VERSION => $dataMaxVersion,
Resources::ACCEPT_HEADER => $accept,
Resources::CONTENT_TYPE => $contentType,
];
$headersFilter = new HeadersFilter($headers);
$mediaServicesWrapper = $mediaServicesWrapper->withFilter($headersFilter);
// Adding Azure Active Directory Authentication filter
$authenticationFilter = new AuthenticationFilter($settings->getTokenProvider());
$mediaServicesWrapper = $mediaServicesWrapper->withFilter(
$authenticationFilter
);
return $mediaServicesWrapper;
} | [
"public",
"function",
"createMediaServicesService",
"(",
"MediaServicesSettings",
"$",
"settings",
")",
"{",
"$",
"httpClient",
"=",
"new",
"HttpClient",
"(",
")",
";",
"$",
"serializer",
"=",
"$",
"this",
"->",
"serializer",
"(",
")",
";",
"$",
"uri",
"=",
... | Builds a media services object.
@param MediaServicesSettings $settings The media services configuration settings
@return MediaServicesRestProxy | [
"Builds",
"a",
"media",
"services",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/ServicesBuilder.php#L292-L333 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/RuntimeVersionProtocolClient.php | RuntimeVersionProtocolClient.getVersionMap | public function getVersionMap($connectionPath)
{
$versions = [];
$input = $this->_inputChannel->getInputStream($connectionPath);
$contents = stream_get_contents($input);
$discoveryInfo = Utilities::unserialize($contents);
$endpoints = $discoveryInfo['RuntimeServerEndpoints']
['RuntimeServerEndpoint'];
if (array_key_exists('@attributes', $endpoints)) {
$endpoints = [];
$endpoints[] = $discoveryInfo
['RuntimeServerEndpoints']['RuntimeServerEndpoint'];
}
foreach ($endpoints as $endpoint) {
$versions[$endpoint['@attributes']['version']] = $endpoint
['@attributes']['path'];
}
return $versions;
} | php | public function getVersionMap($connectionPath)
{
$versions = [];
$input = $this->_inputChannel->getInputStream($connectionPath);
$contents = stream_get_contents($input);
$discoveryInfo = Utilities::unserialize($contents);
$endpoints = $discoveryInfo['RuntimeServerEndpoints']
['RuntimeServerEndpoint'];
if (array_key_exists('@attributes', $endpoints)) {
$endpoints = [];
$endpoints[] = $discoveryInfo
['RuntimeServerEndpoints']['RuntimeServerEndpoint'];
}
foreach ($endpoints as $endpoint) {
$versions[$endpoint['@attributes']['version']] = $endpoint
['@attributes']['path'];
}
return $versions;
} | [
"public",
"function",
"getVersionMap",
"(",
"$",
"connectionPath",
")",
"{",
"$",
"versions",
"=",
"[",
"]",
";",
"$",
"input",
"=",
"$",
"this",
"->",
"_inputChannel",
"->",
"getInputStream",
"(",
"$",
"connectionPath",
")",
";",
"$",
"contents",
"=",
"... | Gets the version map.
@param string $connectionPath The connection path
@return array | [
"Gets",
"the",
"version",
"map",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/RuntimeVersionProtocolClient.php#L69-L93 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/Role.php | Role.create | public static function create($parsed)
{
$role = new self();
$roleName = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ROLE_NAME
);
$osVersion = Utilities::tryGetValue(
$parsed,
Resources::XTAG_OS_VERSION
);
$role->setOsVersion($osVersion);
$role->setRoleName($roleName);
return $role;
} | php | public static function create($parsed)
{
$role = new self();
$roleName = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ROLE_NAME
);
$osVersion = Utilities::tryGetValue(
$parsed,
Resources::XTAG_OS_VERSION
);
$role->setOsVersion($osVersion);
$role->setRoleName($roleName);
return $role;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"role",
"=",
"new",
"self",
"(",
")",
";",
"$",
"roleName",
"=",
"Utilities",
"::",
"tryGetValue",
"(",
"$",
"parsed",
",",
"Resources",
"::",
"XTAG_ROLE_NAME",
")",
";",
"$",... | Creates a new Role from parsed response body.
@param array $parsed The parsed response body in array representation
@return Role | [
"Creates",
"a",
"new",
"Role",
"from",
"parsed",
"response",
"body",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/Role.php#L63-L79 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Internal/Service.php | Service.toArray | protected function toArray()
{
$arr = [];
$arr[Resources::XTAG_NAMESPACE] = [
Resources::WA_XML_NAMESPACE => null,
];
Utilities::addIfNotEmpty(Resources::XTAG_LABEL, $this->_label, $arr);
Utilities::addIfNotEmpty(
Resources::XTAG_DESCRIPTION,
$this->_description,
$arr
);
Utilities::addIfNotEmpty(
Resources::XTAG_LOCATION,
$this->_location,
$arr
);
return $arr;
} | php | protected function toArray()
{
$arr = [];
$arr[Resources::XTAG_NAMESPACE] = [
Resources::WA_XML_NAMESPACE => null,
];
Utilities::addIfNotEmpty(Resources::XTAG_LABEL, $this->_label, $arr);
Utilities::addIfNotEmpty(
Resources::XTAG_DESCRIPTION,
$this->_description,
$arr
);
Utilities::addIfNotEmpty(
Resources::XTAG_LOCATION,
$this->_location,
$arr
);
return $arr;
} | [
"protected",
"function",
"toArray",
"(",
")",
"{",
"$",
"arr",
"=",
"[",
"]",
";",
"$",
"arr",
"[",
"Resources",
"::",
"XTAG_NAMESPACE",
"]",
"=",
"[",
"Resources",
"::",
"WA_XML_NAMESPACE",
"=>",
"null",
",",
"]",
";",
"Utilities",
"::",
"addIfNotEmpty"... | Converts the current object into array representation.
@return array | [
"Converts",
"the",
"current",
"object",
"into",
"array",
"representation",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Internal/Service.php#L215-L235 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Internal/Service.php | Service.serialize | public function serialize(ISerializer $serializer)
{
if ($serializer instanceof XmlSerializer) {
$arr = $this->toArray();
return $serializer->serialize(
$arr,
$this->_serializationProperties
);
} else {
throw new \InvalidArgumentException(Resources::UNKNOWN_SRILZER_MSG);
}
} | php | public function serialize(ISerializer $serializer)
{
if ($serializer instanceof XmlSerializer) {
$arr = $this->toArray();
return $serializer->serialize(
$arr,
$this->_serializationProperties
);
} else {
throw new \InvalidArgumentException(Resources::UNKNOWN_SRILZER_MSG);
}
} | [
"public",
"function",
"serialize",
"(",
"ISerializer",
"$",
"serializer",
")",
"{",
"if",
"(",
"$",
"serializer",
"instanceof",
"XmlSerializer",
")",
"{",
"$",
"arr",
"=",
"$",
"this",
"->",
"toArray",
"(",
")",
";",
"return",
"$",
"serializer",
"->",
"s... | Serializes the current object.
@param ISerializer $serializer The serializer
@return string
@throws \InvalidArgumentException | [
"Serializes",
"the",
"current",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Internal/Service.php#L246-L258 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Serialization/JsonSerializer.php | JsonSerializer.objectSerialize | public static function objectSerialize($targetObject, $rootName)
{
Validate::notNull($targetObject, 'targetObject');
Validate::isString($rootName, 'rootName');
$container = new \stdClass();
$container->$rootName = $targetObject;
return json_encode($container);
} | php | public static function objectSerialize($targetObject, $rootName)
{
Validate::notNull($targetObject, 'targetObject');
Validate::isString($rootName, 'rootName');
$container = new \stdClass();
$container->$rootName = $targetObject;
return json_encode($container);
} | [
"public",
"static",
"function",
"objectSerialize",
"(",
"$",
"targetObject",
",",
"$",
"rootName",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"targetObject",
",",
"'targetObject'",
")",
";",
"Validate",
"::",
"isString",
"(",
"$",
"rootName",
",",
"'ro... | Serialize an object with specified root element name.
@param object $targetObject The target object
@param string $rootName The name of the root element
@return string | [
"Serialize",
"an",
"object",
"with",
"specified",
"root",
"element",
"name",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Serialization/JsonSerializer.php#L53-L63 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Serialization/JsonSerializer.php | JsonSerializer.unserialize | public function unserialize($serialized)
{
Validate::isString($serialized, 'serialized');
$json = json_decode($serialized);
if ($json && !is_array($json)) {
return get_object_vars($json);
} else {
return $json;
}
} | php | public function unserialize($serialized)
{
Validate::isString($serialized, 'serialized');
$json = json_decode($serialized);
if ($json && !is_array($json)) {
return get_object_vars($json);
} else {
return $json;
}
} | [
"public",
"function",
"unserialize",
"(",
"$",
"serialized",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"serialized",
",",
"'serialized'",
")",
";",
"$",
"json",
"=",
"json_decode",
"(",
"$",
"serialized",
")",
";",
"if",
"(",
"$",
"json",
"&&",
... | Unserializes given serialized string to array.
@param string $serialized The serialized object in string representation
@return array | [
"Unserializes",
"given",
"serialized",
"string",
"to",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Serialization/JsonSerializer.php#L86-L96 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/ListHostedServicesResult.php | ListHostedServicesResult.create | public static function create($parsed)
{
$result = new self();
$result->_hostedServices = [];
$rowHostedServices = Utilities::tryGetArray(
Resources::XTAG_HOSTED_SERVICE,
$parsed
);
foreach ($rowHostedServices as $rowHostedService) {
$properties = Utilities::tryGetArray(
Resources::XTAG_HOSTED_SERVICE_PROPERTIES,
$rowHostedService
);
$hostedService = new HostedService(
$rowHostedService,
$properties
);
$result->_hostedServices[] = $hostedService;
}
return $result;
} | php | public static function create($parsed)
{
$result = new self();
$result->_hostedServices = [];
$rowHostedServices = Utilities::tryGetArray(
Resources::XTAG_HOSTED_SERVICE,
$parsed
);
foreach ($rowHostedServices as $rowHostedService) {
$properties = Utilities::tryGetArray(
Resources::XTAG_HOSTED_SERVICE_PROPERTIES,
$rowHostedService
);
$hostedService = new HostedService(
$rowHostedService,
$properties
);
$result->_hostedServices[] = $hostedService;
}
return $result;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"result",
"=",
"new",
"self",
"(",
")",
";",
"$",
"result",
"->",
"_hostedServices",
"=",
"[",
"]",
";",
"$",
"rowHostedServices",
"=",
"Utilities",
"::",
"tryGetArray",
"(",
... | Creates new ListHostedServicesResult from parsed response body.
@param array $parsed The parsed response body
@return ListHostedServicesResult | [
"Creates",
"new",
"ListHostedServicesResult",
"from",
"parsed",
"response",
"body",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/ListHostedServicesResult.php#L58-L80 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/CreateServiceOptions.php | CreateServiceOptions.setLocation | public function setLocation($location)
{
Validate::isString($location, 'location');
Validate::notNullOrEmpty($location, 'location');
$this->_location = $location;
} | php | public function setLocation($location)
{
Validate::isString($location, 'location');
Validate::notNullOrEmpty($location, 'location');
$this->_location = $location;
} | [
"public",
"function",
"setLocation",
"(",
"$",
"location",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"location",
",",
"'location'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"location",
",",
"'location'",
")",
";",
"$",
"this",
"->",
... | Sets the location.
@param string $location The location | [
"Sets",
"the",
"location",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/CreateServiceOptions.php#L75-L81 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/CreateServiceOptions.php | CreateServiceOptions.setAffinityGroup | public function setAffinityGroup($affinityGroup)
{
Validate::isString($affinityGroup, 'affinityGroup');
Validate::notNullOrEmpty($affinityGroup, 'affinityGroup');
$this->_affinityGroup = $affinityGroup;
} | php | public function setAffinityGroup($affinityGroup)
{
Validate::isString($affinityGroup, 'affinityGroup');
Validate::notNullOrEmpty($affinityGroup, 'affinityGroup');
$this->_affinityGroup = $affinityGroup;
} | [
"public",
"function",
"setAffinityGroup",
"(",
"$",
"affinityGroup",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"affinityGroup",
",",
"'affinityGroup'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"affinityGroup",
",",
"'affinityGroup'",
")",
... | Sets the affinityGroup.
@param string $affinityGroup The affinityGroup | [
"Sets",
"the",
"affinityGroup",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/CreateServiceOptions.php#L98-L104 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/StorageAccount.php | StorageAccount.fromArray | public function fromArray(array $options)
{
if (isset($options['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['IsDefault'])) {
Validate::isBoolean($options['IsDefault'], 'options[IsDefault]');
$this->_isDefault = $options['IsDefault'];
}
} | php | public function fromArray(array $options)
{
if (isset($options['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['IsDefault'])) {
Validate::isBoolean($options['IsDefault'], 'options[IsDefault]');
$this->_isDefault = $options['IsDefault'];
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Name'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'Name'",
"]",
",",
"'options[Name]'",
")",
... | Fill storage account from array.
@param array $options Array containing values for object properties | [
"Fill",
"storage",
"account",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/StorageAccount.php#L86-L97 | train |
Azure/azure-sdk-for-php | src/MediaServices/Templates/TokenRestrictionTemplateSerializer.php | TokenRestrictionTemplateSerializer.deserialize | public static function deserialize($template)
{
$xml = simplexml_load_string($template);
$result = new TokenRestrictionTemplate();
// Validation
if ($xml->getName() !== 'TokenRestrictionTemplate') {
throw new \RuntimeException("This is not a TokenRestrictionTemplate, it is a '{$xml->getName()}'");
}
if (!isset($xml->Issuer)) {
throw new \RuntimeException("The TokenRestrictionTemplate must contains an 'Issuer' element");
}
if (!isset($xml->Audience)) {
throw new \RuntimeException("The TokenRestrictionTemplate must contains an 'Audience' element");
}
if (!isset($xml->PrimaryVerificationKey) &&
!isset($xml->OpenIdConnectDiscoveryDocument)) {
throw new \RuntimeException('Both PrimaryVerificationKey and OpenIdConnectDiscoveryDocument are undefined');
}
// decoding
if (isset($xml->AlternateVerificationKeys)) {
$result->setAlternateVerificationKeys(
self::deserializeAlternateVerificationKeys($xml->AlternateVerificationKeys)
);
}
$result->setAudience((string) $xml->Audience);
$result->setIssuer((string) $xml->Issuer);
if (isset($xml->PrimaryVerificationKey)) {
$result->setPrimaryVerificationKey(self::deserializeTokenVerificationKey($xml->PrimaryVerificationKey));
}
if (isset($xml->RequiredClaims)) {
$result->setRequiredClaims(self::deserializeRequiredClaims($xml->RequiredClaims));
}
if (isset($xml->TokenType)) {
$result->setTokenType((string) $xml->TokenType);
}
if (isset($xml->OpenIdConnectDiscoveryDocument)) {
$result->setOpenIdConnectDiscoveryDocument(
self::deserializeOpenIdConnectDiscoveryDocument($xml->OpenIdConnectDiscoveryDocument)
);
}
return $result;
} | php | public static function deserialize($template)
{
$xml = simplexml_load_string($template);
$result = new TokenRestrictionTemplate();
// Validation
if ($xml->getName() !== 'TokenRestrictionTemplate') {
throw new \RuntimeException("This is not a TokenRestrictionTemplate, it is a '{$xml->getName()}'");
}
if (!isset($xml->Issuer)) {
throw new \RuntimeException("The TokenRestrictionTemplate must contains an 'Issuer' element");
}
if (!isset($xml->Audience)) {
throw new \RuntimeException("The TokenRestrictionTemplate must contains an 'Audience' element");
}
if (!isset($xml->PrimaryVerificationKey) &&
!isset($xml->OpenIdConnectDiscoveryDocument)) {
throw new \RuntimeException('Both PrimaryVerificationKey and OpenIdConnectDiscoveryDocument are undefined');
}
// decoding
if (isset($xml->AlternateVerificationKeys)) {
$result->setAlternateVerificationKeys(
self::deserializeAlternateVerificationKeys($xml->AlternateVerificationKeys)
);
}
$result->setAudience((string) $xml->Audience);
$result->setIssuer((string) $xml->Issuer);
if (isset($xml->PrimaryVerificationKey)) {
$result->setPrimaryVerificationKey(self::deserializeTokenVerificationKey($xml->PrimaryVerificationKey));
}
if (isset($xml->RequiredClaims)) {
$result->setRequiredClaims(self::deserializeRequiredClaims($xml->RequiredClaims));
}
if (isset($xml->TokenType)) {
$result->setTokenType((string) $xml->TokenType);
}
if (isset($xml->OpenIdConnectDiscoveryDocument)) {
$result->setOpenIdConnectDiscoveryDocument(
self::deserializeOpenIdConnectDiscoveryDocument($xml->OpenIdConnectDiscoveryDocument)
);
}
return $result;
} | [
"public",
"static",
"function",
"deserialize",
"(",
"$",
"template",
")",
"{",
"$",
"xml",
"=",
"simplexml_load_string",
"(",
"$",
"template",
")",
";",
"$",
"result",
"=",
"new",
"TokenRestrictionTemplate",
"(",
")",
";",
"// Validation",
"if",
"(",
"$",
... | Deserialize a TokenRestrictionTemplate xml into a TokenRestrictionTemplate object.
@param string $template Array containing values for object properties
@return TokenRestrictionTemplate | [
"Deserialize",
"a",
"TokenRestrictionTemplate",
"xml",
"into",
"a",
"TokenRestrictionTemplate",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Templates/TokenRestrictionTemplateSerializer.php#L54-L103 | train |
Azure/azure-sdk-for-php | src/MediaServices/Templates/TokenRestrictionTemplateSerializer.php | TokenRestrictionTemplateSerializer.serialize | public static function serialize($tokenRestriction)
{
if (!$tokenRestriction->getPrimaryVerificationKey() &&
($tokenRestriction->getOpenIdConnectDiscoveryDocument() == null ||
!$tokenRestriction->getOpenIdConnectDiscoveryDocument()->getOpenIdDiscoveryUri())) {
throw new \RuntimeException('Both PrimaryVerificationKey and OpenIdConnectDiscoveryDocument are null');
}
if (!$tokenRestriction->getAudience()) {
throw new \RuntimeException('TokenRestrictionTemplate Serialize: Audience is required');
}
if (!$tokenRestriction->getIssuer()) {
throw new \RuntimeException('TokenRestrictionTemplate Serialize: Issuer is required');
}
$writer = new \XMLWriter();
$writer->openMemory();
$writer->startElementNS(null, 'TokenRestrictionTemplate', Resources::TRT_XML_NAMESPACE);
$writer->writeAttributeNS('xmlns', 'i', null, Resources::XSI_XML_NAMESPACE);
if ($tokenRestriction->getAlternateVerificationKeys()) {
self::serializeAlternateVerificationKeys($writer, $tokenRestriction->getAlternateVerificationKeys());
}
$writer->writeElement('Audience', $tokenRestriction->getAudience());
$writer->writeElement('Issuer', $tokenRestriction->getIssuer());
if ($tokenRestriction->getPrimaryVerificationKey()) {
$writer->startElement('PrimaryVerificationKey');
self::serializeTokenVerificationKey($writer, $tokenRestriction->getPrimaryVerificationKey());
$writer->endElement();
}
if ($tokenRestriction->getRequiredClaims()) {
self::serializeRequiredClaims($writer, $tokenRestriction->getRequiredClaims());
}
if ($tokenRestriction->getTokenType()) {
$writer->writeElement('TokenType', $tokenRestriction->getTokenType());
}
if ($tokenRestriction->getOpenIdConnectDiscoveryDocument()) {
self::serializeOpenIdConnectDiscoveryDocument(
$writer, $tokenRestriction->getOpenIdConnectDiscoveryDocument()
);
}
$writer->endElement();
return $writer->outputMemory();
} | php | public static function serialize($tokenRestriction)
{
if (!$tokenRestriction->getPrimaryVerificationKey() &&
($tokenRestriction->getOpenIdConnectDiscoveryDocument() == null ||
!$tokenRestriction->getOpenIdConnectDiscoveryDocument()->getOpenIdDiscoveryUri())) {
throw new \RuntimeException('Both PrimaryVerificationKey and OpenIdConnectDiscoveryDocument are null');
}
if (!$tokenRestriction->getAudience()) {
throw new \RuntimeException('TokenRestrictionTemplate Serialize: Audience is required');
}
if (!$tokenRestriction->getIssuer()) {
throw new \RuntimeException('TokenRestrictionTemplate Serialize: Issuer is required');
}
$writer = new \XMLWriter();
$writer->openMemory();
$writer->startElementNS(null, 'TokenRestrictionTemplate', Resources::TRT_XML_NAMESPACE);
$writer->writeAttributeNS('xmlns', 'i', null, Resources::XSI_XML_NAMESPACE);
if ($tokenRestriction->getAlternateVerificationKeys()) {
self::serializeAlternateVerificationKeys($writer, $tokenRestriction->getAlternateVerificationKeys());
}
$writer->writeElement('Audience', $tokenRestriction->getAudience());
$writer->writeElement('Issuer', $tokenRestriction->getIssuer());
if ($tokenRestriction->getPrimaryVerificationKey()) {
$writer->startElement('PrimaryVerificationKey');
self::serializeTokenVerificationKey($writer, $tokenRestriction->getPrimaryVerificationKey());
$writer->endElement();
}
if ($tokenRestriction->getRequiredClaims()) {
self::serializeRequiredClaims($writer, $tokenRestriction->getRequiredClaims());
}
if ($tokenRestriction->getTokenType()) {
$writer->writeElement('TokenType', $tokenRestriction->getTokenType());
}
if ($tokenRestriction->getOpenIdConnectDiscoveryDocument()) {
self::serializeOpenIdConnectDiscoveryDocument(
$writer, $tokenRestriction->getOpenIdConnectDiscoveryDocument()
);
}
$writer->endElement();
return $writer->outputMemory();
} | [
"public",
"static",
"function",
"serialize",
"(",
"$",
"tokenRestriction",
")",
"{",
"if",
"(",
"!",
"$",
"tokenRestriction",
"->",
"getPrimaryVerificationKey",
"(",
")",
"&&",
"(",
"$",
"tokenRestriction",
"->",
"getOpenIdConnectDiscoveryDocument",
"(",
")",
"=="... | Serialize a TokenRestrictionTemplate object into a TokenRestrictionTemplate XML.
@param TokenRestrictionTemplate $tokenRestriction
@return string The TokenRestrictionTemplate XML | [
"Serialize",
"a",
"TokenRestrictionTemplate",
"object",
"into",
"a",
"TokenRestrictionTemplate",
"XML",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Templates/TokenRestrictionTemplateSerializer.php#L112-L164 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/IngestManifestFile.php | IngestManifestFile.createFromOptions | public static function createFromOptions(array $options)
{
Validate::notNull($options['Name'], 'options[Name]');
Validate::notNull(
$options['ParentIngestManifestId'],
'options[ParentIngestManifestId]'
);
Validate::notNull(
$options['ParentIngestManifestAssetId'],
'options[ParentIngestManifestAssetId]'
);
$file = new self(
$options['Name'],
$options['ParentIngestManifestId'],
$options['ParentIngestManifestAssetId']
);
$file->fromArray($options);
return $file;
} | php | public static function createFromOptions(array $options)
{
Validate::notNull($options['Name'], 'options[Name]');
Validate::notNull(
$options['ParentIngestManifestId'],
'options[ParentIngestManifestId]'
);
Validate::notNull(
$options['ParentIngestManifestAssetId'],
'options[ParentIngestManifestAssetId]'
);
$file = new self(
$options['Name'],
$options['ParentIngestManifestId'],
$options['ParentIngestManifestAssetId']
);
$file->fromArray($options);
return $file;
} | [
"public",
"static",
"function",
"createFromOptions",
"(",
"array",
"$",
"options",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"[",
"'Name'",
"]",
",",
"'options[Name]'",
")",
";",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"[",
"'Pa... | Create manifest file from array.
@param array $options Array containing values for object properties
@return IngestManifestFile | [
"Create",
"manifest",
"file",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/IngestManifestFile.php#L178-L199 | train |
Azure/azure-sdk-for-php | examples/Client/CloudSubscription.php | CloudSubscription.storageServiceExists | public function storageServiceExists($name)
{
$result = $this->_proxy->listStorageServices();
$storageServices = $result->getStorageServices();
foreach ($storageServices as $storageService) {
if ($storageService->getName() == $name) {
return true;
}
}
return false;
} | php | public function storageServiceExists($name)
{
$result = $this->_proxy->listStorageServices();
$storageServices = $result->getStorageServices();
foreach ($storageServices as $storageService) {
if ($storageService->getName() == $name) {
return true;
}
}
return false;
} | [
"public",
"function",
"storageServiceExists",
"(",
"$",
"name",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"_proxy",
"->",
"listStorageServices",
"(",
")",
";",
"$",
"storageServices",
"=",
"$",
"result",
"->",
"getStorageServices",
"(",
")",
";",
"f... | Checks if a storage service exists or not.
@param string $name Storage service name.
@return bool | [
"Checks",
"if",
"a",
"storage",
"service",
"exists",
"or",
"not",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/examples/Client/CloudSubscription.php#L76-L88 | train |
Azure/azure-sdk-for-php | examples/Client/CloudSubscription.php | CloudSubscription.createStorageService | public function createStorageService(
$name,
$execType = self:: SYNCHRONOUS,
$location = 'East US'
) {
$cloudStorageService = null;
if (!$this->storageServiceExists($name)) {
$options = new CreateServiceOptions();
$options->setLocation($location);
$result = $this->_proxy->createStorageService(
$name,
base64_encode($name),
$options
);
if ($execType == self::SYNCHRONOUS) {
$this->_blockUntilAsyncFinish($result);
}
$newStorageService = true;
}
$keys = $this->_proxy->getStorageServiceKeys($name);
$properties = $this->_proxy->getStorageServiceProperties($name);
$cloudStorageService = new CloudStorageService(
$name,
$keys->getPrimary(),
$properties->getStorageService()->getBlobEndpointUri(),
$properties->getStorageService()->getQueueEndpointUri(),
$properties->getStorageService()->getTableEndpointUri()
);
return $cloudStorageService;
} | php | public function createStorageService(
$name,
$execType = self:: SYNCHRONOUS,
$location = 'East US'
) {
$cloudStorageService = null;
if (!$this->storageServiceExists($name)) {
$options = new CreateServiceOptions();
$options->setLocation($location);
$result = $this->_proxy->createStorageService(
$name,
base64_encode($name),
$options
);
if ($execType == self::SYNCHRONOUS) {
$this->_blockUntilAsyncFinish($result);
}
$newStorageService = true;
}
$keys = $this->_proxy->getStorageServiceKeys($name);
$properties = $this->_proxy->getStorageServiceProperties($name);
$cloudStorageService = new CloudStorageService(
$name,
$keys->getPrimary(),
$properties->getStorageService()->getBlobEndpointUri(),
$properties->getStorageService()->getQueueEndpointUri(),
$properties->getStorageService()->getTableEndpointUri()
);
return $cloudStorageService;
} | [
"public",
"function",
"createStorageService",
"(",
"$",
"name",
",",
"$",
"execType",
"=",
"self",
"::",
"SYNCHRONOUS",
",",
"$",
"location",
"=",
"'East US'",
")",
"{",
"$",
"cloudStorageService",
"=",
"null",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"st... | Creates a storage service if it does not exist and waits until it is created.
@param string $name The storage service name.
@param string $execType The execution type for this call.
@param Location $location The storage service location. By default East US.
@return CloudStorageService | [
"Creates",
"a",
"storage",
"service",
"if",
"it",
"does",
"not",
"exist",
"and",
"waits",
"until",
"it",
"is",
"created",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/examples/Client/CloudSubscription.php#L99-L133 | train |
Azure/azure-sdk-for-php | examples/Client/CloudSubscription.php | CloudSubscription._blockUntilAsyncFinish | private function _blockUntilAsyncFinish(AsynchronousOperationResult $requestInfo)
{
$status = null;
do {
sleep(5);
$result = $this->_proxy->getOperationStatus($requestInfo);
$status = $result->getStatus();
} while (OperationStatus::IN_PROGRESS == $status);
if (OperationStatus::SUCCEEDED != $status) {
throw $result->getError();
}
} | php | private function _blockUntilAsyncFinish(AsynchronousOperationResult $requestInfo)
{
$status = null;
do {
sleep(5);
$result = $this->_proxy->getOperationStatus($requestInfo);
$status = $result->getStatus();
} while (OperationStatus::IN_PROGRESS == $status);
if (OperationStatus::SUCCEEDED != $status) {
throw $result->getError();
}
} | [
"private",
"function",
"_blockUntilAsyncFinish",
"(",
"AsynchronousOperationResult",
"$",
"requestInfo",
")",
"{",
"$",
"status",
"=",
"null",
";",
"do",
"{",
"sleep",
"(",
"5",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"_proxy",
"->",
"getOperationSt... | Blocks asynchronous operation until it succeeds. Throws exception if the
operation failed.
@param AsynchronousOperationResult $requestInfo The asynchronous operation request AsynchronousOperationResult.
@throws \WindowsAzure\Common\ServiceException | [
"Blocks",
"asynchronous",
"operation",
"until",
"it",
"succeeds",
".",
"Throws",
"exception",
"if",
"the",
"operation",
"failed",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/examples/Client/CloudSubscription.php#L143-L156 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/TaskTemplate.php | TaskTemplate.createFromOptions | public static function createFromOptions(array $options)
{
Validate::notNull(
$options['NumberofInputAssets'],
'options[NumberofInputAssets]'
);
Validate::notNull(
$options['NumberofOutputAssets'],
'options[NumberofOutputAssets]'
);
$taskTemplate = new self(
$options['NumberofInputAssets'],
$options['NumberofOutputAssets']
);
$taskTemplate->fromArray($options);
return $taskTemplate;
} | php | public static function createFromOptions(array $options)
{
Validate::notNull(
$options['NumberofInputAssets'],
'options[NumberofInputAssets]'
);
Validate::notNull(
$options['NumberofOutputAssets'],
'options[NumberofOutputAssets]'
);
$taskTemplate = new self(
$options['NumberofInputAssets'],
$options['NumberofOutputAssets']
);
$taskTemplate->fromArray($options);
return $taskTemplate;
} | [
"public",
"static",
"function",
"createFromOptions",
"(",
"array",
"$",
"options",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"[",
"'NumberofInputAssets'",
"]",
",",
"'options[NumberofInputAssets]'",
")",
";",
"Validate",
"::",
"notNull",
"(",
"... | Create task template from array.
@param array $options Array containing values for object properties
@return TaskTemplate | [
"Create",
"task",
"template",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/TaskTemplate.php#L151-L169 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/ChangeDeploymentConfigurationOptions.php | ChangeDeploymentConfigurationOptions.setMode | public function setMode($mode)
{
Validate::isString($mode, 'mode');
Validate::isTrue(Mode::isValid($mode), Resources::INVALID_CHANGE_MODE_MSG);
$this->_mode = $mode;
} | php | public function setMode($mode)
{
Validate::isString($mode, 'mode');
Validate::isTrue(Mode::isValid($mode), Resources::INVALID_CHANGE_MODE_MSG);
$this->_mode = $mode;
} | [
"public",
"function",
"setMode",
"(",
"$",
"mode",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"mode",
",",
"'mode'",
")",
";",
"Validate",
"::",
"isTrue",
"(",
"Mode",
"::",
"isValid",
"(",
"$",
"mode",
")",
",",
"Resources",
"::",
"INVALID_CHAN... | Sets mode.
@param string $mode The change mode | [
"Sets",
"mode",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/ChangeDeploymentConfigurationOptions.php#L117-L123 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php | XmlRoleEnvironmentDataDeserializer.deserialize | public function deserialize($inputChannel)
{
$document = stream_get_contents($inputChannel);
$environmentInfo = Utilities::unserialize($document);
$configurationSettings = $this->_translateConfigurationSettings(
$environmentInfo
);
$localResources = $this->_translateLocalResources($environmentInfo);
$currentInstance = $this->_translateCurrentInstance($environmentInfo);
$roles = $this->_translateRoles(
$environmentInfo,
$currentInstance,
$environmentInfo['CurrentInstance']['@attributes']['roleName']
);
return new RoleEnvironmentData(
$environmentInfo['Deployment']['@attributes']['id'],
$configurationSettings,
$localResources,
$currentInstance,
$roles,
($environmentInfo['Deployment']['@attributes']['emulated'] == 'true')
);
} | php | public function deserialize($inputChannel)
{
$document = stream_get_contents($inputChannel);
$environmentInfo = Utilities::unserialize($document);
$configurationSettings = $this->_translateConfigurationSettings(
$environmentInfo
);
$localResources = $this->_translateLocalResources($environmentInfo);
$currentInstance = $this->_translateCurrentInstance($environmentInfo);
$roles = $this->_translateRoles(
$environmentInfo,
$currentInstance,
$environmentInfo['CurrentInstance']['@attributes']['roleName']
);
return new RoleEnvironmentData(
$environmentInfo['Deployment']['@attributes']['id'],
$configurationSettings,
$localResources,
$currentInstance,
$roles,
($environmentInfo['Deployment']['@attributes']['emulated'] == 'true')
);
} | [
"public",
"function",
"deserialize",
"(",
"$",
"inputChannel",
")",
"{",
"$",
"document",
"=",
"stream_get_contents",
"(",
"$",
"inputChannel",
")",
";",
"$",
"environmentInfo",
"=",
"Utilities",
"::",
"unserialize",
"(",
"$",
"document",
")",
";",
"$",
"con... | Deserializes the role environment data.
@param resource $inputChannel The input Channel
@return RoleEnvironmentData | [
"Deserializes",
"the",
"role",
"environment",
"data",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php#L52-L78 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php | XmlRoleEnvironmentDataDeserializer._translateConfigurationSettings | private function _translateConfigurationSettings($environmentInfo)
{
$configurationSettings = [];
$settingsInfo = Utilities::tryGetKeysChainValue(
$environmentInfo,
'CurrentInstance',
'ConfigurationSettings',
'ConfigurationSetting'
);
if (!is_null($settingsInfo)) {
if (array_key_exists('@attributes', $settingsInfo)) {
$settingsInfo = [0 => $settingsInfo];
}
foreach ($settingsInfo as $settingInfo) {
$configurationSettings
[$settingInfo['@attributes']['name']] = $settingInfo
['@attributes']['value'];
}
}
return $configurationSettings;
} | php | private function _translateConfigurationSettings($environmentInfo)
{
$configurationSettings = [];
$settingsInfo = Utilities::tryGetKeysChainValue(
$environmentInfo,
'CurrentInstance',
'ConfigurationSettings',
'ConfigurationSetting'
);
if (!is_null($settingsInfo)) {
if (array_key_exists('@attributes', $settingsInfo)) {
$settingsInfo = [0 => $settingsInfo];
}
foreach ($settingsInfo as $settingInfo) {
$configurationSettings
[$settingInfo['@attributes']['name']] = $settingInfo
['@attributes']['value'];
}
}
return $configurationSettings;
} | [
"private",
"function",
"_translateConfigurationSettings",
"(",
"$",
"environmentInfo",
")",
"{",
"$",
"configurationSettings",
"=",
"[",
"]",
";",
"$",
"settingsInfo",
"=",
"Utilities",
"::",
"tryGetKeysChainValue",
"(",
"$",
"environmentInfo",
",",
"'CurrentInstance'... | Translates the configuration settings.
@param string $environmentInfo The role environment info
@return array | [
"Translates",
"the",
"configuration",
"settings",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php#L87-L111 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php | XmlRoleEnvironmentDataDeserializer._translateLocalResources | private function _translateLocalResources($environmentInfo)
{
$localResourcesMap = [];
$localResourcesInfo = Utilities::tryGetKeysChainValue(
$environmentInfo,
'CurrentInstance',
'LocalResources',
'LocalResource'
);
if (!is_null($localResourcesInfo)) {
if (array_key_exists('@attributes', $localResourcesInfo)) {
$localResourcesInfo = [0 => $localResourcesInfo];
}
foreach ($localResourcesInfo as $localResourceInfo) {
$localResource = new LocalResource(
$localResourceInfo['@attributes']['sizeInMB'],
$localResourceInfo['@attributes']['name'],
$localResourceInfo['@attributes']['path']
);
$localResourcesMap[$localResource->getName()] = $localResource;
}
}
return $localResourcesMap;
} | php | private function _translateLocalResources($environmentInfo)
{
$localResourcesMap = [];
$localResourcesInfo = Utilities::tryGetKeysChainValue(
$environmentInfo,
'CurrentInstance',
'LocalResources',
'LocalResource'
);
if (!is_null($localResourcesInfo)) {
if (array_key_exists('@attributes', $localResourcesInfo)) {
$localResourcesInfo = [0 => $localResourcesInfo];
}
foreach ($localResourcesInfo as $localResourceInfo) {
$localResource = new LocalResource(
$localResourceInfo['@attributes']['sizeInMB'],
$localResourceInfo['@attributes']['name'],
$localResourceInfo['@attributes']['path']
);
$localResourcesMap[$localResource->getName()] = $localResource;
}
}
return $localResourcesMap;
} | [
"private",
"function",
"_translateLocalResources",
"(",
"$",
"environmentInfo",
")",
"{",
"$",
"localResourcesMap",
"=",
"[",
"]",
";",
"$",
"localResourcesInfo",
"=",
"Utilities",
"::",
"tryGetKeysChainValue",
"(",
"$",
"environmentInfo",
",",
"'CurrentInstance'",
... | Translates the local resources.
@param string $environmentInfo The role environment info
@return LocalResource[] | [
"Translates",
"the",
"local",
"resources",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php#L120-L148 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php | XmlRoleEnvironmentDataDeserializer._translateRoles | private function _translateRoles(
$environmentInfo,
RoleInstance $currentInstance,
$currentRole
) {
$rolesMap = [];
$rolesInfo = Utilities::tryGetKeysChainValue(
$environmentInfo,
'Roles',
'Role'
);
if (!is_null($rolesInfo)) {
if (array_key_exists('@attributes', $rolesInfo)) {
$rolesInfo = [0 => $rolesInfo];
}
foreach ($rolesInfo as $roleInfo) {
$roleInstances = $this->_translateRoleInstances($roleInfo);
if ($roleInfo['@attributes']['name'] == $currentRole) {
$roleInstances[$currentInstance->getId()] = $currentInstance;
}
$role = new Role($roleInfo['@attributes']['name'], $roleInstances);
foreach ($roleInstances as $instance) {
$instance->setRole($role);
}
$rolesMap[$roleInfo['@attributes']['name']] = $role;
}
}
if (!array_key_exists($currentRole, $rolesMap)) {
$roleInstances = [];
$roleInstances[$currentInstance->getId()] = $currentInstance;
$singleRole = new Role($currentRole, $roleInstances);
$currentInstance->setRole($singleRole);
$rolesMap[$currentRole] = $singleRole;
}
return $rolesMap;
} | php | private function _translateRoles(
$environmentInfo,
RoleInstance $currentInstance,
$currentRole
) {
$rolesMap = [];
$rolesInfo = Utilities::tryGetKeysChainValue(
$environmentInfo,
'Roles',
'Role'
);
if (!is_null($rolesInfo)) {
if (array_key_exists('@attributes', $rolesInfo)) {
$rolesInfo = [0 => $rolesInfo];
}
foreach ($rolesInfo as $roleInfo) {
$roleInstances = $this->_translateRoleInstances($roleInfo);
if ($roleInfo['@attributes']['name'] == $currentRole) {
$roleInstances[$currentInstance->getId()] = $currentInstance;
}
$role = new Role($roleInfo['@attributes']['name'], $roleInstances);
foreach ($roleInstances as $instance) {
$instance->setRole($role);
}
$rolesMap[$roleInfo['@attributes']['name']] = $role;
}
}
if (!array_key_exists($currentRole, $rolesMap)) {
$roleInstances = [];
$roleInstances[$currentInstance->getId()] = $currentInstance;
$singleRole = new Role($currentRole, $roleInstances);
$currentInstance->setRole($singleRole);
$rolesMap[$currentRole] = $singleRole;
}
return $rolesMap;
} | [
"private",
"function",
"_translateRoles",
"(",
"$",
"environmentInfo",
",",
"RoleInstance",
"$",
"currentInstance",
",",
"$",
"currentRole",
")",
"{",
"$",
"rolesMap",
"=",
"[",
"]",
";",
"$",
"rolesInfo",
"=",
"Utilities",
"::",
"tryGetKeysChainValue",
"(",
"... | Translates the roles.
@param string $environmentInfo The role environment info
@param RoleInstance $currentInstance The current instance info
@param string $currentRole The current role
@return array | [
"Translates",
"the",
"roles",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php#L159-L205 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php | XmlRoleEnvironmentDataDeserializer._translateRoleInstances | private function _translateRoleInstances($instancesInfo)
{
$roleInstanceMap = [];
$instances = Utilities::tryGetKeysChainValue(
$instancesInfo,
'Instances',
'Instance'
);
if (!is_null($instances)) {
if (array_key_exists('@attributes', $instances)) {
$instances = [0 => $instances];
}
foreach ($instances as $instanceInfo) {
$endpoints = $this->_translateRoleInstanceEndpoints(
$instanceInfo['Endpoints']['Endpoint']
);
$roleInstance = new RoleInstance(
$instanceInfo['@attributes']['id'],
$instanceInfo['@attributes']['faultDomain'],
$instanceInfo['@attributes']['updateDomain'],
$endpoints
);
$roleInstanceMap
[$instanceInfo['@attributes']['id']] = $roleInstance;
}
}
return $roleInstanceMap;
} | php | private function _translateRoleInstances($instancesInfo)
{
$roleInstanceMap = [];
$instances = Utilities::tryGetKeysChainValue(
$instancesInfo,
'Instances',
'Instance'
);
if (!is_null($instances)) {
if (array_key_exists('@attributes', $instances)) {
$instances = [0 => $instances];
}
foreach ($instances as $instanceInfo) {
$endpoints = $this->_translateRoleInstanceEndpoints(
$instanceInfo['Endpoints']['Endpoint']
);
$roleInstance = new RoleInstance(
$instanceInfo['@attributes']['id'],
$instanceInfo['@attributes']['faultDomain'],
$instanceInfo['@attributes']['updateDomain'],
$endpoints
);
$roleInstanceMap
[$instanceInfo['@attributes']['id']] = $roleInstance;
}
}
return $roleInstanceMap;
} | [
"private",
"function",
"_translateRoleInstances",
"(",
"$",
"instancesInfo",
")",
"{",
"$",
"roleInstanceMap",
"=",
"[",
"]",
";",
"$",
"instances",
"=",
"Utilities",
"::",
"tryGetKeysChainValue",
"(",
"$",
"instancesInfo",
",",
"'Instances'",
",",
"'Instance'",
... | Translates the role instances.
@param string $instancesInfo The instance info
@return RoleInstance[] | [
"Translates",
"the",
"role",
"instances",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php#L214-L247 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php | XmlRoleEnvironmentDataDeserializer._translateRoleInstanceEndpoints | private function _translateRoleInstanceEndpoints($endpointsInfo)
{
$endpointsMap = [];
$endpoints = $endpointsInfo;
if (array_key_exists('@attributes', $endpoints)) {
$endpoints = [0 => $endpointsInfo];
}
foreach ($endpoints as $endpoint) {
$roleInstanceEndpoint = new RoleInstanceEndpoint(
$endpoint['@attributes']['protocol'],
$endpoint['@attributes']['address'],
intval($endpoint['@attributes']['port'], 10)
);
$endpointsMap[$endpoint['@attributes']['name']] = $roleInstanceEndpoint;
}
return $endpointsMap;
} | php | private function _translateRoleInstanceEndpoints($endpointsInfo)
{
$endpointsMap = [];
$endpoints = $endpointsInfo;
if (array_key_exists('@attributes', $endpoints)) {
$endpoints = [0 => $endpointsInfo];
}
foreach ($endpoints as $endpoint) {
$roleInstanceEndpoint = new RoleInstanceEndpoint(
$endpoint['@attributes']['protocol'],
$endpoint['@attributes']['address'],
intval($endpoint['@attributes']['port'], 10)
);
$endpointsMap[$endpoint['@attributes']['name']] = $roleInstanceEndpoint;
}
return $endpointsMap;
} | [
"private",
"function",
"_translateRoleInstanceEndpoints",
"(",
"$",
"endpointsInfo",
")",
"{",
"$",
"endpointsMap",
"=",
"[",
"]",
";",
"$",
"endpoints",
"=",
"$",
"endpointsInfo",
";",
"if",
"(",
"array_key_exists",
"(",
"'@attributes'",
",",
"$",
"endpoints",
... | Translates the role instance endpoints.
@param string $endpointsInfo The endpoints info
@return RoleInstanceEndpoint[] | [
"Translates",
"the",
"role",
"instance",
"endpoints",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php#L256-L276 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php | XmlRoleEnvironmentDataDeserializer._translateCurrentInstance | private function _translateCurrentInstance($environmentInfo)
{
$endpoints = [];
$endpointsInfo = Utilities::tryGetKeysChainValue(
$environmentInfo,
'CurrentInstance',
'Endpoints',
'Endpoint'
);
if (!is_null($endpointsInfo)) {
$endpoints = $this->_translateRoleInstanceEndpoints($endpointsInfo);
}
$currentInstance = new RoleInstance(
$environmentInfo['CurrentInstance']['@attributes']['id'],
$environmentInfo['CurrentInstance']['@attributes']['faultDomain'],
$environmentInfo['CurrentInstance']['@attributes']['updateDomain'],
$endpoints
);
foreach ($currentInstance->getInstanceEndpoints() as $endpoint) {
$endpoint->setRoleInstance($currentInstance);
}
return $currentInstance;
} | php | private function _translateCurrentInstance($environmentInfo)
{
$endpoints = [];
$endpointsInfo = Utilities::tryGetKeysChainValue(
$environmentInfo,
'CurrentInstance',
'Endpoints',
'Endpoint'
);
if (!is_null($endpointsInfo)) {
$endpoints = $this->_translateRoleInstanceEndpoints($endpointsInfo);
}
$currentInstance = new RoleInstance(
$environmentInfo['CurrentInstance']['@attributes']['id'],
$environmentInfo['CurrentInstance']['@attributes']['faultDomain'],
$environmentInfo['CurrentInstance']['@attributes']['updateDomain'],
$endpoints
);
foreach ($currentInstance->getInstanceEndpoints() as $endpoint) {
$endpoint->setRoleInstance($currentInstance);
}
return $currentInstance;
} | [
"private",
"function",
"_translateCurrentInstance",
"(",
"$",
"environmentInfo",
")",
"{",
"$",
"endpoints",
"=",
"[",
"]",
";",
"$",
"endpointsInfo",
"=",
"Utilities",
"::",
"tryGetKeysChainValue",
"(",
"$",
"environmentInfo",
",",
"'CurrentInstance'",
",",
"'End... | Translates the current instance info.
@param string $environmentInfo The environment info
@return RoleInstance | [
"Translates",
"the",
"current",
"instance",
"info",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlRoleEnvironmentDataDeserializer.php#L285-L312 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Validate.php | Validate.isA | public static function isA($objectInstance, $class, $name)
{
self::isString($class, 'class');
self::notNull($objectInstance, 'objectInstance');
self::isObject($objectInstance, 'objectInstance');
$objectType = get_class($objectInstance);
if (is_a($objectInstance, $class)) {
return true;
} else {
throw new \InvalidArgumentException(
sprintf(
Resources::INSTANCE_TYPE_VALIDATION_MSG,
$name,
$objectType,
$class
)
);
}
} | php | public static function isA($objectInstance, $class, $name)
{
self::isString($class, 'class');
self::notNull($objectInstance, 'objectInstance');
self::isObject($objectInstance, 'objectInstance');
$objectType = get_class($objectInstance);
if (is_a($objectInstance, $class)) {
return true;
} else {
throw new \InvalidArgumentException(
sprintf(
Resources::INSTANCE_TYPE_VALIDATION_MSG,
$name,
$objectType,
$class
)
);
}
} | [
"public",
"static",
"function",
"isA",
"(",
"$",
"objectInstance",
",",
"$",
"class",
",",
"$",
"name",
")",
"{",
"self",
"::",
"isString",
"(",
"$",
"class",
",",
"'class'",
")",
";",
"self",
"::",
"notNull",
"(",
"$",
"objectInstance",
",",
"'objectI... | Throws exception if the object is not of the specified class type.
@param mixed $objectInstance An object that requires class type validation
@param string $class The class the object instance should be
@param string $name The parameter name
@throws \InvalidArgumentException
@return bool | [
"Throws",
"exception",
"if",
"the",
"object",
"is",
"not",
"of",
"the",
"specified",
"class",
"type",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Validate.php#L329-L349 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Validate.php | Validate.methodExists | public static function methodExists($objectInstance, $method, $name)
{
self::isString($method, 'method');
self::notNull($objectInstance, 'objectInstance');
self::isObject($objectInstance, 'objectInstance');
if (method_exists($objectInstance, $method)) {
return true;
} else {
throw new \InvalidArgumentException(
sprintf(
Resources::ERROR_METHOD_NOT_FOUND,
$method,
$name
)
);
}
} | php | public static function methodExists($objectInstance, $method, $name)
{
self::isString($method, 'method');
self::notNull($objectInstance, 'objectInstance');
self::isObject($objectInstance, 'objectInstance');
if (method_exists($objectInstance, $method)) {
return true;
} else {
throw new \InvalidArgumentException(
sprintf(
Resources::ERROR_METHOD_NOT_FOUND,
$method,
$name
)
);
}
} | [
"public",
"static",
"function",
"methodExists",
"(",
"$",
"objectInstance",
",",
"$",
"method",
",",
"$",
"name",
")",
"{",
"self",
"::",
"isString",
"(",
"$",
"method",
",",
"'method'",
")",
";",
"self",
"::",
"notNull",
"(",
"$",
"objectInstance",
",",... | Validate if method exists in object.
@param object $objectInstance An object that requires method existing
validation
@param string $method Method name
@param string $name The parameter name
@return bool | [
"Validate",
"if",
"method",
"exists",
"in",
"object",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Validate.php#L361-L378 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Validate.php | Validate.isDateString | public static function isDateString($value, $name)
{
self::isString($value, 'value');
try {
new \DateTime($value);
return true;
} catch (\Exception $e) {
throw new \InvalidArgumentException(
sprintf(
Resources::ERROR_INVALID_DATE_STRING,
$name,
$value
)
);
}
} | php | public static function isDateString($value, $name)
{
self::isString($value, 'value');
try {
new \DateTime($value);
return true;
} catch (\Exception $e) {
throw new \InvalidArgumentException(
sprintf(
Resources::ERROR_INVALID_DATE_STRING,
$name,
$value
)
);
}
} | [
"public",
"static",
"function",
"isDateString",
"(",
"$",
"value",
",",
"$",
"name",
")",
"{",
"self",
"::",
"isString",
"(",
"$",
"value",
",",
"'value'",
")",
";",
"try",
"{",
"new",
"\\",
"DateTime",
"(",
"$",
"value",
")",
";",
"return",
"true",
... | Validate if string is date formatted.
@param string $value Value to validate
@param string $name Name of parameter to insert in error message
@throws \InvalidArgumentException
@return bool | [
"Validate",
"if",
"string",
"is",
"date",
"formatted",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Validate.php#L390-L407 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/RuleDescription.php | RuleDescription.create | public static function create($ruleDescriptionXml)
{
$ruleDescription = new self();
$root = simplexml_load_string(
$ruleDescriptionXml
);
$ruleDescriptionArray = (array) $root;
if (array_key_exists('Filter', $ruleDescriptionArray)) {
$filterItem = $ruleDescriptionArray['Filter'];
$filterAttributes = $filterItem->attributes('i', true);
$filterItemArray = (array) $filterItem;
$filterType = (string) $filterAttributes['type'];
$filter = null;
switch ($filterType) {
case 'TrueFilter':
$filter = new TrueFilter();
break;
case 'FalseFilter':
$filter = new FalseFilter();
break;
case 'CorrelationFilter':
$filter = new CorrelationFilter();
if (array_key_exists('CorrelationId', $filterItemArray)) {
$filter->setCorrelationId(
(string) $filterItemArray['CorrelationId']
);
}
break;
case 'SqlFilter':
$filter = new SqlFilter();
if (array_key_exists('SqlExpression', $filterItemArray)) {
$filter->setSqlExpression(
(string) $filterItemArray['SqlExpression']
);
}
if (array_key_exists('CompatibilityLevel', $filterItemArray)) {
$filter->setCompatibilityLevel(
(int) $filterItemArray['CompatibilityLevel']
);
}
break;
default:
$filter = new Filter();
}
$ruleDescription->setFilter($filter);
}
if (array_key_exists('Action', $ruleDescriptionArray)) {
$actionItem = $ruleDescriptionArray['Action'];
$actionAttributes = $actionItem->attributes('i', true);
$actionType = (string) $actionAttributes['type'];
$action = null;
switch ($actionType) {
case 'EmptyRuleAction':
$action = new EmptyRuleAction();
break;
case 'SqlRuleAction':
$action = new SqlRuleAction();
if (array_key_exists('SqlExpression', $actionItem)) {
$action->setSqlExpression((string) $actionItem['SqlExpression']);
}
break;
default:
$action = new Action();
}
$ruleDescription->setAction($action);
}
if (array_key_exists('Name', $ruleDescriptionArray)) {
$ruleDescription->setName((string) $ruleDescriptionArray['Name']);
}
return $ruleDescription;
} | php | public static function create($ruleDescriptionXml)
{
$ruleDescription = new self();
$root = simplexml_load_string(
$ruleDescriptionXml
);
$ruleDescriptionArray = (array) $root;
if (array_key_exists('Filter', $ruleDescriptionArray)) {
$filterItem = $ruleDescriptionArray['Filter'];
$filterAttributes = $filterItem->attributes('i', true);
$filterItemArray = (array) $filterItem;
$filterType = (string) $filterAttributes['type'];
$filter = null;
switch ($filterType) {
case 'TrueFilter':
$filter = new TrueFilter();
break;
case 'FalseFilter':
$filter = new FalseFilter();
break;
case 'CorrelationFilter':
$filter = new CorrelationFilter();
if (array_key_exists('CorrelationId', $filterItemArray)) {
$filter->setCorrelationId(
(string) $filterItemArray['CorrelationId']
);
}
break;
case 'SqlFilter':
$filter = new SqlFilter();
if (array_key_exists('SqlExpression', $filterItemArray)) {
$filter->setSqlExpression(
(string) $filterItemArray['SqlExpression']
);
}
if (array_key_exists('CompatibilityLevel', $filterItemArray)) {
$filter->setCompatibilityLevel(
(int) $filterItemArray['CompatibilityLevel']
);
}
break;
default:
$filter = new Filter();
}
$ruleDescription->setFilter($filter);
}
if (array_key_exists('Action', $ruleDescriptionArray)) {
$actionItem = $ruleDescriptionArray['Action'];
$actionAttributes = $actionItem->attributes('i', true);
$actionType = (string) $actionAttributes['type'];
$action = null;
switch ($actionType) {
case 'EmptyRuleAction':
$action = new EmptyRuleAction();
break;
case 'SqlRuleAction':
$action = new SqlRuleAction();
if (array_key_exists('SqlExpression', $actionItem)) {
$action->setSqlExpression((string) $actionItem['SqlExpression']);
}
break;
default:
$action = new Action();
}
$ruleDescription->setAction($action);
}
if (array_key_exists('Name', $ruleDescriptionArray)) {
$ruleDescription->setName((string) $ruleDescriptionArray['Name']);
}
return $ruleDescription;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"ruleDescriptionXml",
")",
"{",
"$",
"ruleDescription",
"=",
"new",
"self",
"(",
")",
";",
"$",
"root",
"=",
"simplexml_load_string",
"(",
"$",
"ruleDescriptionXml",
")",
";",
"$",
"ruleDescriptionArray",
"="... | Creates a rule description instance with specified XML string.
@param string $ruleDescriptionXml A XML string representing the
rule description
@return RuleDescription | [
"Creates",
"a",
"rule",
"description",
"instance",
"with",
"specified",
"XML",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/RuleDescription.php#L84-L170 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/XmlCurrentStateSerializer.php | XmlCurrentStateSerializer.serialize | public function serialize(CurrentState $state, $outputStream)
{
$statusLeaseInfo = [
'StatusLease' => [
'@attributes' => [
'ClientId' => $state->getClientId(),
],
],
];
if ($state instanceof AcquireCurrentState) {
$statusLeaseInfo['StatusLease']['Acquire'] = [
'Incarnation' => $state->getIncarnation(),
'Status' => $state->getStatus(),
'Expiration' => Utilities::isoDate(
date_timestamp_get($state->getExpiration())
),
];
} elseif ($state instanceof ReleaseCurrentState) {
$statusLeaseInfo['StatusLease']['Release'] = [];
}
$currentState = Utilities::serialize($statusLeaseInfo, 'CurrentState');
fwrite($outputStream, $currentState);
} | php | public function serialize(CurrentState $state, $outputStream)
{
$statusLeaseInfo = [
'StatusLease' => [
'@attributes' => [
'ClientId' => $state->getClientId(),
],
],
];
if ($state instanceof AcquireCurrentState) {
$statusLeaseInfo['StatusLease']['Acquire'] = [
'Incarnation' => $state->getIncarnation(),
'Status' => $state->getStatus(),
'Expiration' => Utilities::isoDate(
date_timestamp_get($state->getExpiration())
),
];
} elseif ($state instanceof ReleaseCurrentState) {
$statusLeaseInfo['StatusLease']['Release'] = [];
}
$currentState = Utilities::serialize($statusLeaseInfo, 'CurrentState');
fwrite($outputStream, $currentState);
} | [
"public",
"function",
"serialize",
"(",
"CurrentState",
"$",
"state",
",",
"$",
"outputStream",
")",
"{",
"$",
"statusLeaseInfo",
"=",
"[",
"'StatusLease'",
"=>",
"[",
"'@attributes'",
"=>",
"[",
"'ClientId'",
"=>",
"$",
"state",
"->",
"getClientId",
"(",
")... | Serializes the current state.
@param CurrentState $state The current state
@param resource $outputStream The output stream | [
"Serializes",
"the",
"current",
"state",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/XmlCurrentStateSerializer.php#L51-L75 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Internal/WrapAccessTokenResult.php | WrapAccessTokenResult.create | public static function create($response)
{
Validate::isString($response, 'response');
$wrapAccessTokenResult = new self();
parse_str($response, $parsedResponse);
$wrapAccessTokenResult->setAccessToken(
Utilities::tryGetValue(
$parsedResponse, Resources::WRAP_ACCESS_TOKEN
)
);
$wrapAccessTokenResult->setExpiresIn(
Utilities::tryGetValue(
$parsedResponse, Resources::WRAP_ACCESS_TOKEN_EXPIRES_IN
)
);
return $wrapAccessTokenResult;
} | php | public static function create($response)
{
Validate::isString($response, 'response');
$wrapAccessTokenResult = new self();
parse_str($response, $parsedResponse);
$wrapAccessTokenResult->setAccessToken(
Utilities::tryGetValue(
$parsedResponse, Resources::WRAP_ACCESS_TOKEN
)
);
$wrapAccessTokenResult->setExpiresIn(
Utilities::tryGetValue(
$parsedResponse, Resources::WRAP_ACCESS_TOKEN_EXPIRES_IN
)
);
return $wrapAccessTokenResult;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"response",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"response",
",",
"'response'",
")",
";",
"$",
"wrapAccessTokenResult",
"=",
"new",
"self",
"(",
")",
";",
"parse_str",
"(",
"$",
"response",
... | Creates WrapAccessTokenResult object from parsed XML response.
@param string $response The get WRAP access token response
@return WrapAccessTokenResult | [
"Creates",
"WrapAccessTokenResult",
"object",
"from",
"parsed",
"XML",
"response",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Internal/WrapAccessTokenResult.php#L64-L84 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ErrorDetail.php | ErrorDetail.fromArray | public function fromArray(array $options)
{
if (isset($options['Code'])) {
Validate::isInteger($options['Code'], 'options[Code]');
$this->_code = $options['Code'];
}
if (isset($options['Message'])) {
Validate::isString($options['Message'], 'options[Message]');
$this->_message = $options['Message'];
}
} | php | public function fromArray(array $options)
{
if (isset($options['Code'])) {
Validate::isInteger($options['Code'], 'options[Code]');
$this->_code = $options['Code'];
}
if (isset($options['Message'])) {
Validate::isString($options['Message'], 'options[Message]');
$this->_message = $options['Message'];
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Code'",
"]",
")",
")",
"{",
"Validate",
"::",
"isInteger",
"(",
"$",
"options",
"[",
"'Code'",
"]",
",",
"'options[Code]'",
")",
... | Fill error detail from array.
@param array $options Array containing values for object properties | [
"Fill",
"error",
"detail",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ErrorDetail.php#L79-L90 | train |
Azure/azure-sdk-for-php | src/Common/Internal/RestProxy.php | RestProxy.addOptionalQueryParam | protected function addOptionalQueryParam(array &$queryParameters, $key, $value)
{
Validate::isString($key, 'key');
Validate::isString($value, 'value');
if (!is_null($value) && Resources::EMPTY_STRING !== $value) {
$queryParameters[$key] = $value;
}
} | php | protected function addOptionalQueryParam(array &$queryParameters, $key, $value)
{
Validate::isString($key, 'key');
Validate::isString($value, 'value');
if (!is_null($value) && Resources::EMPTY_STRING !== $value) {
$queryParameters[$key] = $value;
}
} | [
"protected",
"function",
"addOptionalQueryParam",
"(",
"array",
"&",
"$",
"queryParameters",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"key",
",",
"'key'",
")",
";",
"Validate",
"::",
"isString",
"(",
"$",
"val... | Adds optional query parameter.
Doesn't add the value if it satisfies empty().
@param array &$queryParameters The query parameters
@param string $key The query variable name
@param string $value The query variable value | [
"Adds",
"optional",
"query",
"parameter",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/RestProxy.php#L171-L179 | train |
Azure/azure-sdk-for-php | src/Common/Internal/RestProxy.php | RestProxy.addOptionalHeader | protected function addOptionalHeader(array &$headers, $key, $value)
{
Validate::isString($key, 'key');
Validate::isString($value, 'value');
if (!is_null($value) && Resources::EMPTY_STRING !== $value) {
$headers[$key] = $value;
}
} | php | protected function addOptionalHeader(array &$headers, $key, $value)
{
Validate::isString($key, 'key');
Validate::isString($value, 'value');
if (!is_null($value) && Resources::EMPTY_STRING !== $value) {
$headers[$key] = $value;
}
} | [
"protected",
"function",
"addOptionalHeader",
"(",
"array",
"&",
"$",
"headers",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"key",
",",
"'key'",
")",
";",
"Validate",
"::",
"isString",
"(",
"$",
"value",
",",
... | Adds optional header.
Doesn't add the value if it satisfies empty().
@param array &$headers The HTTP header parameters
@param string $key The HTTP header name
@param string $value The HTTP header value | [
"Adds",
"optional",
"header",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/RestProxy.php#L190-L198 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Filters/AuthenticationFilter.php | AuthenticationFilter.handleRequest | public function handleRequest(IHttpClient $request)
{
$signedKey = $this->_azureAdTokenProvider->getAccessToken();
$request->setHeader(Resources::AUTHENTICATION, "Bearer " . $signedKey->getAccessToken());
return $request;
} | php | public function handleRequest(IHttpClient $request)
{
$signedKey = $this->_azureAdTokenProvider->getAccessToken();
$request->setHeader(Resources::AUTHENTICATION, "Bearer " . $signedKey->getAccessToken());
return $request;
} | [
"public",
"function",
"handleRequest",
"(",
"IHttpClient",
"$",
"request",
")",
"{",
"$",
"signedKey",
"=",
"$",
"this",
"->",
"_azureAdTokenProvider",
"->",
"getAccessToken",
"(",
")",
";",
"$",
"request",
"->",
"setHeader",
"(",
"Resources",
"::",
"AUTHENTIC... | Adds authentication header to the request headers.
@param IHttpClient $request HTTP channel object
@return IHttpClient | [
"Adds",
"authentication",
"header",
"to",
"the",
"request",
"headers",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Filters/AuthenticationFilter.php#L71-L77 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ChannelPreview.php | ChannelPreview.fromArray | public function fromArray($options)
{
if (!empty($options['AccessControl'])) {
Validate::isArray($options['AccessControl'], 'options[AccessControl]');
$this->_accessControl = ChannelPreviewAccessControl::createFromOptions($options['AccessControl']);
}
if (!empty($options['Endpoints'])) {
Validate::isArray($options['Endpoints'], 'options[Endpoints]');
foreach ($options['Endpoints'] as $endpoint) {
$this->_endpoints[] = ChannelEndpoint::createFromOptions($endpoint);
}
}
} | php | public function fromArray($options)
{
if (!empty($options['AccessControl'])) {
Validate::isArray($options['AccessControl'], 'options[AccessControl]');
$this->_accessControl = ChannelPreviewAccessControl::createFromOptions($options['AccessControl']);
}
if (!empty($options['Endpoints'])) {
Validate::isArray($options['Endpoints'], 'options[Endpoints]');
foreach ($options['Endpoints'] as $endpoint) {
$this->_endpoints[] = ChannelEndpoint::createFromOptions($endpoint);
}
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'AccessControl'",
"]",
")",
")",
"{",
"Validate",
"::",
"isArray",
"(",
"$",
"options",
"[",
"'AccessControl'",
"]",
",",
"'options[Acce... | Fill ChannelPreview from array.
@param array $options Array containing values for object properties | [
"Fill",
"ChannelPreview",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ChannelPreview.php#L79-L92 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/VideoStream.php | VideoStream.fromArray | public function fromArray($options)
{
if (isset($options['Index'])) {
Validate::isInteger($options['Index'], 'options[Index]');
$this->_index = (int) $options['Index'];
}
} | php | public function fromArray($options)
{
if (isset($options['Index'])) {
Validate::isInteger($options['Index'], 'options[Index]');
$this->_index = (int) $options['Index'];
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Index'",
"]",
")",
")",
"{",
"Validate",
"::",
"isInteger",
"(",
"$",
"options",
"[",
"'Index'",
"]",
",",
"'options[Index]'",
")",
";",
... | Fill VideoStream from array.
@param array $options Array containing values for object properties | [
"Fill",
"VideoStream",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/VideoStream.php#L89-L95 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/GetOperationStatusResult.php | GetOperationStatusResult.create | public static function create($parsed)
{
$result = new self();
$result->_id = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ID
);
$result->_status = Utilities::tryGetValue(
$parsed,
Resources::XTAG_STATUS
);
$result->_httpStatusCode = Utilities::tryGetValue(
$parsed,
Resources::XTAG_HTTP_STATUS_CODE
);
$error = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ERROR
);
if (!empty($error)) {
$code = Utilities::tryGetValue($error, Resources::XTAG_CODE);
$message = Utilities::tryGetValue($error, Resources::XTAG_MESSAGE);
$result->_error = new ServiceException($code, $message);
}
return $result;
} | php | public static function create($parsed)
{
$result = new self();
$result->_id = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ID
);
$result->_status = Utilities::tryGetValue(
$parsed,
Resources::XTAG_STATUS
);
$result->_httpStatusCode = Utilities::tryGetValue(
$parsed,
Resources::XTAG_HTTP_STATUS_CODE
);
$error = Utilities::tryGetValue(
$parsed,
Resources::XTAG_ERROR
);
if (!empty($error)) {
$code = Utilities::tryGetValue($error, Resources::XTAG_CODE);
$message = Utilities::tryGetValue($error, Resources::XTAG_MESSAGE);
$result->_error = new ServiceException($code, $message);
}
return $result;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"result",
"=",
"new",
"self",
"(",
")",
";",
"$",
"result",
"->",
"_id",
"=",
"Utilities",
"::",
"tryGetValue",
"(",
"$",
"parsed",
",",
"Resources",
"::",
"XTAG_ID",
")",
"... | Creates GetOperationStatusResult object from parsed response.
@param array $parsed The parsed response
@return GetOperationStatusResult | [
"Creates",
"GetOperationStatusResult",
"object",
"from",
"parsed",
"response",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/GetOperationStatusResult.php#L74-L103 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.init | public static function init()
{
self::$_clientId = uniqid();
// 2038-01-19 04:14:07
self::$_maxDateTime = new \DateTime(
date(Resources::TIMESTAMP_FORMAT, Resources::INT32_MAX)
);
self::$_tracking = true;
} | php | public static function init()
{
self::$_clientId = uniqid();
// 2038-01-19 04:14:07
self::$_maxDateTime = new \DateTime(
date(Resources::TIMESTAMP_FORMAT, Resources::INT32_MAX)
);
self::$_tracking = true;
} | [
"public",
"static",
"function",
"init",
"(",
")",
"{",
"self",
"::",
"$",
"_clientId",
"=",
"uniqid",
"(",
")",
";",
"// 2038-01-19 04:14:07",
"self",
"::",
"$",
"_maxDateTime",
"=",
"new",
"\\",
"DateTime",
"(",
"date",
"(",
"Resources",
"::",
"TIMESTAMP_... | Initializes the role environment.
@static | [
"Initializes",
"the",
"role",
"environment",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L137-L147 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment._initialize | private static function _initialize($keepOpen = false)
{
try {
if (is_null(self::$_runtimeClient)) {
self::$_versionEndpoint = getenv(
self::VERSION_ENDPOINT_ENVIRONMENT_NAME
);
if (self::$_versionEndpoint == false) {
self::$_versionEndpoint = self::VERSION_ENDPOINT_FIXED_PATH;
}
$kernel = RuntimeKernel::getKernel();
$kernel->getProtocol1RuntimeGoalStateClient()->setKeepOpen(
$keepOpen
);
self::$_runtimeClient = $kernel->getRuntimeVersionManager()
->getRuntimeClient(self::$_versionEndpoint);
self::$_currentGoalState = self::$_runtimeClient
->getCurrentGoalState();
self::$_currentEnvironmentData = self::$_runtimeClient
->getRoleEnvironmentData();
} else {
self::$_currentGoalState = self::$_runtimeClient
->getCurrentGoalState();
self::$_currentEnvironmentData = self::$_runtimeClient
->getRoleEnvironmentData();
}
} catch (ChannelNotAvailableException $ex) {
throw new RoleEnvironmentNotAvailableException();
}
} | php | private static function _initialize($keepOpen = false)
{
try {
if (is_null(self::$_runtimeClient)) {
self::$_versionEndpoint = getenv(
self::VERSION_ENDPOINT_ENVIRONMENT_NAME
);
if (self::$_versionEndpoint == false) {
self::$_versionEndpoint = self::VERSION_ENDPOINT_FIXED_PATH;
}
$kernel = RuntimeKernel::getKernel();
$kernel->getProtocol1RuntimeGoalStateClient()->setKeepOpen(
$keepOpen
);
self::$_runtimeClient = $kernel->getRuntimeVersionManager()
->getRuntimeClient(self::$_versionEndpoint);
self::$_currentGoalState = self::$_runtimeClient
->getCurrentGoalState();
self::$_currentEnvironmentData = self::$_runtimeClient
->getRoleEnvironmentData();
} else {
self::$_currentGoalState = self::$_runtimeClient
->getCurrentGoalState();
self::$_currentEnvironmentData = self::$_runtimeClient
->getRoleEnvironmentData();
}
} catch (ChannelNotAvailableException $ex) {
throw new RoleEnvironmentNotAvailableException();
}
} | [
"private",
"static",
"function",
"_initialize",
"(",
"$",
"keepOpen",
"=",
"false",
")",
"{",
"try",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_runtimeClient",
")",
")",
"{",
"self",
"::",
"$",
"_versionEndpoint",
"=",
"getenv",
"(",
"self",
... | Initializes the runtime client.
@param bool $keepOpen Boolean value indicating if the connection
should remain open
@throws RoleEnvironmentNotAvailableException
@static | [
"Initializes",
"the",
"runtime",
"client",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L170-L205 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.trackChanges | public static function trackChanges()
{
self::_initialize(true);
while (self::$_tracking) {
$newGoalState = self::$_runtimeClient->getCurrentGoalState();
switch ($newGoalState->getExpectedState()) {
case CurrentStatus::STARTED:
$newIncarnation = $newGoalState->getIncarnation();
$currentIncarnation = self::$_currentGoalState->getIncarnation();
if ($newIncarnation > $currentIncarnation) {
self::_processGoalStateChange($newGoalState);
}
break;
case CurrentStatus::STOPPED:
self::_raiseStoppingEvent();
$stoppedState = new AcquireCurrentState(
self::$_clientId,
$newGoalState->getIncarnation(),
CurrentStatus::STOPPED,
self::$_maxDateTime
);
self::$_runtimeClient->setCurrentState($stoppedState);
break;
}
if (is_int(self::$_tracking)) {
--self::$_tracking;
}
}
} | php | public static function trackChanges()
{
self::_initialize(true);
while (self::$_tracking) {
$newGoalState = self::$_runtimeClient->getCurrentGoalState();
switch ($newGoalState->getExpectedState()) {
case CurrentStatus::STARTED:
$newIncarnation = $newGoalState->getIncarnation();
$currentIncarnation = self::$_currentGoalState->getIncarnation();
if ($newIncarnation > $currentIncarnation) {
self::_processGoalStateChange($newGoalState);
}
break;
case CurrentStatus::STOPPED:
self::_raiseStoppingEvent();
$stoppedState = new AcquireCurrentState(
self::$_clientId,
$newGoalState->getIncarnation(),
CurrentStatus::STOPPED,
self::$_maxDateTime
);
self::$_runtimeClient->setCurrentState($stoppedState);
break;
}
if (is_int(self::$_tracking)) {
--self::$_tracking;
}
}
} | [
"public",
"static",
"function",
"trackChanges",
"(",
")",
"{",
"self",
"::",
"_initialize",
"(",
"true",
")",
";",
"while",
"(",
"self",
"::",
"$",
"_tracking",
")",
"{",
"$",
"newGoalState",
"=",
"self",
"::",
"$",
"_runtimeClient",
"->",
"getCurrentGoalS... | Tracks role environment changes raising events as necessary.
This method is blocking and can/should be called in a separate fork.
@static | [
"Tracks",
"role",
"environment",
"changes",
"raising",
"events",
"as",
"necessary",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L214-L249 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment._processGoalStateChange | private static function _processGoalStateChange($newGoalState)
{
$last = self::$_lastState;
$changes = self::_calculateChanges();
if (count($changes) == 0) {
self::_acceptLatestIncarnation($newGoalState, $last);
} else {
self::_raiseChangingEvent($changes);
self::_acceptLatestIncarnation($newGoalState, $last);
self::$_currentEnvironmentData = self::$_runtimeClient
->getRoleEnvironmentData();
self::_raiseChangedEvent($changes);
}
} | php | private static function _processGoalStateChange($newGoalState)
{
$last = self::$_lastState;
$changes = self::_calculateChanges();
if (count($changes) == 0) {
self::_acceptLatestIncarnation($newGoalState, $last);
} else {
self::_raiseChangingEvent($changes);
self::_acceptLatestIncarnation($newGoalState, $last);
self::$_currentEnvironmentData = self::$_runtimeClient
->getRoleEnvironmentData();
self::_raiseChangedEvent($changes);
}
} | [
"private",
"static",
"function",
"_processGoalStateChange",
"(",
"$",
"newGoalState",
")",
"{",
"$",
"last",
"=",
"self",
"::",
"$",
"_lastState",
";",
"$",
"changes",
"=",
"self",
"::",
"_calculateChanges",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"... | Processes a goal state change.
@param GoalState $newGoalState The new goal state
@static | [
"Processes",
"a",
"goal",
"state",
"change",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L258-L275 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment._calculateChanges | private static function _calculateChanges()
{
$current = self::$_currentEnvironmentData;
$newData = self::$_runtimeClient->getRoleEnvironmentData();
$changes = self::_calculateConfigurationChanges($current, $newData);
$currentRoles = $current->getRoles();
$newRoles = $newData->getRoles();
$changedRoleSet = [];
foreach ($currentRoles as $roleName => $role) {
if (array_key_exists($roleName, $newRoles)) {
$currentRole = $currentRoles[$roleName];
$newRole = $newRoles[$roleName];
$currentRoleInstances = $currentRole->getInstances();
$newRoleInstances = $newRole->getInstances();
$changedRoleSet = array_merge(
$changedRoleSet,
self::_calculateNewRoleInstanceChanges(
$role,
$currentRoleInstances,
$newRoleInstances
)
);
} else {
$changedRoleSet[] = $role;
}
}
foreach ($newRoles as $roleName => $role) {
if (array_key_exists($roleName, $currentRoles)) {
$currentRole = $currentRoles[$roleName];
$newRole = $newRoles[$roleName];
$currentRoleInstances = $currentRole->getInstances();
$newRoleInstances = $newRole->getInstances();
$changedRoleSet = array_merge(
$changedRoleSet,
self::_calculateCurrentRoleInstanceChanges(
$role,
$currentRoleInstances,
$newRoleInstances
)
);
} else {
$changedRoleSet[] = $role;
}
}
foreach ($changedRoleSet as $role) {
$changes[] = new RoleEnvironmentTopologyChange($role);
}
return $changes;
} | php | private static function _calculateChanges()
{
$current = self::$_currentEnvironmentData;
$newData = self::$_runtimeClient->getRoleEnvironmentData();
$changes = self::_calculateConfigurationChanges($current, $newData);
$currentRoles = $current->getRoles();
$newRoles = $newData->getRoles();
$changedRoleSet = [];
foreach ($currentRoles as $roleName => $role) {
if (array_key_exists($roleName, $newRoles)) {
$currentRole = $currentRoles[$roleName];
$newRole = $newRoles[$roleName];
$currentRoleInstances = $currentRole->getInstances();
$newRoleInstances = $newRole->getInstances();
$changedRoleSet = array_merge(
$changedRoleSet,
self::_calculateNewRoleInstanceChanges(
$role,
$currentRoleInstances,
$newRoleInstances
)
);
} else {
$changedRoleSet[] = $role;
}
}
foreach ($newRoles as $roleName => $role) {
if (array_key_exists($roleName, $currentRoles)) {
$currentRole = $currentRoles[$roleName];
$newRole = $newRoles[$roleName];
$currentRoleInstances = $currentRole->getInstances();
$newRoleInstances = $newRole->getInstances();
$changedRoleSet = array_merge(
$changedRoleSet,
self::_calculateCurrentRoleInstanceChanges(
$role,
$currentRoleInstances,
$newRoleInstances
)
);
} else {
$changedRoleSet[] = $role;
}
}
foreach ($changedRoleSet as $role) {
$changes[] = new RoleEnvironmentTopologyChange($role);
}
return $changes;
} | [
"private",
"static",
"function",
"_calculateChanges",
"(",
")",
"{",
"$",
"current",
"=",
"self",
"::",
"$",
"_currentEnvironmentData",
";",
"$",
"newData",
"=",
"self",
"::",
"$",
"_runtimeClient",
"->",
"getRoleEnvironmentData",
"(",
")",
";",
"$",
"changes"... | Calculates changes.
@static
@return IRoleEnvironmentChange[] | [
"Calculates",
"changes",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L350-L408 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment._calculateConfigurationChanges | private static function _calculateConfigurationChanges(
RoleEnvironmentData $currentRoleEnvironment,
RoleEnvironmentData $newRoleEnvironment
) {
$changes = [];
$currentConfig = $currentRoleEnvironment->getConfigurationSettings();
$newConfig = $newRoleEnvironment->getConfigurationSettings();
foreach ($currentConfig as $settingKey => $setting) {
if (array_key_exists($settingKey, $newConfig)) {
if ($newConfig[$settingKey] != $currentConfig[$settingKey]) {
$changes[] = new RoleEnvironmentConfigurationSettingChange(
$settingKey
);
}
} else {
$changes[] = new RoleEnvironmentConfigurationSettingChange(
$settingKey
);
}
}
foreach ($newConfig as $settingKey => $setting) {
if (!array_key_exists($settingKey, $currentConfig)) {
$changes[] = new RoleEnvironmentConfigurationSettingChange(
$settingKey
);
}
}
return $changes;
} | php | private static function _calculateConfigurationChanges(
RoleEnvironmentData $currentRoleEnvironment,
RoleEnvironmentData $newRoleEnvironment
) {
$changes = [];
$currentConfig = $currentRoleEnvironment->getConfigurationSettings();
$newConfig = $newRoleEnvironment->getConfigurationSettings();
foreach ($currentConfig as $settingKey => $setting) {
if (array_key_exists($settingKey, $newConfig)) {
if ($newConfig[$settingKey] != $currentConfig[$settingKey]) {
$changes[] = new RoleEnvironmentConfigurationSettingChange(
$settingKey
);
}
} else {
$changes[] = new RoleEnvironmentConfigurationSettingChange(
$settingKey
);
}
}
foreach ($newConfig as $settingKey => $setting) {
if (!array_key_exists($settingKey, $currentConfig)) {
$changes[] = new RoleEnvironmentConfigurationSettingChange(
$settingKey
);
}
}
return $changes;
} | [
"private",
"static",
"function",
"_calculateConfigurationChanges",
"(",
"RoleEnvironmentData",
"$",
"currentRoleEnvironment",
",",
"RoleEnvironmentData",
"$",
"newRoleEnvironment",
")",
"{",
"$",
"changes",
"=",
"[",
"]",
";",
"$",
"currentConfig",
"=",
"$",
"currentR... | Calculates the configuration changes.
@param RoleEnvironmentData $currentRoleEnvironment The current role
environment data
@param RoleEnvironmentData $newRoleEnvironment The new role
environment data
@static
@return RoleEnvironmentConfigurationSettingChange[] | [
"Calculates",
"the",
"configuration",
"changes",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L422-L453 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.isAvailable | public static function isAvailable()
{
try {
self::_initialize();
} catch (RoleEnvironmentNotAvailableException $ex) {
return false;
} catch (ChannelNotAvailableException $ex) {
return false;
}
return self::$_runtimeClient != null;
} | php | public static function isAvailable()
{
try {
self::_initialize();
} catch (RoleEnvironmentNotAvailableException $ex) {
return false;
} catch (ChannelNotAvailableException $ex) {
return false;
}
return self::$_runtimeClient != null;
} | [
"public",
"static",
"function",
"isAvailable",
"(",
")",
"{",
"try",
"{",
"self",
"::",
"_initialize",
"(",
")",
";",
"}",
"catch",
"(",
"RoleEnvironmentNotAvailableException",
"$",
"ex",
")",
"{",
"return",
"false",
";",
"}",
"catch",
"(",
"ChannelNotAvaila... | Indicates whether the role instance is running in the Windows Azure
environment.
@static
@return bool | [
"Indicates",
"whether",
"the",
"role",
"instance",
"is",
"running",
"in",
"the",
"Windows",
"Azure",
"environment",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L677-L688 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.requestRecycle | public static function requestRecycle()
{
self::_initialize();
$recycleState = new AcquireCurrentState(
self::$_clientId,
self::$_currentGoalState->getIncarnation(),
CurrentStatus::RECYCLE,
self::$_maxDateTime
);
self::$_runtimeClient->setCurrentState($recycleState);
} | php | public static function requestRecycle()
{
self::_initialize();
$recycleState = new AcquireCurrentState(
self::$_clientId,
self::$_currentGoalState->getIncarnation(),
CurrentStatus::RECYCLE,
self::$_maxDateTime
);
self::$_runtimeClient->setCurrentState($recycleState);
} | [
"public",
"static",
"function",
"requestRecycle",
"(",
")",
"{",
"self",
"::",
"_initialize",
"(",
")",
";",
"$",
"recycleState",
"=",
"new",
"AcquireCurrentState",
"(",
"self",
"::",
"$",
"_clientId",
",",
"self",
"::",
"$",
"_currentGoalState",
"->",
"getI... | Requests that the current role instance be stopped and restarted.
Before the role instance is recycled, the Windows Azure load balancer
takes the role instance out of rotation.
This ensures that no new requests are routed to the instance while it
is restarting.
@static | [
"Requests",
"that",
"the",
"current",
"role",
"instance",
"be",
"stopped",
"and",
"restarted",
".",
"Before",
"the",
"role",
"instance",
"is",
"recycled",
"the",
"Windows",
"Azure",
"load",
"balancer",
"takes",
"the",
"role",
"instance",
"out",
"of",
"rotation... | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L762-L774 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.setStatus | public static function setStatus($status, \DateTime $expirationUtc)
{
self::_initialize();
$currentStatus = CurrentStatus::STARTED;
switch ($status) {
case RoleInstanceStatus::BUSY:
$currentStatus = CurrentStatus::BUSY;
break;
case RoleInstanceStatus::READY:
$currentStatus = CurrentStatus::STARTED;
break;
}
$newState = new AcquireCurrentState(
self::$_clientId,
self::$_currentGoalState->getIncarnation(),
$currentStatus,
$expirationUtc
);
self::$_lastState = $newState;
self::$_runtimeClient->setCurrentState($newState);
} | php | public static function setStatus($status, \DateTime $expirationUtc)
{
self::_initialize();
$currentStatus = CurrentStatus::STARTED;
switch ($status) {
case RoleInstanceStatus::BUSY:
$currentStatus = CurrentStatus::BUSY;
break;
case RoleInstanceStatus::READY:
$currentStatus = CurrentStatus::STARTED;
break;
}
$newState = new AcquireCurrentState(
self::$_clientId,
self::$_currentGoalState->getIncarnation(),
$currentStatus,
$expirationUtc
);
self::$_lastState = $newState;
self::$_runtimeClient->setCurrentState($newState);
} | [
"public",
"static",
"function",
"setStatus",
"(",
"$",
"status",
",",
"\\",
"DateTime",
"$",
"expirationUtc",
")",
"{",
"self",
"::",
"_initialize",
"(",
")",
";",
"$",
"currentStatus",
"=",
"CurrentStatus",
"::",
"STARTED",
";",
"switch",
"(",
"$",
"statu... | Sets the status of the role instance.
An instance may indicate that it is in one of two states: Ready or Busy.
If an instance's state is Ready, it is prepared to receive requests from
the load balancer. If the instance's state is Busy, it will not receive
requests from the load balancer.
@param int $status he new role status
@param \DateTime $expirationUtc The expiration UTC time
@static | [
"Sets",
"the",
"status",
"of",
"the",
"role",
"instance",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L789-L814 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.clearStatus | public static function clearStatus()
{
self::_initialize();
$newState = new ReleaseCurrentState(self::$_clientId);
self::$_lastState = $newState;
self::$_runtimeClient->setCurrentState($newState);
} | php | public static function clearStatus()
{
self::_initialize();
$newState = new ReleaseCurrentState(self::$_clientId);
self::$_lastState = $newState;
self::$_runtimeClient->setCurrentState($newState);
} | [
"public",
"static",
"function",
"clearStatus",
"(",
")",
"{",
"self",
"::",
"_initialize",
"(",
")",
";",
"$",
"newState",
"=",
"new",
"ReleaseCurrentState",
"(",
"self",
"::",
"$",
"_clientId",
")",
";",
"self",
"::",
"$",
"_lastState",
"=",
"$",
"newSt... | Clears the status of the role instance.
An instance may indicate that it has completed communicating status by
calling this method.
@static | [
"Clears",
"the",
"status",
"of",
"the",
"role",
"instance",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L824-L833 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.removeRoleEnvironmentChangedListener | public static function removeRoleEnvironmentChangedListener($listener)
{
foreach (self::$_changedListeners as $key => $changedListener) {
if ($changedListener == $listener) {
unset(self::$_changedListeners[$key]);
return true;
}
}
return false;
} | php | public static function removeRoleEnvironmentChangedListener($listener)
{
foreach (self::$_changedListeners as $key => $changedListener) {
if ($changedListener == $listener) {
unset(self::$_changedListeners[$key]);
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"removeRoleEnvironmentChangedListener",
"(",
"$",
"listener",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"_changedListeners",
"as",
"$",
"key",
"=>",
"$",
"changedListener",
")",
"{",
"if",
"(",
"$",
"changedListener",
"==",
"... | Removes an event listener for the Changed event.
@param callable $listener The changed listener
@static
@return bool | [
"Removes",
"an",
"event",
"listener",
"for",
"the",
"Changed",
"event",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L857-L868 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.removeRoleEnvironmentChangingListener | public static function removeRoleEnvironmentChangingListener($listener)
{
foreach (self::$_changingListeners as $key => $changingListener) {
if ($changingListener == $listener) {
unset(self::$_changingListeners[$key]);
return true;
}
}
return false;
} | php | public static function removeRoleEnvironmentChangingListener($listener)
{
foreach (self::$_changingListeners as $key => $changingListener) {
if ($changingListener == $listener) {
unset(self::$_changingListeners[$key]);
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"removeRoleEnvironmentChangingListener",
"(",
"$",
"listener",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"_changingListeners",
"as",
"$",
"key",
"=>",
"$",
"changingListener",
")",
"{",
"if",
"(",
"$",
"changingListener",
"==",... | Removes an event listener for the Changing event.
@param callable $listener The changing listener
@static
@return bool | [
"Removes",
"an",
"event",
"listener",
"for",
"the",
"Changing",
"event",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L909-L920 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/RoleEnvironment.php | RoleEnvironment.removeRoleEnvironmentStoppingListener | public static function removeRoleEnvironmentStoppingListener($listener)
{
foreach (self::$_stoppingListeners as $key => $stoppingListener) {
if ($stoppingListener == $listener) {
unset(self::$_stoppingListeners[$key]);
return true;
}
}
return false;
} | php | public static function removeRoleEnvironmentStoppingListener($listener)
{
foreach (self::$_stoppingListeners as $key => $stoppingListener) {
if ($stoppingListener == $listener) {
unset(self::$_stoppingListeners[$key]);
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"removeRoleEnvironmentStoppingListener",
"(",
"$",
"listener",
")",
"{",
"foreach",
"(",
"self",
"::",
"$",
"_stoppingListeners",
"as",
"$",
"key",
"=>",
"$",
"stoppingListener",
")",
"{",
"if",
"(",
"$",
"stoppingListener",
"==",... | Removes an event listener for the Stopping event.
@param callable $listener The stopping listener
@static
@return bool | [
"Removes",
"an",
"event",
"listener",
"for",
"the",
"Stopping",
"event",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/RoleEnvironment.php#L945-L956 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/ListQueuesResult.php | ListQueuesResult.parseXml | public function parseXml($response)
{
parent::parseXml($response);
$listQueuesResultXml = new \SimpleXMLElement($response);
$this->_queueInfos = [];
foreach ($listQueuesResultXml->entry as $entry) {
$queueInfo = new QueueInfo();
$queueInfo->parseXml($entry->asXML());
$this->_queueInfos[] = $queueInfo;
}
} | php | public function parseXml($response)
{
parent::parseXml($response);
$listQueuesResultXml = new \SimpleXMLElement($response);
$this->_queueInfos = [];
foreach ($listQueuesResultXml->entry as $entry) {
$queueInfo = new QueueInfo();
$queueInfo->parseXml($entry->asXML());
$this->_queueInfos[] = $queueInfo;
}
} | [
"public",
"function",
"parseXml",
"(",
"$",
"response",
")",
"{",
"parent",
"::",
"parseXml",
"(",
"$",
"response",
")",
";",
"$",
"listQueuesResultXml",
"=",
"new",
"\\",
"SimpleXMLElement",
"(",
"$",
"response",
")",
";",
"$",
"this",
"->",
"_queueInfos"... | Populates the properties with the response from the list queues request.
@param string $response The body of the response of the list queues request | [
"Populates",
"the",
"properties",
"with",
"the",
"response",
"from",
"the",
"list",
"queues",
"request",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/ListQueuesResult.php#L57-L67 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/RuleInfo.php | RuleInfo.parseXml | public function parseXml($xmlString)
{
$this->_entry->parseXml($xmlString);
$content = $this->_entry->getContent();
if (is_null($content)) {
$this->_ruleDescription = null;
} else {
$this->_ruleDescription = RuleDescription::create($content->getText());
}
} | php | public function parseXml($xmlString)
{
$this->_entry->parseXml($xmlString);
$content = $this->_entry->getContent();
if (is_null($content)) {
$this->_ruleDescription = null;
} else {
$this->_ruleDescription = RuleDescription::create($content->getText());
}
} | [
"public",
"function",
"parseXml",
"(",
"$",
"xmlString",
")",
"{",
"$",
"this",
"->",
"_entry",
"->",
"parseXml",
"(",
"$",
"xmlString",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"_entry",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"is_nul... | Populates the properties with a specified XML string based on ATOM
ENTRY schema.
@param string $xmlString An XML string representing a rule info instance | [
"Populates",
"the",
"properties",
"with",
"a",
"specified",
"XML",
"string",
"based",
"on",
"ATOM",
"ENTRY",
"schema",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/RuleInfo.php#L95-L104 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/RuleInfo.php | RuleInfo.withCorrelationFilter | public function withCorrelationFilter($correlationId)
{
$filter = new CorrelationFilter();
$filter->setCorrelationId($correlationId);
$this->_ruleDescription->setFilter($filter);
} | php | public function withCorrelationFilter($correlationId)
{
$filter = new CorrelationFilter();
$filter->setCorrelationId($correlationId);
$this->_ruleDescription->setFilter($filter);
} | [
"public",
"function",
"withCorrelationFilter",
"(",
"$",
"correlationId",
")",
"{",
"$",
"filter",
"=",
"new",
"CorrelationFilter",
"(",
")",
";",
"$",
"filter",
"->",
"setCorrelationId",
"(",
"$",
"correlationId",
")",
";",
"$",
"this",
"->",
"_ruleDescriptio... | With correlation ID filter.
@param string $correlationId The ID of the correlation | [
"With",
"correlation",
"ID",
"filter",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/RuleInfo.php#L231-L236 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/RuleInfo.php | RuleInfo.withSqlFilter | public function withSqlFilter($sqlExpression)
{
$filter = new SqlFilter();
$filter->setSqlExpression($sqlExpression);
$filter->setCompatibilityLevel(20);
$this->_ruleDescription->setFilter($filter);
} | php | public function withSqlFilter($sqlExpression)
{
$filter = new SqlFilter();
$filter->setSqlExpression($sqlExpression);
$filter->setCompatibilityLevel(20);
$this->_ruleDescription->setFilter($filter);
} | [
"public",
"function",
"withSqlFilter",
"(",
"$",
"sqlExpression",
")",
"{",
"$",
"filter",
"=",
"new",
"SqlFilter",
"(",
")",
";",
"$",
"filter",
"->",
"setSqlExpression",
"(",
"$",
"sqlExpression",
")",
";",
"$",
"filter",
"->",
"setCompatibilityLevel",
"("... | With sql expression filter.
@param string $sqlExpression The SQL expression of the filter | [
"With",
"sql",
"expression",
"filter",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/RuleInfo.php#L243-L249 | train |
Azure/azure-sdk-for-php | src/ServiceBus/Models/RuleInfo.php | RuleInfo.withSqlRuleAction | public function withSqlRuleAction($sqlExpression)
{
$action = new SqlRuleAction();
$action->setCompatibilityLevel(20);
$action->setSqlExpression($sqlExpression);
$this->_ruleDescription->setAction($action);
} | php | public function withSqlRuleAction($sqlExpression)
{
$action = new SqlRuleAction();
$action->setCompatibilityLevel(20);
$action->setSqlExpression($sqlExpression);
$this->_ruleDescription->setAction($action);
} | [
"public",
"function",
"withSqlRuleAction",
"(",
"$",
"sqlExpression",
")",
"{",
"$",
"action",
"=",
"new",
"SqlRuleAction",
"(",
")",
";",
"$",
"action",
"->",
"setCompatibilityLevel",
"(",
"20",
")",
";",
"$",
"action",
"->",
"setSqlExpression",
"(",
"$",
... | With SQL rule action.
@param string $sqlExpression The SQL expression
of the rule action | [
"With",
"SQL",
"rule",
"action",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceBus/Models/RuleInfo.php#L284-L290 | train |
Azure/azure-sdk-for-php | src/Common/Internal/StorageServiceSettings.php | StorageServiceSettings._getDevelopmentStorageAccount | private static function _getDevelopmentStorageAccount($proxyUri)
{
if (is_null($proxyUri)) {
return self::developmentStorageAccount();
}
$scheme = parse_url($proxyUri, PHP_URL_SCHEME);
$host = parse_url($proxyUri, PHP_URL_HOST);
$prefix = $scheme.'://'.$host;
return new self(
Resources::DEV_STORE_NAME,
Resources::DEV_STORE_KEY,
$prefix.':10000/devstoreaccount1/',
$prefix.':10001/devstoreaccount1/',
$prefix.':10002/devstoreaccount1/'
);
} | php | private static function _getDevelopmentStorageAccount($proxyUri)
{
if (is_null($proxyUri)) {
return self::developmentStorageAccount();
}
$scheme = parse_url($proxyUri, PHP_URL_SCHEME);
$host = parse_url($proxyUri, PHP_URL_HOST);
$prefix = $scheme.'://'.$host;
return new self(
Resources::DEV_STORE_NAME,
Resources::DEV_STORE_KEY,
$prefix.':10000/devstoreaccount1/',
$prefix.':10001/devstoreaccount1/',
$prefix.':10002/devstoreaccount1/'
);
} | [
"private",
"static",
"function",
"_getDevelopmentStorageAccount",
"(",
"$",
"proxyUri",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"proxyUri",
")",
")",
"{",
"return",
"self",
"::",
"developmentStorageAccount",
"(",
")",
";",
"}",
"$",
"scheme",
"=",
"parse_u... | Returns a StorageServiceSettings with development storage credentials using
the specified proxy Uri.
@param string $proxyUri The proxy endpoint to use
@return StorageServiceSettings | [
"Returns",
"a",
"StorageServiceSettings",
"with",
"development",
"storage",
"credentials",
"using",
"the",
"specified",
"proxy",
"Uri",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/StorageServiceSettings.php#L247-L264 | train |
Azure/azure-sdk-for-php | src/Common/Internal/StorageServiceSettings.php | StorageServiceSettings.developmentStorageAccount | public static function developmentStorageAccount()
{
if (is_null(self::$_devStoreAccount)) {
self::$_devStoreAccount = self::_getDevelopmentStorageAccount(
Resources::DEV_STORE_URI
);
}
return self::$_devStoreAccount;
} | php | public static function developmentStorageAccount()
{
if (is_null(self::$_devStoreAccount)) {
self::$_devStoreAccount = self::_getDevelopmentStorageAccount(
Resources::DEV_STORE_URI
);
}
return self::$_devStoreAccount;
} | [
"public",
"static",
"function",
"developmentStorageAccount",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_devStoreAccount",
")",
")",
"{",
"self",
"::",
"$",
"_devStoreAccount",
"=",
"self",
"::",
"_getDevelopmentStorageAccount",
"(",
"Resource... | Gets a StorageServiceSettings object that references the development storage
account.
@return StorageServiceSettings | [
"Gets",
"a",
"StorageServiceSettings",
"object",
"that",
"references",
"the",
"development",
"storage",
"account",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/StorageServiceSettings.php#L272-L281 | train |
Azure/azure-sdk-for-php | src/Common/Internal/StorageServiceSettings.php | StorageServiceSettings._getDefaultServiceEndpoint | private static function _getDefaultServiceEndpoint($settings, $dns)
{
$scheme = Utilities::tryGetValueInsensitive(
Resources::DEFAULT_ENDPOINTS_PROTOCOL_NAME,
$settings
);
$accountName = Utilities::tryGetValueInsensitive(
Resources::ACCOUNT_NAME_NAME,
$settings
);
return sprintf(Resources::SERVICE_URI_FORMAT, $scheme, $accountName, $dns);
} | php | private static function _getDefaultServiceEndpoint($settings, $dns)
{
$scheme = Utilities::tryGetValueInsensitive(
Resources::DEFAULT_ENDPOINTS_PROTOCOL_NAME,
$settings
);
$accountName = Utilities::tryGetValueInsensitive(
Resources::ACCOUNT_NAME_NAME,
$settings
);
return sprintf(Resources::SERVICE_URI_FORMAT, $scheme, $accountName, $dns);
} | [
"private",
"static",
"function",
"_getDefaultServiceEndpoint",
"(",
"$",
"settings",
",",
"$",
"dns",
")",
"{",
"$",
"scheme",
"=",
"Utilities",
"::",
"tryGetValueInsensitive",
"(",
"Resources",
"::",
"DEFAULT_ENDPOINTS_PROTOCOL_NAME",
",",
"$",
"settings",
")",
"... | Gets the default service endpoint using the specified protocol and account
name.
@param array $settings The service settings
@param string $dns The service DNS
@return string | [
"Gets",
"the",
"default",
"service",
"endpoint",
"using",
"the",
"specified",
"protocol",
"and",
"account",
"name",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/StorageServiceSettings.php#L292-L304 | train |
Azure/azure-sdk-for-php | src/Common/Internal/StorageServiceSettings.php | StorageServiceSettings._createStorageServiceSettings | private static function _createStorageServiceSettings(
$settings,
$blobEndpointUri = null,
$queueEndpointUri = null,
$tableEndpointUri = null
) {
$blobEndpointUri = Utilities::tryGetValueInsensitive(
Resources::BLOB_ENDPOINT_NAME,
$settings,
$blobEndpointUri
);
$queueEndpointUri = Utilities::tryGetValueInsensitive(
Resources::QUEUE_ENDPOINT_NAME,
$settings,
$queueEndpointUri
);
$tableEndpointUri = Utilities::tryGetValueInsensitive(
Resources::TABLE_ENDPOINT_NAME,
$settings,
$tableEndpointUri
);
$accountName = Utilities::tryGetValueInsensitive(
Resources::ACCOUNT_NAME_NAME,
$settings
);
$accountKey = Utilities::tryGetValueInsensitive(
Resources::ACCOUNT_KEY_NAME,
$settings
);
return new self(
$accountName,
$accountKey,
$blobEndpointUri,
$queueEndpointUri,
$tableEndpointUri
);
} | php | private static function _createStorageServiceSettings(
$settings,
$blobEndpointUri = null,
$queueEndpointUri = null,
$tableEndpointUri = null
) {
$blobEndpointUri = Utilities::tryGetValueInsensitive(
Resources::BLOB_ENDPOINT_NAME,
$settings,
$blobEndpointUri
);
$queueEndpointUri = Utilities::tryGetValueInsensitive(
Resources::QUEUE_ENDPOINT_NAME,
$settings,
$queueEndpointUri
);
$tableEndpointUri = Utilities::tryGetValueInsensitive(
Resources::TABLE_ENDPOINT_NAME,
$settings,
$tableEndpointUri
);
$accountName = Utilities::tryGetValueInsensitive(
Resources::ACCOUNT_NAME_NAME,
$settings
);
$accountKey = Utilities::tryGetValueInsensitive(
Resources::ACCOUNT_KEY_NAME,
$settings
);
return new self(
$accountName,
$accountKey,
$blobEndpointUri,
$queueEndpointUri,
$tableEndpointUri
);
} | [
"private",
"static",
"function",
"_createStorageServiceSettings",
"(",
"$",
"settings",
",",
"$",
"blobEndpointUri",
"=",
"null",
",",
"$",
"queueEndpointUri",
"=",
"null",
",",
"$",
"tableEndpointUri",
"=",
"null",
")",
"{",
"$",
"blobEndpointUri",
"=",
"Utilit... | Creates StorageServiceSettings object given endpoints uri.
@param array $settings The service settings
@param string $blobEndpointUri The blob endpoint uri
@param string $queueEndpointUri The queue endpoint uri
@param string $tableEndpointUri The table endpoint uri
@return \WindowsAzure\Common\Internal\StorageServiceSettings | [
"Creates",
"StorageServiceSettings",
"object",
"given",
"endpoints",
"uri",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/StorageServiceSettings.php#L316-L353 | train |
Azure/azure-sdk-for-php | src/Common/Internal/StorageServiceSettings.php | StorageServiceSettings.createFromConnectionString | public static function createFromConnectionString($connectionString)
{
$tokenizedSettings = self::parseAndValidateKeys($connectionString);
// Devstore case
$matchedSpecs = self::matchedSpecification(
$tokenizedSettings,
self::allRequired(self::$_useDevelopmentStorageSetting),
self::optional(self::$_developmentStorageProxyUriSetting)
);
if ($matchedSpecs) {
$proxyUri = Utilities::tryGetValueInsensitive(
Resources::DEVELOPMENT_STORAGE_PROXY_URI_NAME,
$tokenizedSettings
);
return self::_getDevelopmentStorageAccount($proxyUri);
}
// Automatic case
$matchedSpecs = self::matchedSpecification(
$tokenizedSettings,
self::allRequired(
self::$_defaultEndpointsProtocolSetting,
self::$_accountNameSetting,
self::$_accountKeySetting
),
self::optional(
self::$_blobEndpointSetting,
self::$_queueEndpointSetting,
self::$_tableEndpointSetting
)
);
if ($matchedSpecs) {
return self::_createStorageServiceSettings(
$tokenizedSettings,
self::_getDefaultServiceEndpoint(
$tokenizedSettings,
Resources::BLOB_BASE_DNS_NAME
),
self::_getDefaultServiceEndpoint(
$tokenizedSettings,
Resources::QUEUE_BASE_DNS_NAME
),
self::_getDefaultServiceEndpoint(
$tokenizedSettings,
Resources::TABLE_BASE_DNS_NAME
)
);
}
// Explicit case
$matchedSpecs = self::matchedSpecification(
$tokenizedSettings,
self::atLeastOne(
self::$_blobEndpointSetting,
self::$_queueEndpointSetting,
self::$_tableEndpointSetting
),
self::allRequired(
self::$_accountNameSetting,
self::$_accountKeySetting
)
);
if ($matchedSpecs) {
return self::_createStorageServiceSettings($tokenizedSettings);
}
self::noMatch($connectionString);
return null;
} | php | public static function createFromConnectionString($connectionString)
{
$tokenizedSettings = self::parseAndValidateKeys($connectionString);
// Devstore case
$matchedSpecs = self::matchedSpecification(
$tokenizedSettings,
self::allRequired(self::$_useDevelopmentStorageSetting),
self::optional(self::$_developmentStorageProxyUriSetting)
);
if ($matchedSpecs) {
$proxyUri = Utilities::tryGetValueInsensitive(
Resources::DEVELOPMENT_STORAGE_PROXY_URI_NAME,
$tokenizedSettings
);
return self::_getDevelopmentStorageAccount($proxyUri);
}
// Automatic case
$matchedSpecs = self::matchedSpecification(
$tokenizedSettings,
self::allRequired(
self::$_defaultEndpointsProtocolSetting,
self::$_accountNameSetting,
self::$_accountKeySetting
),
self::optional(
self::$_blobEndpointSetting,
self::$_queueEndpointSetting,
self::$_tableEndpointSetting
)
);
if ($matchedSpecs) {
return self::_createStorageServiceSettings(
$tokenizedSettings,
self::_getDefaultServiceEndpoint(
$tokenizedSettings,
Resources::BLOB_BASE_DNS_NAME
),
self::_getDefaultServiceEndpoint(
$tokenizedSettings,
Resources::QUEUE_BASE_DNS_NAME
),
self::_getDefaultServiceEndpoint(
$tokenizedSettings,
Resources::TABLE_BASE_DNS_NAME
)
);
}
// Explicit case
$matchedSpecs = self::matchedSpecification(
$tokenizedSettings,
self::atLeastOne(
self::$_blobEndpointSetting,
self::$_queueEndpointSetting,
self::$_tableEndpointSetting
),
self::allRequired(
self::$_accountNameSetting,
self::$_accountKeySetting
)
);
if ($matchedSpecs) {
return self::_createStorageServiceSettings($tokenizedSettings);
}
self::noMatch($connectionString);
return null;
} | [
"public",
"static",
"function",
"createFromConnectionString",
"(",
"$",
"connectionString",
")",
"{",
"$",
"tokenizedSettings",
"=",
"self",
"::",
"parseAndValidateKeys",
"(",
"$",
"connectionString",
")",
";",
"// Devstore case",
"$",
"matchedSpecs",
"=",
"self",
"... | Creates a StorageServiceSettings object from the given connection string.
@param string $connectionString The storage settings connection string
@return StorageServiceSettings | [
"Creates",
"a",
"StorageServiceSettings",
"object",
"from",
"the",
"given",
"connection",
"string",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/StorageServiceSettings.php#L362-L432 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/Protocol1RuntimeCurrentStateClient.php | Protocol1RuntimeCurrentStateClient.setCurrentState | public function setCurrentState(CurrentState $state)
{
$outputStream = $this->_outputChannel->getOutputStream($this->_endpoint);
$this->_serializer->serialize($state, $outputStream);
fclose($outputStream);
} | php | public function setCurrentState(CurrentState $state)
{
$outputStream = $this->_outputChannel->getOutputStream($this->_endpoint);
$this->_serializer->serialize($state, $outputStream);
fclose($outputStream);
} | [
"public",
"function",
"setCurrentState",
"(",
"CurrentState",
"$",
"state",
")",
"{",
"$",
"outputStream",
"=",
"$",
"this",
"->",
"_outputChannel",
"->",
"getOutputStream",
"(",
"$",
"this",
"->",
"_endpoint",
")",
";",
"$",
"this",
"->",
"_serializer",
"->... | Sets the current state.
@param CurrentState $state The current state | [
"Sets",
"the",
"current",
"state",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/Protocol1RuntimeCurrentStateClient.php#L87-L92 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/MediaProcessor.php | MediaProcessor.fromArray | public function fromArray(array $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['Description'])) {
Validate::isString($options['Description'], 'options[Description]');
$this->_description = $options['Description'];
}
if (isset($options['Sku'])) {
Validate::isString($options['Sku'], 'options[Sku]');
$this->_sku = $options['Sku'];
}
if (isset($options['Vendor'])) {
Validate::isString($options['Vendor'], 'options[Vendor]');
$this->_vendor = $options['Vendor'];
}
if (isset($options['Version'])) {
Validate::isString($options['Version'], 'options[Version]');
$this->_version = $options['Version'];
}
} | php | public function fromArray(array $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['Description'])) {
Validate::isString($options['Description'], 'options[Description]');
$this->_description = $options['Description'];
}
if (isset($options['Sku'])) {
Validate::isString($options['Sku'], 'options[Sku]');
$this->_sku = $options['Sku'];
}
if (isset($options['Vendor'])) {
Validate::isString($options['Vendor'], 'options[Vendor]');
$this->_vendor = $options['Vendor'];
}
if (isset($options['Version'])) {
Validate::isString($options['Version'], 'options[Version]');
$this->_version = $options['Version'];
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Id'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'Id'",
"]",
",",
"'options[Id]'",
")",
";",
... | Fill media processor from array.
@param array $options Array containing values for object properties | [
"Fill",
"media",
"processor",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/MediaProcessor.php#L114-L145 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Authentication/OAuthScheme.php | OAuthScheme.getAuthorizationHeader | public function getAuthorizationHeader($headers, $url, $queryParams, $httpMethod)
{
if (($this->accessToken == null)
|| ($this->accessToken->getExpiresIn() < time())
) {
$this->accessToken = $this->oauthService->getAccessToken(
$this->grantType,
$this->accountName,
$this->accountKey,
$this->scope
);
}
return Resources::OAUTH_ACCESS_TOKEN_PREFIX.
$this->accessToken->getAccessToken();
} | php | public function getAuthorizationHeader($headers, $url, $queryParams, $httpMethod)
{
if (($this->accessToken == null)
|| ($this->accessToken->getExpiresIn() < time())
) {
$this->accessToken = $this->oauthService->getAccessToken(
$this->grantType,
$this->accountName,
$this->accountKey,
$this->scope
);
}
return Resources::OAUTH_ACCESS_TOKEN_PREFIX.
$this->accessToken->getAccessToken();
} | [
"public",
"function",
"getAuthorizationHeader",
"(",
"$",
"headers",
",",
"$",
"url",
",",
"$",
"queryParams",
",",
"$",
"httpMethod",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"accessToken",
"==",
"null",
")",
"||",
"(",
"$",
"this",
"->",
"accessT... | Returns authorization header to be included in the request.
@param array $headers request headers
@param string $url request url
@param array $queryParams query variables
@param string $httpMethod request http method
@see Specifying the Authorization Header section at
http://msdn.microsoft.com/en-us/library/windowsazure/dd179428.aspx
@return string | [
"Returns",
"authorization",
"header",
"to",
"be",
"included",
"in",
"the",
"request",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Authentication/OAuthScheme.php#L120-L135 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/AssetDeliveryPolicyConfigurationKey.php | AssetDeliveryPolicyConfigurationKey.stringifyAssetDeliveryPolicyConfigurationKey | public static function stringifyAssetDeliveryPolicyConfigurationKey(array $array)
{
$jsonArray = [];
foreach ($array as $key => $value) {
$jsonArray[] = ['Key' => $key, 'Value' => $value];
}
return json_encode($jsonArray);
} | php | public static function stringifyAssetDeliveryPolicyConfigurationKey(array $array)
{
$jsonArray = [];
foreach ($array as $key => $value) {
$jsonArray[] = ['Key' => $key, 'Value' => $value];
}
return json_encode($jsonArray);
} | [
"public",
"static",
"function",
"stringifyAssetDeliveryPolicyConfigurationKey",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"jsonArray",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"jsonArray",
"[",... | Helper function to stringify the AssetDeliveryPolicyConfigurationKey.
@param array $array
@return string | [
"Helper",
"function",
"to",
"stringify",
"the",
"AssetDeliveryPolicyConfigurationKey",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/AssetDeliveryPolicyConfigurationKey.php#L135-L143 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/AssetDeliveryPolicyConfigurationKey.php | AssetDeliveryPolicyConfigurationKey.parseAssetDeliveryPolicyConfigurationKey | public static function parseAssetDeliveryPolicyConfigurationKey($json)
{
$result = [];
$array = json_decode($json, true);
foreach ($array as $item) {
$item = array_change_key_case($item, CASE_LOWER);
$result[$item['key']] = $item['value'];
}
return $result;
} | php | public static function parseAssetDeliveryPolicyConfigurationKey($json)
{
$result = [];
$array = json_decode($json, true);
foreach ($array as $item) {
$item = array_change_key_case($item, CASE_LOWER);
$result[$item['key']] = $item['value'];
}
return $result;
} | [
"public",
"static",
"function",
"parseAssetDeliveryPolicyConfigurationKey",
"(",
"$",
"json",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"array",
"=",
"json_decode",
"(",
"$",
"json",
",",
"true",
")",
";",
"foreach",
"(",
"$",
"array",
"as",
"$",... | Helper function to pack the AssetDeliveryPolicyConfigurationKey.
@param string $json
@return array the unpacked array | [
"Helper",
"function",
"to",
"pack",
"the",
"AssetDeliveryPolicyConfigurationKey",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/AssetDeliveryPolicyConfigurationKey.php#L152-L162 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Http/HttpCallContext.php | HttpCallContext.removeHeader | public function removeHeader($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
unset($this->_headers[$name]);
} | php | public function removeHeader($name)
{
Validate::isString($name, 'name');
Validate::notNullOrEmpty($name, 'name');
unset($this->_headers[$name]);
} | [
"public",
"function",
"removeHeader",
"(",
"$",
"name",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"Validate",
"::",
"notNullOrEmpty",
"(",
"$",
"name",
",",
"'name'",
")",
";",
"unset",
"(",
"$",
"this",
"->",
... | Removes header from the HTTP request headers.
@param string $name The HTTP header name | [
"Removes",
"header",
"from",
"the",
"HTTP",
"request",
"headers",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Http/HttpCallContext.php#L299-L305 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/FileInputChannel.php | FileInputChannel.getInputStream | public function getInputStream($name)
{
$this->_inputStream = @fopen($name, 'r');
if ($this->_inputStream) {
return $this->_inputStream;
} else {
throw new ChannelNotAvailableException();
}
} | php | public function getInputStream($name)
{
$this->_inputStream = @fopen($name, 'r');
if ($this->_inputStream) {
return $this->_inputStream;
} else {
throw new ChannelNotAvailableException();
}
} | [
"public",
"function",
"getInputStream",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"_inputStream",
"=",
"@",
"fopen",
"(",
"$",
"name",
",",
"'r'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_inputStream",
")",
"{",
"return",
"$",
"this",
"->",
"... | Gets the input stream.
@param string $name The input stream path
@return resource
@throws ChannelNotAvailableException | [
"Gets",
"the",
"input",
"stream",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/FileInputChannel.php#L59-L67 | train |
Azure/azure-sdk-for-php | src/ServiceRuntime/Internal/FileInputChannel.php | FileInputChannel.closeInputStream | public function closeInputStream()
{
if (!is_null($this->_inputStream)) {
fclose($this->_inputStream);
$this->_inputStream = null;
}
} | php | public function closeInputStream()
{
if (!is_null($this->_inputStream)) {
fclose($this->_inputStream);
$this->_inputStream = null;
}
} | [
"public",
"function",
"closeInputStream",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"_inputStream",
")",
")",
"{",
"fclose",
"(",
"$",
"this",
"->",
"_inputStream",
")",
";",
"$",
"this",
"->",
"_inputStream",
"=",
"null",
";",
... | Closes the input stream. | [
"Closes",
"the",
"input",
"stream",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceRuntime/Internal/FileInputChannel.php#L72-L78 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/TaskHistoricalEvent.php | TaskHistoricalEvent.fromArray | public function fromArray(array $options)
{
if (isset($options['Code'])) {
Validate::isInteger($options['Code'], 'options[Code]');
$this->_code = $options['Code'];
}
if (isset($options['Message'])) {
Validate::isString($options['Message'], 'options[Message]');
$this->_message = $options['Message'];
}
if (isset($options['TimeStamp'])) {
Validate::isDateString($options['TimeStamp'], 'options[TimeStamp]');
$this->_timeStamp = new \DateTime($options['TimeStamp']);
}
} | php | public function fromArray(array $options)
{
if (isset($options['Code'])) {
Validate::isInteger($options['Code'], 'options[Code]');
$this->_code = $options['Code'];
}
if (isset($options['Message'])) {
Validate::isString($options['Message'], 'options[Message]');
$this->_message = $options['Message'];
}
if (isset($options['TimeStamp'])) {
Validate::isDateString($options['TimeStamp'], 'options[TimeStamp]');
$this->_timeStamp = new \DateTime($options['TimeStamp']);
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Code'",
"]",
")",
")",
"{",
"Validate",
"::",
"isInteger",
"(",
"$",
"options",
"[",
"'Code'",
"]",
",",
"'options[Code]'",
")",
... | Fill task historical event from array.
@param array $options Array containing values for object properties | [
"Fill",
"task",
"historical",
"event",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/TaskHistoricalEvent.php#L93-L109 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/ListStorageServicesResult.php | ListStorageServicesResult.create | public static function create($parsed)
{
$result = new self();
$rowStorageServices = Utilities::tryGetArray(
Resources::XTAG_STORAGE_SERVICE,
$parsed
);
foreach ($rowStorageServices as $rowStorageService) {
$result->_storageServices[] = new StorageService($rowStorageService);
}
return $result;
} | php | public static function create($parsed)
{
$result = new self();
$rowStorageServices = Utilities::tryGetArray(
Resources::XTAG_STORAGE_SERVICE,
$parsed
);
foreach ($rowStorageServices as $rowStorageService) {
$result->_storageServices[] = new StorageService($rowStorageService);
}
return $result;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"result",
"=",
"new",
"self",
"(",
")",
";",
"$",
"rowStorageServices",
"=",
"Utilities",
"::",
"tryGetArray",
"(",
"Resources",
"::",
"XTAG_STORAGE_SERVICE",
",",
"$",
"parsed",
... | Creates new ListStorageServicesResult from parsed response body.
@param array $parsed The parsed response body
@return ListStorageServicesResult | [
"Creates",
"new",
"ListStorageServicesResult",
"from",
"parsed",
"response",
"body",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/ListStorageServicesResult.php#L58-L71 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/Locator.php | Locator.createFromOptions | public static function createFromOptions(array $options)
{
Validate::notNull($options['AssetId'], 'options[AssetId]');
Validate::notNull($options['AccessPolicyId'], 'options[AccessPolicyId]');
Validate::notNull($options['Type'], 'options[Type]');
$locator = new self(
$options['AssetId'],
$options['AccessPolicyId'],
$options['Type']
);
$locator->fromArray($options);
return $locator;
} | php | public static function createFromOptions(array $options)
{
Validate::notNull($options['AssetId'], 'options[AssetId]');
Validate::notNull($options['AccessPolicyId'], 'options[AccessPolicyId]');
Validate::notNull($options['Type'], 'options[Type]');
$locator = new self(
$options['AssetId'],
$options['AccessPolicyId'],
$options['Type']
);
$locator->fromArray($options);
return $locator;
} | [
"public",
"static",
"function",
"createFromOptions",
"(",
"array",
"$",
"options",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"[",
"'AssetId'",
"]",
",",
"'options[AssetId]'",
")",
";",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"[",
... | Create locator from array.
@param array $options Array containing values for object properties
@return Locator | [
"Create",
"locator",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/Locator.php#L145-L159 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/Locator.php | Locator.fromArray | public function fromArray(array $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['ExpirationDateTime'])) {
Validate::isDateString(
$options['ExpirationDateTime'],
'options[ExpirationDateTime]'
);
$this->_expirationDateTime = new \DateTime(
$options['ExpirationDateTime']
);
}
if (isset($options['Type'])) {
Validate::isInteger($options['Type'], 'options[Type]');
$this->_type = $options['Type'];
}
if (isset($options['Path'])) {
Validate::isValidUri($options['Path'], 'options[Path]');
$this->_path = $options['Path'];
}
if (isset($options['BaseUri'])) {
Validate::isValidUri($options['BaseUri'], 'options[BaseUri]');
$this->_baseUri = $options['BaseUri'];
}
if (isset($options['ContentAccessComponent'])) {
Validate::isString(
$options['ContentAccessComponent'],
'options[ContentAccessComponent]'
);
$this->_contentAccessComponent = $options['ContentAccessComponent'];
}
if (isset($options['AccessPolicyId'])) {
Validate::isString(
$options['AccessPolicyId'],
'options[AccessPolicyId]'
);
$this->_accessPolicyId = $options['AccessPolicyId'];
}
if (isset($options['AssetId'])) {
Validate::isString($options['AssetId'], 'options[AssetId]');
$this->_assetId = $options['AssetId'];
}
if (isset($options['StartTime'])) {
Validate::isDateString($options['StartTime'], 'options[StartTime]');
$this->_startTime = new \DateTime($options['StartTime']);
}
} | php | public function fromArray(array $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['ExpirationDateTime'])) {
Validate::isDateString(
$options['ExpirationDateTime'],
'options[ExpirationDateTime]'
);
$this->_expirationDateTime = new \DateTime(
$options['ExpirationDateTime']
);
}
if (isset($options['Type'])) {
Validate::isInteger($options['Type'], 'options[Type]');
$this->_type = $options['Type'];
}
if (isset($options['Path'])) {
Validate::isValidUri($options['Path'], 'options[Path]');
$this->_path = $options['Path'];
}
if (isset($options['BaseUri'])) {
Validate::isValidUri($options['BaseUri'], 'options[BaseUri]');
$this->_baseUri = $options['BaseUri'];
}
if (isset($options['ContentAccessComponent'])) {
Validate::isString(
$options['ContentAccessComponent'],
'options[ContentAccessComponent]'
);
$this->_contentAccessComponent = $options['ContentAccessComponent'];
}
if (isset($options['AccessPolicyId'])) {
Validate::isString(
$options['AccessPolicyId'],
'options[AccessPolicyId]'
);
$this->_accessPolicyId = $options['AccessPolicyId'];
}
if (isset($options['AssetId'])) {
Validate::isString($options['AssetId'], 'options[AssetId]');
$this->_assetId = $options['AssetId'];
}
if (isset($options['StartTime'])) {
Validate::isDateString($options['StartTime'], 'options[StartTime]');
$this->_startTime = new \DateTime($options['StartTime']);
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Id'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'Id'",
"]",
",",
"'options[Id]'",
")",
";",
... | Fill locator from array.
@param array $options Array containing values for object properties | [
"Fill",
"locator",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/Locator.php#L186-L248 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/AtomLink.php | AtomLink.parseXml | public function parseXml($xmlString)
{
Validate::notNull($xmlString, 'xmlString');
Validate::isString($xmlString, 'xmlString');
$atomLinkXml = simplexml_load_string($xmlString);
$attributes = $atomLinkXml->attributes();
if (!empty($attributes['href'])) {
$this->href = (string) $attributes['href'];
}
if (!empty($attributes['rel'])) {
$this->rel = (string) $attributes['rel'];
}
if (!empty($attributes['type'])) {
$this->type = (string) $attributes['type'];
}
if (!empty($attributes['hreflang'])) {
$this->hreflang = (string) $attributes['hreflang'];
}
if (!empty($attributes['title'])) {
$this->title = (string) $attributes['title'];
}
if (!empty($attributes['length'])) {
$this->length = (int) $attributes['length'];
}
$undefinedContent = (string) $atomLinkXml;
if (empty($undefinedContent)) {
$this->undefinedContent = null;
} else {
$this->undefinedContent = (string) $atomLinkXml;
}
} | php | public function parseXml($xmlString)
{
Validate::notNull($xmlString, 'xmlString');
Validate::isString($xmlString, 'xmlString');
$atomLinkXml = simplexml_load_string($xmlString);
$attributes = $atomLinkXml->attributes();
if (!empty($attributes['href'])) {
$this->href = (string) $attributes['href'];
}
if (!empty($attributes['rel'])) {
$this->rel = (string) $attributes['rel'];
}
if (!empty($attributes['type'])) {
$this->type = (string) $attributes['type'];
}
if (!empty($attributes['hreflang'])) {
$this->hreflang = (string) $attributes['hreflang'];
}
if (!empty($attributes['title'])) {
$this->title = (string) $attributes['title'];
}
if (!empty($attributes['length'])) {
$this->length = (int) $attributes['length'];
}
$undefinedContent = (string) $atomLinkXml;
if (empty($undefinedContent)) {
$this->undefinedContent = null;
} else {
$this->undefinedContent = (string) $atomLinkXml;
}
} | [
"public",
"function",
"parseXml",
"(",
"$",
"xmlString",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"xmlString",
",",
"'xmlString'",
")",
";",
"Validate",
"::",
"isString",
"(",
"$",
"xmlString",
",",
"'xmlString'",
")",
";",
"$",
"atomLinkXml",
"=",... | Parse an ATOM Link xml.
@param string $xmlString an XML based string of ATOM Link | [
"Parse",
"an",
"ATOM",
"Link",
"xml",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/AtomLink.php#L100-L137 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/AtomLink.php | AtomLink.writeXml | public function writeXml(\XMLWriter $xmlWriter)
{
$xmlWriter->startElementNS(
'atom',
Resources::LINK,
Resources::ATOM_NAMESPACE
);
$this->writeInnerXml($xmlWriter);
$xmlWriter->endElement();
} | php | public function writeXml(\XMLWriter $xmlWriter)
{
$xmlWriter->startElementNS(
'atom',
Resources::LINK,
Resources::ATOM_NAMESPACE
);
$this->writeInnerXml($xmlWriter);
$xmlWriter->endElement();
} | [
"public",
"function",
"writeXml",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
")",
"{",
"$",
"xmlWriter",
"->",
"startElementNS",
"(",
"'atom'",
",",
"Resources",
"::",
"LINK",
",",
"Resources",
"::",
"ATOM_NAMESPACE",
")",
";",
"$",
"this",
"->",
"writeInnerX... | Writes an XML representing the ATOM link item.
@param \XMLWriter $xmlWriter The xml writer | [
"Writes",
"an",
"XML",
"representing",
"the",
"ATOM",
"link",
"item",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/AtomLink.php#L284-L293 | train |
Azure/azure-sdk-for-php | src/Common/Internal/Atom/AtomLink.php | AtomLink.writeInnerXml | public function writeInnerXml(\XMLWriter $xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
$this->writeOptionalAttribute($xmlWriter, 'href', $this->href);
$this->writeOptionalAttribute($xmlWriter, 'rel', $this->rel);
$this->writeOptionalAttribute($xmlWriter, 'type', $this->type);
$this->writeOptionalAttribute($xmlWriter, 'hreflang', $this->hreflang);
$this->writeOptionalAttribute($xmlWriter, 'title', $this->title);
$this->writeOptionalAttribute($xmlWriter, 'length', $this->length);
if (!empty($this->undefinedContent)) {
$xmlWriter->writeRaw($this->undefinedContent);
}
} | php | public function writeInnerXml(\XMLWriter $xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
$this->writeOptionalAttribute($xmlWriter, 'href', $this->href);
$this->writeOptionalAttribute($xmlWriter, 'rel', $this->rel);
$this->writeOptionalAttribute($xmlWriter, 'type', $this->type);
$this->writeOptionalAttribute($xmlWriter, 'hreflang', $this->hreflang);
$this->writeOptionalAttribute($xmlWriter, 'title', $this->title);
$this->writeOptionalAttribute($xmlWriter, 'length', $this->length);
if (!empty($this->undefinedContent)) {
$xmlWriter->writeRaw($this->undefinedContent);
}
} | [
"public",
"function",
"writeInnerXml",
"(",
"\\",
"XMLWriter",
"$",
"xmlWriter",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"xmlWriter",
",",
"'xmlWriter'",
")",
";",
"$",
"this",
"->",
"writeOptionalAttribute",
"(",
"$",
"xmlWriter",
",",
"'href'",
",... | Writes the inner XML representing the ATOM link item.
@param \XMLWriter $xmlWriter The xml writer | [
"Writes",
"the",
"inner",
"XML",
"representing",
"the",
"ATOM",
"link",
"item",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/Common/Internal/Atom/AtomLink.php#L300-L314 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/ChannelInput.php | ChannelInput.fromArray | public function fromArray($options)
{
if (!empty($options['KeyFrameInterval'])) {
Validate::isString($options['KeyFrameInterval'], 'options[KeyFrameInterval]');
$this->_keyFrameInterval = $options['KeyFrameInterval'];
}
if (isset($options['StreamingProtocol'])) {
Validate::isString($options['StreamingProtocol'], 'options[StreamingProtocol]');
$this->_streamingProtocol = $options['StreamingProtocol'];
}
if (isset($options['AccessControl'])) {
Validate::isArray($options['AccessControl'], 'options[AccessControl]');
$this->_accessControl = ChannelInputAccessControl::createFromOptions($options['AccessControl']);
}
if (!empty($options['Endpoints'])) {
Validate::isArray($options['Endpoints'], 'options[Endpoints]');
foreach ($options['Endpoints'] as $endpoint) {
$this->_endpoints[] = ChannelEndpoint::createFromOptions($endpoint);
}
}
} | php | public function fromArray($options)
{
if (!empty($options['KeyFrameInterval'])) {
Validate::isString($options['KeyFrameInterval'], 'options[KeyFrameInterval]');
$this->_keyFrameInterval = $options['KeyFrameInterval'];
}
if (isset($options['StreamingProtocol'])) {
Validate::isString($options['StreamingProtocol'], 'options[StreamingProtocol]');
$this->_streamingProtocol = $options['StreamingProtocol'];
}
if (isset($options['AccessControl'])) {
Validate::isArray($options['AccessControl'], 'options[AccessControl]');
$this->_accessControl = ChannelInputAccessControl::createFromOptions($options['AccessControl']);
}
if (!empty($options['Endpoints'])) {
Validate::isArray($options['Endpoints'], 'options[Endpoints]');
foreach ($options['Endpoints'] as $endpoint) {
$this->_endpoints[] = ChannelEndpoint::createFromOptions($endpoint);
}
}
} | [
"public",
"function",
"fromArray",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'KeyFrameInterval'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'KeyFrameInterval'",
"]",
",",
"'optio... | Fill ChannelInput from array.
@param array $options Array containing values for object properties | [
"Fill",
"ChannelInput",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/ChannelInput.php#L93-L116 | train |
Azure/azure-sdk-for-php | src/ServiceManagement/Models/UpgradeStatus.php | UpgradeStatus.create | public static function create($parsed)
{
$result = new self();
$upgradeType = Utilities::tryGetValue(
$parsed,
Resources::XTAG_UPGRADE_TYPE
);
$currentUpgradeDomainState = Utilities::tryGetValue(
$parsed,
Resources::XTAG_CURRENT_UPGRADE_DOMAIN_STATE
);
$currentUpgradeDomain = Utilities::tryGetValue(
$parsed,
Resources::XTAG_CURRENT_UPGRADE_DOMAIN
);
$result->setCurrentUpgradeDomain(intval($currentUpgradeDomain));
$result->setCurrentUpgradeDomainState($currentUpgradeDomainState);
$result->setUpgradeType($upgradeType);
return $result;
} | php | public static function create($parsed)
{
$result = new self();
$upgradeType = Utilities::tryGetValue(
$parsed,
Resources::XTAG_UPGRADE_TYPE
);
$currentUpgradeDomainState = Utilities::tryGetValue(
$parsed,
Resources::XTAG_CURRENT_UPGRADE_DOMAIN_STATE
);
$currentUpgradeDomain = Utilities::tryGetValue(
$parsed,
Resources::XTAG_CURRENT_UPGRADE_DOMAIN
);
$result->setCurrentUpgradeDomain(intval($currentUpgradeDomain));
$result->setCurrentUpgradeDomainState($currentUpgradeDomainState);
$result->setUpgradeType($upgradeType);
return $result;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"parsed",
")",
"{",
"$",
"result",
"=",
"new",
"self",
"(",
")",
";",
"$",
"upgradeType",
"=",
"Utilities",
"::",
"tryGetValue",
"(",
"$",
"parsed",
",",
"Resources",
"::",
"XTAG_UPGRADE_TYPE",
")",
";"... | Creates a new UpgradeStatus object from the parsed response.
@param array $parsed The parsed response body in array representation
@return \WindowsAzure\ServiceManagement\Models\UpgradeStatus | [
"Creates",
"a",
"new",
"UpgradeStatus",
"object",
"from",
"the",
"parsed",
"response",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/ServiceManagement/Models/UpgradeStatus.php#L68-L89 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/AccessPolicy.php | AccessPolicy.createFromOptions | public static function createFromOptions(array $options)
{
Validate::notNull($options['Name'], 'options[Name]');
$accessPolicy = new self($options['Name']);
$accessPolicy->fromArray($options);
return $accessPolicy;
} | php | public static function createFromOptions(array $options)
{
Validate::notNull($options['Name'], 'options[Name]');
$accessPolicy = new self($options['Name']);
$accessPolicy->fromArray($options);
return $accessPolicy;
} | [
"public",
"static",
"function",
"createFromOptions",
"(",
"array",
"$",
"options",
")",
"{",
"Validate",
"::",
"notNull",
"(",
"$",
"options",
"[",
"'Name'",
"]",
",",
"'options[Name]'",
")",
";",
"$",
"accessPolicy",
"=",
"new",
"self",
"(",
"$",
"options... | Create access policy from array.
@param array $options Array containing values for object properties
@return AccessPolicy | [
"Create",
"access",
"policy",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/AccessPolicy.php#L131-L139 | train |
Azure/azure-sdk-for-php | src/MediaServices/Models/AccessPolicy.php | AccessPolicy.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['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['DurationInMinutes'])) {
Validate::isDouble(
$options['DurationInMinutes'],
'options[DurationInMinutes]'
);
$this->_durationInMinutes = $options['DurationInMinutes'];
}
if (isset($options['Permissions'])) {
Validate::isInteger(
$options['Permissions'],
'options[Permissions]'
);
$this->_permissions = $options['Permissions'];
}
} | 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['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['DurationInMinutes'])) {
Validate::isDouble(
$options['DurationInMinutes'],
'options[DurationInMinutes]'
);
$this->_durationInMinutes = $options['DurationInMinutes'];
}
if (isset($options['Permissions'])) {
Validate::isInteger(
$options['Permissions'],
'options[Permissions]'
);
$this->_permissions = $options['Permissions'];
}
} | [
"public",
"function",
"fromArray",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'Id'",
"]",
")",
")",
"{",
"Validate",
"::",
"isString",
"(",
"$",
"options",
"[",
"'Id'",
"]",
",",
"'options[Id]'",
")",
";",
... | Fill access policy from array.
@param array $options Array containing values for object properties | [
"Fill",
"access",
"policy",
"from",
"array",
"."
] | 1e4eb9d083c73727561476ef3941c3b8b313cf04 | https://github.com/Azure/azure-sdk-for-php/blob/1e4eb9d083c73727561476ef3941c3b8b313cf04/src/MediaServices/Models/AccessPolicy.php#L156-L196 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.