作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill VideoStream from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (isset($options['Index'])) {
Validate::isInteger($options['Index'], 'options[Index]');
$this->_index = (int) $options['Index'];
}
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill ChannelOutput from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (isset($options['Hls'])) {
Validate::isArray($options['Hls'], 'options[Hls]');
$this->_hls = ChannelOutputHls::createFromOptions($options['Hls']);
}
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill ChannelOutputHls from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (isset($options['FragmentsPerSegment'])) {
Validate::isInteger($options['FragmentsPerSegment'], 'options[FragmentsPerSegment]');
$this->_fragmentsPerSegment = (int) $options['FragmentsPerSegment'];
}
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill ChannelPreviewAccessControl from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (!empty($options['IP'])) {
Validate::isArray($options['IP'], 'options[IP]');
$this->_ip = IPAccessControl::createFromOptions($options['IP']);
}
}
作者:rdohm
项目:azure-sdk-for-ph
/**
* Adds WRAP authentication header to the request headers.
*
* @param HttpClient $request HTTP channel object.
*
* @return \HTTP_Request2
*/
public function handleRequest($request)
{
Validate::notNull($request, 'request');
$wrapAccessToken = $this->_wrapTokenManager->getAccessToken($request->getUrl());
$authorization = sprintf(Resources::WRAP_AUTHORIZATION, $wrapAccessToken);
$request->setHeader(Resources::AUTHENTICATION, $authorization);
return $request;
}
作者:rdohm
项目:azure-sdk-for-ph
/**
* Creates new object based on the builder type in the $config.
*
* @param WindowsAzure\Common\Configuration $config The config
* object.
* @param WindowsAzure\Common\Internal\IServicesBuilder $builder The builder
* object.
*
* @return WindowsAzure\Blob\BlobRestProxy
*/
public static function create($config, $builder = null)
{
Validate::isTrue($config instanceof Configuration, Resources::INVALID_CONFIG_MSG);
if (!is_null($builder)) {
Validate::isTrue($builder instanceof IServiceBuilder, Resources::INVALID_BUILDER_MSG);
}
return $config->create(Resources::BLOB_TYPE_NAME, $builder);
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill IPRange from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (isset($options['Allow'])) {
Validate::isArray($options['Allow'], 'options[Allow]');
foreach ($options['Allow'] as $allow) {
$this->_allow[] = IPRange::createFromOptions($allow);
}
}
}
作者:isrealconsultin
项目:sit
/**
* Adds new entry to the block list entries.
*
* @param string $blockId The block id.
* @param string $type The entry type, you can use BlobBlockType.
*
* @return none
*/
public function addEntry($blockId, $type)
{
Validate::isString($blockId, 'blockId');
Validate::isTrue(BlobBlockType::isValid($type), sprintf(Resources::INVALID_BTE_MSG, get_class(new BlobBlockType())));
$block = new Block();
$block->setBlockId($blockId);
$block->setType($type);
$this->_entries[] = $block;
}
作者:southworksco
项目:vsco
/**
* Constructor
*
* @param string $incarnation The incarnation.
* @param string $expectedState The expected state.
* @param string $environmentPath The environment path.
* @param \DateTime $deadline The deadline.
* @param string $currentStateEndpoint The current state endpoint.
*/
public function __construct($incarnation, $expectedState, $environmentPath, $deadline, $currentStateEndpoint)
{
Validate::isDate($deadline);
$this->_incarnation = $incarnation;
$this->_expectedState = $expectedState;
$this->_environmentPath = $environmentPath;
$this->_deadline = $deadline;
$this->_currentStateEndpoint = $currentStateEndpoint;
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Unserializes given serialized string to array.
*
* @param string $serialized The serialized object in string representation.
*
* @return array
*/
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;
}
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Creates an RuleInfo with specified parameters.
*
* @param string $title The title of the rule.
* @param RuleDescription $ruleDescription The description of the rule.
*/
public function __construct($title = Resources::EMPTY_STRING, $ruleDescription = null)
{
Validate::isString($title, 'title');
if (is_null($ruleDescription)) {
$ruleDescription = new RuleDescription();
}
$this->_ruleDescription = $ruleDescription;
$this->_entry = new Entry();
$this->_entry->setTitle($title);
$this->_entry->setAttribute(Resources::XMLNS, Resources::SERVICE_BUS_NAMESPACE);
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill ChannelEndpoint from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (isset($options['Protocol'])) {
Validate::isString($options['Protocol'], 'options[Protocol]');
$this->_protocol = $options['Protocol'];
}
if (isset($options['Url'])) {
Validate::isString($options['Url'], 'options[Url]');
$this->_url = $options['Url'];
}
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill ContentKeyAuthorizationPolicy from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill ChannelSlate from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (isset($options['InsertSlateOnAdMarker'])) {
Validate::isBoolean($options['InsertSlateOnAdMarker'], 'options[InsertSlateOnAdMarker]');
$this->_insertSlateOnAdMarker = (bool) $options['InsertSlateOnAdMarker'];
}
if (isset($options['DefaultSlateAssetId'])) {
Validate::isString($options['DefaultSlateAssetId'], 'options[DefaultSlateAssetIdUrl]');
$this->_defaultSlateAssetId = $options['DefaultSlateAssetId'];
}
}
作者:mat3347
项目:PF
/**
* Fill error detail from array
*
* @param array $options Array containing values for object properties
*
* @return none
*/
public function fromArray($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'];
}
}
作者:pankajadhyapa
项目:um_ne
/**
* Creates BatchError object.
*
* @param WindowsAzure\Common\ServiceException $error The error object.
* @param array $headers The response headers.
*
* @return \WindowsAzure\Table\Models\BatchError
*/
public static function create($error, $headers)
{
Validate::isTrue($error instanceof ServiceException, Resources::INVALID_EXC_OBJ_MSG);
Validate::isArray($headers, 'headers');
$result = new BatchError();
$clean = array_change_key_case($headers);
$result->setError($error);
$contentId = Utilities::tryGetValue($clean, Resources::CONTENT_ID);
$result->setContentId(is_null($contentId) ? null : intval($contentId));
return $result;
}
作者:bitmovi
项目:azure-sdk-for-ph
/**
* Fill storage account from array
*
* @param array $options Array containing values for object properties
*
* @return none
*/
public function fromArray($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'];
}
}
作者:southworksco
项目:azure-sdk-for-ph
/**
* Fill CrossSiteAccessPolicies from array.
*
* @param array $options Array containing values for object properties
*/
public function fromArray($options)
{
if (isset($options['ClientAccessPolicy'])) {
Validate::isString($options['ClientAccessPolicy'], 'options[ClientAccessPolicy]');
$this->_clientAccessPolicy = $options['ClientAccessPolicy'];
}
if (isset($options['CrossDomainPolicy'])) {
Validate::isString($options['CrossDomainPolicy'], 'options[CrossDomainPolicy]');
$this->_crossDomainPolicy = $options['CrossDomainPolicy'];
}
}
作者:GameWis
项目:azure-sdk-for-ph
/**
* Constructor
*
* @param string $content Http response
* as string
*
* @param WindowsAzure\Common\Internal\Http\BatchRequest $request Source batch
* request object
*/
public function __construct($content, $request = null)
{
$params['include_bodies'] = true;
$params['input'] = $content;
$mimeDecoder = new \Mail_mimeDecode($content);
$structure = $mimeDecoder->decode($params);
$parts = $structure->parts;
$this->_contexts = array();
$requestContexts = null;
if ($request != null) {
Validate::isA($request, 'WindowsAzure\\Common\\Internal\\Http\\BatchRequest', 'request');
$requestContexts = $request->getContexts();
}
$i = 0;
foreach ($parts as $part) {
if (!empty($part->body)) {
$headerEndPos = strpos($part->body, "\r\n\r\n");
$header = substr($part->body, 0, $headerEndPos);
$body = substr($part->body, $headerEndPos + 4);
$headerStrings = explode("\r\n", $header);
$response = new \HTTP_Request2_Response(array_shift($headerStrings));
foreach ($headerStrings as $headerString) {
$response->parseHeaderLine($headerString);
}
$response->appendBody($body);
$this->_contexts[] = $response;
if (is_array($requestContexts)) {
$expectedCodes = $requestContexts[$i]->getStatusCodes();
$statusCode = $response->getStatus();
if (!in_array($statusCode, $expectedCodes)) {
$reason = $response->getReasonPhrase();
throw new ServiceException($statusCode, $reason, $body);
}
}
$i++;
}
}
}
作者:jwdunn
项目:azure-sdk-for-ph
/**
* Fill asset file from array
*
* @param array $options Array containing values for object properties
*
* @return none
*/
public function fromArray($options)
{
if (isset($options['Id'])) {
Validate::isString($options['Id'], 'options[Id]');
$this->_id = $options['Id'];
}
if (isset($options['Name'])) {
Validate::isString($options['Name'], 'options[Name]');
$this->_name = $options['Name'];
}
if (isset($options['ContentFileSize'])) {
Validate::isString($options['ContentFileSize'], 'options[ContentFileSize]');
$this->_contentFileSize = $options['ContentFileSize'];
}
if (isset($options['ParentAssetId'])) {
Validate::isString($options['ParentAssetId'], 'options[ParentAssetId]');
$this->_parentAssetId = $options['ParentAssetId'];
}
if (isset($options['EncryptionVersion'])) {
Validate::isString($options['EncryptionVersion'], 'options[EncryptionVersion]');
$this->_encryptionVersion = $options['EncryptionVersion'];
}
if (isset($options['EncryptionScheme'])) {
Validate::isString($options['EncryptionScheme'], 'options[EncryptionScheme]');
$this->_encryptionScheme = $options['EncryptionScheme'];
}
if (isset($options['IsEncrypted'])) {
Validate::isBoolean($options['IsEncrypted'], 'options[IsEncrypted]');
$this->_isEncrypted = $options['IsEncrypted'];
}
if (isset($options['EncryptionKeyId'])) {
Validate::isString($options['EncryptionKeyId'], 'options[EncryptionKeyId]');
$this->_encryptionKeyId = $options['EncryptionKeyId'];
}
if (isset($options['InitializationVector'])) {
Validate::isString($options['InitializationVector'], 'options[InitializationVector]');
$this->_initializationVector = $options['InitializationVector'];
}
if (isset($options['IsPrimary'])) {
Validate::isBoolean($options['IsPrimary'], 'options[IsPrimary]');
$this->_isPrimary = $options['IsPrimary'];
}
if (isset($options['LastModified'])) {
Validate::isDateString($options['LastModified'], 'options[LastModified]');
$this->_lastModified = new \DateTime($options['LastModified']);
}
if (isset($options['Created'])) {
Validate::isDateString($options['Created'], 'options[Created]');
$this->_created = new \DateTime($options['Created']);
}
if (isset($options['MimeType'])) {
Validate::isString($options['MimeType'], 'options[MimeType]');
$this->_mimeType = $options['MimeType'];
}
if (isset($options['ContentChecksum'])) {
Validate::isString($options['ContentChecksum'], 'options[ContentChecksum]');
$this->_contentCheckSum = $options['ContentChecksum'];
}
}