idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
39,500 | public static function deserialize ( $ template ) { $ xml = simplexml_load_string ( $ template ) ; $ result = new PlayReadyLicenseResponseTemplate ( ) ; 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" ) ; } $ result -> setLicenseTemplates ( self :: deserializeLicenseTemplates ( $ xml -> LicenseTemplates ) ) ; if ( isset ( $ xml -> ResponseCustomData ) ) { $ result -> setResponseCustomData ( ( string ) $ xml -> ResponseCustomData ) ; } self :: ValidateLicenseResponseTemplate ( $ result ) ; return $ result ; } | Deserialize a PlayReadyLicenseResponseTemplate xml into a PlayReadyLicenseResponseTemplate object . |
39,501 | 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 ( ) ; } | Serialize a PlayReadyLicenseResponseTemplate object into a PlayReadyLicenseResponseTemplate XML . |
39,502 | 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 ; } | Creates a broker properties instance with specified JSON message . |
39,503 | 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 ; } | Gets a string representing the broker property . |
39,504 | public function setValueArrayString ( array & $ valueArray , $ key , $ value ) { Validate :: isString ( $ key , 'key' ) ; if ( ! empty ( $ value ) ) { Validate :: isString ( $ value , 'value' ) ; $ valueArray [ $ key ] = $ value ; } } | Sets a string in an array . |
39,505 | public function setValueArrayInt ( array & $ valueArray , $ key , $ value ) { Validate :: isString ( $ key , 'key' ) ; if ( ! empty ( $ value ) ) { Validate :: isInteger ( $ value , 'value' ) ; $ valueArray [ $ key ] = $ value ; } } | Sets an integer value in an array . |
39,506 | public function setValueArrayFloat ( array & $ valueArray , $ key , $ value ) { Validate :: isString ( $ key , 'key' ) ; if ( ! empty ( $ value ) ) { Validate :: isDouble ( $ value , 'value' ) ; $ valueArray [ $ key ] = ( float ) $ value ; } } | Sets a float value in an array . |
39,507 | 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 ( ) ) ; } } | Sets a DateTime value in an array . |
39,508 | public static function isValid ( $ status ) { switch ( strtolower ( $ status ) ) { case strtolower ( self :: SUSPENDED ) : case strtolower ( self :: RUNNING ) : return true ; default : return false ; } } | Validates the provided status . |
39,509 | 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 ; } | Creates a subscription description with specified XML string . |
39,510 | 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' ] ; } } | Fill Encoding from array . |
39,511 | 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' ] ; } } | Fill manifest from array . |
39,512 | public function parseXml ( $ xmlString ) { Validate :: notNull ( $ xmlString , 'xmlString' ) ; Validate :: isString ( $ xmlString , 'xmlString' ) ; $ this -> fromXml ( simplexml_load_string ( $ xmlString ) ) ; } | Creates an ATOM CONTENT instance with specified xml string . |
39,513 | public function fromXml ( \ SimpleXMLElement $ contentXml ) { Validate :: notNull ( $ contentXml , 'contentXml' ) ; $ attributes = $ contentXml -> attributes ( ) ; if ( ! empty ( $ attributes [ 'type' ] ) ) { $ this -> type = ( string ) $ attributes [ 'type' ] ; } $ text = '' ; foreach ( $ contentXml -> children ( ) as $ child ) { $ text .= $ child -> asXML ( ) ; } $ this -> text = $ text ; $ this -> xml = $ contentXml ; } | Creates an ATOM CONTENT instance with specified simpleXML object . |
39,514 | public function writeInnerXml ( \ XMLWriter $ xmlWriter ) { Validate :: notNull ( $ xmlWriter , 'xmlWriter' ) ; $ xmlWriter -> writeRaw ( $ this -> text ) ; } | Writes an inner XML representing the content . |
39,515 | 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 ; } | Creates a topic description object with specified XML string . |
39,516 | protected function createWrapService ( $ wrapEndpointUri ) { $ httpClient = $ this -> httpClient ( ) ; $ wrapWrapper = new WrapRestProxy ( $ httpClient , $ wrapEndpointUri ) ; return $ wrapWrapper ; } | Builds a WRAP client . |
39,517 | public function createServiceBusService ( $ connectionString ) { $ settings = ServiceBusSettings :: createFromConnectionString ( $ connectionString ) ; $ httpClient = $ this -> httpClient ( ) ; $ serializer = $ this -> serializer ( ) ; $ serviceBusWrapper = new ServiceBusRestProxy ( $ httpClient , $ settings -> getServiceBusEndpointUri ( ) , $ serializer ) ; $ headers = [ ] ; $ headersFilter = new HeadersFilter ( $ headers ) ; $ serviceBusWrapper = $ serviceBusWrapper -> withFilter ( $ headersFilter ) ; $ filter = $ settings -> getFilter ( ) ; return $ serviceBusWrapper -> withFilter ( $ filter ) ; } | Builds a Service Bus object . |
39,518 | 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 ) ; $ headers = [ ] ; $ headers [ Resources :: X_MS_VERSION ] = Resources :: SM_API_LATEST_VERSION ; $ headersFilter = new HeadersFilter ( $ headers ) ; $ serviceManagementWrapper = $ serviceManagementWrapper -> withFilter ( $ headersFilter ) ; return $ serviceManagementWrapper ; } | Builds a service management object . |
39,519 | 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 ) ; $ 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 ) ; $ authenticationFilter = new AuthenticationFilter ( $ settings -> getTokenProvider ( ) ) ; $ mediaServicesWrapper = $ mediaServicesWrapper -> withFilter ( $ authenticationFilter ) ; return $ mediaServicesWrapper ; } | Builds a media services object . |
39,520 | 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 ; } | Gets the version map . |
39,521 | 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 ; } | Creates a new Role from parsed response body . |
39,522 | 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 ; } | Converts the current object into array representation . |
39,523 | 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 ) ; } } | Serializes the current object . |
39,524 | public static function objectSerialize ( $ targetObject , $ rootName ) { Validate :: notNull ( $ targetObject , 'targetObject' ) ; Validate :: isString ( $ rootName , 'rootName' ) ; $ container = new \ stdClass ( ) ; $ container -> $ rootName = $ targetObject ; return json_encode ( $ container ) ; } | Serialize an object with specified root element name . |
39,525 | 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 ; } } | Unserializes given serialized string to array . |
39,526 | 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 ; } | Creates new ListHostedServicesResult from parsed response body . |
39,527 | public function setLocation ( $ location ) { Validate :: isString ( $ location , 'location' ) ; Validate :: notNullOrEmpty ( $ location , 'location' ) ; $ this -> _location = $ location ; } | Sets the location . |
39,528 | public function setAffinityGroup ( $ affinityGroup ) { Validate :: isString ( $ affinityGroup , 'affinityGroup' ) ; Validate :: notNullOrEmpty ( $ affinityGroup , 'affinityGroup' ) ; $ this -> _affinityGroup = $ affinityGroup ; } | Sets the affinityGroup . |
39,529 | 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' ] ; } } | Fill storage account from array . |
39,530 | public static function deserialize ( $ template ) { $ xml = simplexml_load_string ( $ template ) ; $ result = new TokenRestrictionTemplate ( ) ; 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' ) ; } 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 ; } | Deserialize a TokenRestrictionTemplate xml into a TokenRestrictionTemplate object . |
39,531 | 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 ( ) ; } | Serialize a TokenRestrictionTemplate object into a TokenRestrictionTemplate XML . |
39,532 | 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 ; } | Create manifest file from array . |
39,533 | public function storageServiceExists ( $ name ) { $ result = $ this -> _proxy -> listStorageServices ( ) ; $ storageServices = $ result -> getStorageServices ( ) ; foreach ( $ storageServices as $ storageService ) { if ( $ storageService -> getName ( ) == $ name ) { return true ; } } return false ; } | Checks if a storage service exists or not . |
39,534 | 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 ; } | Creates a storage service if it does not exist and waits until it is created . |
39,535 | 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 ( ) ; } } | Blocks asynchronous operation until it succeeds . Throws exception if the operation failed . |
39,536 | 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 ; } | Create task template from array . |
39,537 | public function setMode ( $ mode ) { Validate :: isString ( $ mode , 'mode' ) ; Validate :: isTrue ( Mode :: isValid ( $ mode ) , Resources :: INVALID_CHANGE_MODE_MSG ) ; $ this -> _mode = $ mode ; } | Sets mode . |
39,538 | 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' ) ) ; } | Deserializes the role environment data . |
39,539 | 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 ; } | Translates the configuration settings . |
39,540 | 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 ; } | Translates the local resources . |
39,541 | 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 ; } | Translates the roles . |
39,542 | 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 ; } | Translates the role instances . |
39,543 | 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 ; } | Translates the role instance endpoints . |
39,544 | 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 ; } | Translates the current instance info . |
39,545 | 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 ) ) ; } } | Throws exception if the object is not of the specified class type . |
39,546 | 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 ) ) ; } } | Validate if method exists in object . |
39,547 | 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 ) ) ; } } | Validate if string is date formatted . |
39,548 | 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 ; } | Creates a rule description instance with specified XML string . |
39,549 | 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 ) ; } | Serializes the current state . |
39,550 | 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 ; } | Creates WrapAccessTokenResult object from parsed XML response . |
39,551 | 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' ] ; } } | Fill error detail from array . |
39,552 | 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 ; } } | Adds optional query parameter . |
39,553 | 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 ; } } | Adds optional header . |
39,554 | public function handleRequest ( IHttpClient $ request ) { $ signedKey = $ this -> _azureAdTokenProvider -> getAccessToken ( ) ; $ request -> setHeader ( Resources :: AUTHENTICATION , "Bearer " . $ signedKey -> getAccessToken ( ) ) ; return $ request ; } | Adds authentication header to the request headers . |
39,555 | 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 ) ; } } } | Fill ChannelPreview from array . |
39,556 | public function fromArray ( $ options ) { if ( isset ( $ options [ 'Index' ] ) ) { Validate :: isInteger ( $ options [ 'Index' ] , 'options[Index]' ) ; $ this -> _index = ( int ) $ options [ 'Index' ] ; } } | Fill VideoStream from array . |
39,557 | 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 ; } | Creates GetOperationStatusResult object from parsed response . |
39,558 | public static function init ( ) { self :: $ _clientId = uniqid ( ) ; self :: $ _maxDateTime = new \ DateTime ( date ( Resources :: TIMESTAMP_FORMAT , Resources :: INT32_MAX ) ) ; self :: $ _tracking = true ; } | Initializes the role environment . |
39,559 | 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 ( ) ; } } | Initializes the runtime client . |
39,560 | 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 ; } } } | Tracks role environment changes raising events as necessary . |
39,561 | 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 ) ; } } | Processes a goal state change . |
39,562 | 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 ; } | Calculates changes . |
39,563 | 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 ; } | Calculates the configuration changes . |
39,564 | public static function isAvailable ( ) { try { self :: _initialize ( ) ; } catch ( RoleEnvironmentNotAvailableException $ ex ) { return false ; } catch ( ChannelNotAvailableException $ ex ) { return false ; } return self :: $ _runtimeClient != null ; } | Indicates whether the role instance is running in the Windows Azure environment . |
39,565 | public static function requestRecycle ( ) { self :: _initialize ( ) ; $ recycleState = new AcquireCurrentState ( self :: $ _clientId , self :: $ _currentGoalState -> getIncarnation ( ) , CurrentStatus :: RECYCLE , self :: $ _maxDateTime ) ; self :: $ _runtimeClient -> setCurrentState ( $ recycleState ) ; } | 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 . |
39,566 | 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 ) ; } | Sets the status of the role instance . |
39,567 | public static function clearStatus ( ) { self :: _initialize ( ) ; $ newState = new ReleaseCurrentState ( self :: $ _clientId ) ; self :: $ _lastState = $ newState ; self :: $ _runtimeClient -> setCurrentState ( $ newState ) ; } | Clears the status of the role instance . |
39,568 | public static function removeRoleEnvironmentChangedListener ( $ listener ) { foreach ( self :: $ _changedListeners as $ key => $ changedListener ) { if ( $ changedListener == $ listener ) { unset ( self :: $ _changedListeners [ $ key ] ) ; return true ; } } return false ; } | Removes an event listener for the Changed event . |
39,569 | public static function removeRoleEnvironmentChangingListener ( $ listener ) { foreach ( self :: $ _changingListeners as $ key => $ changingListener ) { if ( $ changingListener == $ listener ) { unset ( self :: $ _changingListeners [ $ key ] ) ; return true ; } } return false ; } | Removes an event listener for the Changing event . |
39,570 | public static function removeRoleEnvironmentStoppingListener ( $ listener ) { foreach ( self :: $ _stoppingListeners as $ key => $ stoppingListener ) { if ( $ stoppingListener == $ listener ) { unset ( self :: $ _stoppingListeners [ $ key ] ) ; return true ; } } return false ; } | Removes an event listener for the Stopping event . |
39,571 | 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 ; } } | Populates the properties with the response from the list queues request . |
39,572 | 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 ( ) ) ; } } | Populates the properties with a specified XML string based on ATOM ENTRY schema . |
39,573 | public function withCorrelationFilter ( $ correlationId ) { $ filter = new CorrelationFilter ( ) ; $ filter -> setCorrelationId ( $ correlationId ) ; $ this -> _ruleDescription -> setFilter ( $ filter ) ; } | With correlation ID filter . |
39,574 | public function withSqlFilter ( $ sqlExpression ) { $ filter = new SqlFilter ( ) ; $ filter -> setSqlExpression ( $ sqlExpression ) ; $ filter -> setCompatibilityLevel ( 20 ) ; $ this -> _ruleDescription -> setFilter ( $ filter ) ; } | With sql expression filter . |
39,575 | public function withSqlRuleAction ( $ sqlExpression ) { $ action = new SqlRuleAction ( ) ; $ action -> setCompatibilityLevel ( 20 ) ; $ action -> setSqlExpression ( $ sqlExpression ) ; $ this -> _ruleDescription -> setAction ( $ action ) ; } | With SQL rule action . |
39,576 | 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/' ) ; } | Returns a StorageServiceSettings with development storage credentials using the specified proxy Uri . |
39,577 | public static function developmentStorageAccount ( ) { if ( is_null ( self :: $ _devStoreAccount ) ) { self :: $ _devStoreAccount = self :: _getDevelopmentStorageAccount ( Resources :: DEV_STORE_URI ) ; } return self :: $ _devStoreAccount ; } | Gets a StorageServiceSettings object that references the development storage account . |
39,578 | 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 ) ; } | Gets the default service endpoint using the specified protocol and account name . |
39,579 | 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 ) ; } | Creates StorageServiceSettings object given endpoints uri . |
39,580 | public static function createFromConnectionString ( $ connectionString ) { $ tokenizedSettings = self :: parseAndValidateKeys ( $ connectionString ) ; $ 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 ) ; } $ 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 ) ) ; } $ 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 ; } | Creates a StorageServiceSettings object from the given connection string . |
39,581 | public function setCurrentState ( CurrentState $ state ) { $ outputStream = $ this -> _outputChannel -> getOutputStream ( $ this -> _endpoint ) ; $ this -> _serializer -> serialize ( $ state , $ outputStream ) ; fclose ( $ outputStream ) ; } | Sets the current state . |
39,582 | 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' ] ; } } | Fill media processor from array . |
39,583 | 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 ( ) ; } | Returns authorization header to be included in the request . |
39,584 | public static function stringifyAssetDeliveryPolicyConfigurationKey ( array $ array ) { $ jsonArray = [ ] ; foreach ( $ array as $ key => $ value ) { $ jsonArray [ ] = [ 'Key' => $ key , 'Value' => $ value ] ; } return json_encode ( $ jsonArray ) ; } | Helper function to stringify the AssetDeliveryPolicyConfigurationKey . |
39,585 | 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 ; } | Helper function to pack the AssetDeliveryPolicyConfigurationKey . |
39,586 | public function removeHeader ( $ name ) { Validate :: isString ( $ name , 'name' ) ; Validate :: notNullOrEmpty ( $ name , 'name' ) ; unset ( $ this -> _headers [ $ name ] ) ; } | Removes header from the HTTP request headers . |
39,587 | public function getInputStream ( $ name ) { $ this -> _inputStream = @ fopen ( $ name , 'r' ) ; if ( $ this -> _inputStream ) { return $ this -> _inputStream ; } else { throw new ChannelNotAvailableException ( ) ; } } | Gets the input stream . |
39,588 | public function closeInputStream ( ) { if ( ! is_null ( $ this -> _inputStream ) ) { fclose ( $ this -> _inputStream ) ; $ this -> _inputStream = null ; } } | Closes the input stream . |
39,589 | 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' ] ) ; } } | Fill task historical event from array . |
39,590 | 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 ; } | Creates new ListStorageServicesResult from parsed response body . |
39,591 | 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 ; } | Create locator from array . |
39,592 | 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' ] ) ; } } | Fill locator from array . |
39,593 | 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 ; } } | Parse an ATOM Link xml . |
39,594 | public function writeXml ( \ XMLWriter $ xmlWriter ) { $ xmlWriter -> startElementNS ( 'atom' , Resources :: LINK , Resources :: ATOM_NAMESPACE ) ; $ this -> writeInnerXml ( $ xmlWriter ) ; $ xmlWriter -> endElement ( ) ; } | Writes an XML representing the ATOM link item . |
39,595 | 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 ) ; } } | Writes the inner XML representing the ATOM link item . |
39,596 | 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 ) ; } } } | Fill ChannelInput from array . |
39,597 | 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 ; } | Creates a new UpgradeStatus object from the parsed response . |
39,598 | public static function createFromOptions ( array $ options ) { Validate :: notNull ( $ options [ 'Name' ] , 'options[Name]' ) ; $ accessPolicy = new self ( $ options [ 'Name' ] ) ; $ accessPolicy -> fromArray ( $ options ) ; return $ accessPolicy ; } | Create access policy from array . |
39,599 | 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' ] ; } } | Fill access policy from array . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.