_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q255300
StorageServiceSettings.createFromConnectionStringForTokenCredential
test
public static function createFromConnectionStringForTokenCredential($connectionString) { // Explicit case for AAD token, Connection string could only have account // name. $tokenizedSettings = self::parseAndValidateKeys($connectionString); $scheme = Utilities::tryGetValueIns...
php
{ "resource": "" }
q255301
MimeReaderWriter.encodeMimeMultipart
test
public function encodeMimeMultipart(array $bodyPartContents) { $count = count($bodyPartContents); $mimeType = Resources::MULTIPART_MIXED_TYPE; $batchGuid = Utilities::getGuid(); $batchId = sprintf('batch_%s', $batchGuid); $contentType1 = array('content...
php
{ "resource": "" }
q255302
MimeReaderWriter.decodeMimeMultipart
test
public function decodeMimeMultipart($mimeBody) { // Find boundary $boundaryRegex = '~boundary=(changesetresponse_.*)~'; preg_match($boundaryRegex, $mimeBody, $matches); $boundary = trim($matches[1]); // Split the requests $requests = explode('--' . $boundary, $mimeB...
php
{ "resource": "" }
q255303
ListSharesResult.create
test
public static function create(array $parsedResponse, $location = '') { $result = new ListSharesResult(); $serviceEndpoint = Utilities::tryGetKeysChainValue( $parsedResponse, Resources::XTAG_ATTRIBUTES, Resources::XTAG_SERVICE_ENDPOINT );...
php
{ "resource": "" }
q255304
ListSharesResult.setShares
test
protected function setShares(array $shares) { $this->shares = array(); foreach ($shares as $share) { $this->shares[] = clone $share; } }
php
{ "resource": "" }
q255305
RetryMiddleware.retry
test
private function retry( RequestInterface $request, array $options, ResponseInterface $response = null ) { $options['delay'] = call_user_func( $this->intervalCalculator, ++$options['retries'] ); //Change the request URI according to the locatio...
php
{ "resource": "" }
q255306
Filter.applyAnd
test
public static function applyAnd(Filter $left, Filter $right) { $filter = new BinaryFilter($left, 'and', $right); return $filter; }
php
{ "resource": "" }
q255307
Filter.applyOr
test
public static function applyOr(Filter $left, Filter $right) { $filter = new BinaryFilter($left, 'or', $right); return $filter; }
php
{ "resource": "" }
q255308
Filter.applyEq
test
public static function applyEq(Filter $left, Filter $right) { $filter = new BinaryFilter($left, 'eq', $right); return $filter; }
php
{ "resource": "" }
q255309
Filter.applyNe
test
public static function applyNe(Filter $left, Filter $right) { $filter = new BinaryFilter($left, 'ne', $right); return $filter; }
php
{ "resource": "" }
q255310
Filter.applyGe
test
public static function applyGe(Filter $left, Filter $right) { $filter = new BinaryFilter($left, 'ge', $right); return $filter; }
php
{ "resource": "" }
q255311
Filter.applyGt
test
public static function applyGt(Filter $left, Filter $right) { $filter = new BinaryFilter($left, 'gt', $right); return $filter; }
php
{ "resource": "" }
q255312
Filter.applyLt
test
public static function applyLt(Filter $left, Filter $right) { $filter = new BinaryFilter($left, 'lt', $right); return $filter; }
php
{ "resource": "" }
q255313
Filter.applyLe
test
public static function applyLe(Filter $left, Filter $right) { $filter = new BinaryFilter($left, 'le', $right); return $filter; }
php
{ "resource": "" }
q255314
ContinuationToken.setLocation
test
public function setLocation($location) { Validate::canCastAsString($location, 'location'); Validate::isTrue( $location == LocationMode::PRIMARY_ONLY || $location == LocationMode::SECONDARY_ONLY || $location == '', sprintf( Resources::IN...
php
{ "resource": "" }
q255315
JsonSerializer.unserialize
test
public function unserialize($serialized) { Validate::canCastAsString($serialized, 'serialized'); $json = json_decode($serialized); if ($json && !is_array($json)) { return get_object_vars($json); } else { return $json; } }
php
{ "resource": "" }
q255316
PeekMessagesResult.create
test
public static function create($parsedResponse) { $result = new PeekMessagesResult(); $queueMessages = array(); if (!empty($parsedResponse)) { $rawMessages = Utilities::getArray( $parsedResponse[Resources::QP_QUEUE_MESSAGE] ); foreac...
php
{ "resource": "" }
q255317
GetEntityResult.create
test
public static function create($body, IODataReaderWriter $serializer) { $result = new GetEntityResult(); $result->setEntity($serializer->parseEntity($body)); return $result; }
php
{ "resource": "" }
q255318
TableRestProxy.createOperationsContexts
test
private function createOperationsContexts(array $operations) { $contexts = array(); foreach ($operations as $operation) { $context = null; $type = $operation->getType(); switch ($type) { case BatchOperationType::INSERT_ENTITY_OPERATION: ...
php
{ "resource": "" }
q255319
TableRestProxy.getOperationContext
test
private function getOperationContext($table, Entity $entity, $type) { switch ($type) { case BatchOperationType::INSERT_ENTITY_OPERATION: return $this->constructInsertEntityContext($table, $entity, null); case BatchOperationType::UPDATE_ENTITY_OPERATION: ...
php
{ "resource": "" }
q255320
TableRestProxy.createBatchRequestBody
test
private function createBatchRequestBody(array $operations, array $contexts) { $mimeBodyParts = array(); $contentId = 1; $count = count($operations); Validate::isTrue( count($operations) == count($contexts), Resources::INVALID_OC_COUNT_MSG ...
php
{ "resource": "" }
q255321
TableRestProxy.constructDeleteEntityContext
test
private function constructDeleteEntityContext( $table, $partitionKey, $rowKey, DeleteEntityOptions $options = null ) { Validate::canCastAsString($table, 'table'); Validate::notNullOrEmpty($table, 'table'); Validate::isTrue(!is_null($partitionKey), Resources::N...
php
{ "resource": "" }
q255322
TableRestProxy.constructPutOrMergeEntityContext
test
private function constructPutOrMergeEntityContext( $table, Entity $entity, $verb, $useETag, TableServiceOptions $options = null ) { Validate::canCastAsString($table, 'table'); Validate::notNullOrEmpty($table, 'table'); Validate::notNullOrEmpty($entity,...
php
{ "resource": "" }
q255323
TableRestProxy.constructInsertEntityContext
test
private function constructInsertEntityContext( $table, Entity $entity, TableServiceCreateOptions $options = null ) { Validate::canCastAsString($table, 'table'); Validate::notNullOrEmpty($table, 'table'); Validate::notNullOrEmpty($entity, 'entity'); Validate::i...
php
{ "resource": "" }
q255324
TableRestProxy.getEntityPath
test
private function getEntityPath($table, $partitionKey, $rowKey) { $encodedPK = $this->encodeODataUriValue($partitionKey); $encodedRK = $this->encodeODataUriValue($rowKey); return "$table(PartitionKey='$encodedPK',RowKey='$encodedRK')"; }
php
{ "resource": "" }
q255325
TableRestProxy.putOrMergeEntityAsyncImpl
test
private function putOrMergeEntityAsyncImpl( $table, Entity $entity, $verb, $useETag, TableServiceOptions $options = null ) { $context = $this->constructPutOrMergeEntityContext( $table, $entity, $verb, $useETag, ...
php
{ "resource": "" }
q255326
TableRestProxy.addOptionalQuery
test
private function addOptionalQuery(array $queryParam, Query $query) { if (!is_null($query)) { $selectedFields = $query->getSelectFields(); if (!empty($selectedFields)) { $final = $this->encodeODataUriValues($selectedFields); $this->addOptionalQueryPara...
php
{ "resource": "" }
q255327
TableRestProxy.encodeODataUriValues
test
private function encodeODataUriValues(array $values) { $list = array(); foreach ($values as $value) { $list[] = $this->encodeODataUriValue($value); } return $list; }
php
{ "resource": "" }
q255328
TableRestProxy.queryTablesAsync
test
public function queryTablesAsync($options = null) { $method = Resources::HTTP_GET; $headers = array(); $postParams = array(); $queryParams = array(); $path = 'Tables'; if (is_null($options)) { $options = new QueryTablesOptions(); ...
php
{ "resource": "" }
q255329
TableRestProxy.createTable
test
public function createTable($table, TableServiceCreateOptions $options = null) { return $this->createTableAsync($table, $options)->wait(); }
php
{ "resource": "" }
q255330
TableRestProxy.createTableAsync
test
public function createTableAsync( $table, TableServiceCreateOptions $options = null ) { Validate::canCastAsString($table, 'table'); Validate::notNullOrEmpty($table, 'table'); $method = Resources::HTTP_POST; $headers = array(); $postParams = array();...
php
{ "resource": "" }
q255331
TableRestProxy.getTable
test
public function getTable($table, GetTableOptions $options = null) { return $this->getTableAsync($table, $options)->wait(); }
php
{ "resource": "" }
q255332
TableRestProxy.getTableAsync
test
public function getTableAsync( $table, GetTableOptions $options = null ) { Validate::canCastAsString($table, 'table'); Validate::notNullOrEmpty($table, 'table'); $method = Resources::HTTP_GET; $headers = array(); $postParams = array(); $quer...
php
{ "resource": "" }
q255333
TableRestProxy.deleteTable
test
public function deleteTable($table, TableServiceOptions $options = null) { $this->deleteTableAsync($table, $options)->wait(); }
php
{ "resource": "" }
q255334
TableRestProxy.deleteTableAsync
test
public function deleteTableAsync( $table, TableServiceOptions$options = null ) { Validate::canCastAsString($table, 'table'); Validate::notNullOrEmpty($table, 'table'); $method = Resources::HTTP_DELETE; $headers = array(); $postParams = array(); ...
php
{ "resource": "" }
q255335
TableRestProxy.queryEntitiesAsync
test
public function queryEntitiesAsync($table, $options = null) { Validate::canCastAsString($table, 'table'); Validate::notNullOrEmpty($table, 'table'); $method = Resources::HTTP_GET; $headers = array(); $postParams = array(); $queryParams = array(); $p...
php
{ "resource": "" }
q255336
TableRestProxy.insertOrMergeEntity
test
public function insertOrMergeEntity( $table, Entity $entity, TableServiceOptions $options = null ) { return $this->insertOrMergeEntityAsync($table, $entity, $options)->wait(); }
php
{ "resource": "" }
q255337
TableRestProxy.insertOrMergeEntityAsync
test
public function insertOrMergeEntityAsync( $table, Entity $entity, TableServiceOptions $options = null ) { return $this->putOrMergeEntityAsyncImpl( $table, $entity, Resources::HTTP_MERGE, false, $options ); }
php
{ "resource": "" }
q255338
TableRestProxy.insertOrReplaceEntity
test
public function insertOrReplaceEntity( $table, Entity $entity, TableServiceOptions $options = null ) { return $this->insertOrReplaceEntityAsync( $table, $entity, $options )->wait(); }
php
{ "resource": "" }
q255339
TableRestProxy.insertOrReplaceEntityAsync
test
public function insertOrReplaceEntityAsync( $table, Entity $entity, TableServiceOptions $options = null ) { return $this->putOrMergeEntityAsyncImpl( $table, $entity, Resources::HTTP_PUT, false, $options ); }
php
{ "resource": "" }
q255340
TableRestProxy.updateEntity
test
public function updateEntity( $table, Entity $entity, TableServiceOptions $options = null ) { return $this->updateEntityAsync($table, $entity, $options)->wait(); }
php
{ "resource": "" }
q255341
TableRestProxy.updateEntityAsync
test
public function updateEntityAsync( $table, Entity $entity, TableServiceOptions $options = null ) { return $this->putOrMergeEntityAsyncImpl( $table, $entity, Resources::HTTP_PUT, true, $options ); }
php
{ "resource": "" }
q255342
TableRestProxy.mergeEntity
test
public function mergeEntity( $table, Entity $entity, TableServiceOptions $options = null ) { return $this->mergeEntityAsync($table, $entity, $options)->wait(); }
php
{ "resource": "" }
q255343
TableRestProxy.mergeEntityAsync
test
public function mergeEntityAsync( $table, Entity $entity, TableServiceOptions $options = null ) { return $this->putOrMergeEntityAsyncImpl( $table, $entity, Resources::HTTP_MERGE, true, $options ); }
php
{ "resource": "" }
q255344
TableRestProxy.deleteEntity
test
public function deleteEntity( $table, $partitionKey, $rowKey, DeleteEntityOptions $options = null ) { $this->deleteEntityAsync($table, $partitionKey, $rowKey, $options)->wait(); }
php
{ "resource": "" }
q255345
TableRestProxy.deleteEntityAsync
test
public function deleteEntityAsync( $table, $partitionKey, $rowKey, DeleteEntityOptions $options = null ) { $context = $this->constructDeleteEntityContext( $table, $partitionKey, $rowKey, $options ); return $this...
php
{ "resource": "" }
q255346
TableRestProxy.getEntity
test
public function getEntity( $table, $partitionKey, $rowKey, GetEntityOptions $options = null ) { return $this->getEntityAsync( $table, $partitionKey, $rowKey, $options )->wait(); }
php
{ "resource": "" }
q255347
TableRestProxy.getEntityAsync
test
public function getEntityAsync( $table, $partitionKey, $rowKey, GetEntityOptions $options = null ) { Validate::canCastAsString($table, 'table'); Validate::notNullOrEmpty($table, 'table'); Validate::isTrue(!is_null($partitionKey), Resources::NULL_TABLE_KEY_MSG)...
php
{ "resource": "" }
q255348
TableRestProxy.batch
test
public function batch( Models\BatchOperations $batchOperations, Models\TableServiceOptions $options = null ) { return $this->batchAsync($batchOperations, $options)->wait(); }
php
{ "resource": "" }
q255349
TableRestProxy.batchAsync
test
public function batchAsync( Models\BatchOperations $batchOperations, Models\TableServiceOptions $options = null ) { Validate::notNullOrEmpty($batchOperations, 'batchOperations'); $method = Resources::HTTP_POST; $operations = $batchOperations->getOperations(); $...
php
{ "resource": "" }
q255350
ListDirectoriesAndFilesResult.create
test
public static function create(array $parsedResponse, $location = '') { $result = new ListDirectoriesAndFilesResult(); $serviceEndpoint = Utilities::tryGetKeysChainValue( $parsedResponse, Resources::XTAG_ATTRIBUTES, Resources::XTAG_SERVICE_ENDPOI...
php
{ "resource": "" }
q255351
ListDirectoriesAndFilesResult.setDirectories
test
protected function setDirectories(array $directories) { $this->directories = array(); foreach ($directories as $directory) { $this->directories[] = clone $directory; } }
php
{ "resource": "" }
q255352
ListDirectoriesAndFilesResult.setFiles
test
protected function setFiles(array $files) { $this->files = array(); foreach ($files as $file) { $this->files[] = clone $file; } }
php
{ "resource": "" }
q255353
Directory.create
test
public static function create(array $parsed) { $result = new Directory(); $name = Utilities::tryGetValue($parsed, Resources::QP_NAME); $result->setName($name); return $result; }
php
{ "resource": "" }
q255354
UpdateEntityResult.create
test
public static function create(array $headers) { $result = new UpdateEntityResult(); $result->setETag( Utilities::tryGetValueInsensitive(Resources::ETAG, $headers) ); return $result; }
php
{ "resource": "" }
q255355
HttpCallContext.setQueryParameters
test
public function setQueryParameters(array $queryParams) { $this->_queryParams = array(); foreach ($queryParams as $key => $value) { $this->addQueryParameter($key, $value); } }
php
{ "resource": "" }
q255356
HttpCallContext.setStatusCodes
test
public function setStatusCodes(array $statusCodes) { $this->_statusCodes = array(); foreach ($statusCodes as $value) { $this->addStatusCode($value); } }
php
{ "resource": "" }
q255357
HttpCallContext.removeHeader
test
public function removeHeader($name) { Validate::canCastAsString($name, 'name'); Validate::notNullOrEmpty($name, 'name'); unset($this->_headers[$name]); }
php
{ "resource": "" }
q255358
HistoryMiddleware.addHistory
test
public function addHistory(array $entry) { if ($this->path !== '') { $this->appendNewEntryToPath($entry); } else { Validate::isTrue( array_key_exists('request', $entry) && array_key_exists('options', $entry) && (array_key_exists...
php
{ "resource": "" }
q255359
HistoryMiddleware.appendNewEntryToPath
test
private function appendNewEntryToPath(array $entry) { $entryNoString = "Entry " . $this->count; $delimiter = str_pad( $entryNoString, self::TITLE_LENGTH, '-', STR_PAD_BOTH ) . PHP_EOL; $entryString = $delimiter; $entryString .= ...
php
{ "resource": "" }
q255360
QueryTablesResult.create
test
public static function create(array $headers, array $entries) { $result = new QueryTablesResult(); $headers = array_change_key_case($headers); $result->setTables($entries); $nextTableName = Utilities::tryGetValue( $headers, Resources::X_MS_CONTINUATION_NEXT...
php
{ "resource": "" }
q255361
ListMessagesResult.create
test
public static function create(array $parsedResponse = null) { $result = new ListMessagesResult(); $queueMessages = array(); if (!empty($parsedResponse)) { $rawMessages = Utilities::getArray($parsedResponse['QueueMessage']); foreach ($rawMessages as $value) { ...
php
{ "resource": "" }
q255362
ListMessagesResult.setQueueMessages
test
protected function setQueueMessages(array $queueMessages) { $this->_queueMessages = array(); foreach ($queueMessages as $value) { $this->_queueMessages[] = clone $value; } }
php
{ "resource": "" }
q255363
CloudConfigurationManager._init
test
private static function _init() { if (!self::$_isInitialized) { self::$_sources = array(); // Get list of default connection string sources. $default = ConnectionStringSource::getDefaultSources(); foreach ($default as $name => $provider) { sel...
php
{ "resource": "" }
q255364
Validate.isValidHostname
test
public static function isValidHostname($hostname) { if (defined('FILTER_VALIDATE_DOMAIN')) { $isValid = filter_var($hostname, FILTER_VALIDATE_DOMAIN, FILTER_FLAG_HOSTNAME); } else { // (less accurate) fallback for PHP < 7.0 $isValid = preg_match('/^[a-z0-9_-]+(\.[...
php
{ "resource": "" }
q255365
Validate.isValidUri
test
public static function isValidUri($uri) { $isValid = filter_var($uri, FILTER_VALIDATE_URL); if ($isValid) { return true; } else { throw new \RuntimeException( sprintf(Resources::INVALID_CONFIG_URI, $uri) ); } }
php
{ "resource": "" }
q255366
Validate.methodExists
test
public static function methodExists($objectInstance, $method, $name) { Validate::canCastAsString($method, 'method'); Validate::notNull($objectInstance, 'objectInstance'); Validate::isObject($objectInstance, 'objectInstance'); if (method_exists($objectInstance, $method)) { ...
php
{ "resource": "" }
q255367
Validate.isDateString
test
public static function isDateString($value, $name) { Validate::canCastAsString($value, 'value'); try { new \DateTime($value); return true; } catch (\Exception $e) { throw new \InvalidArgumentException( sprintf( Resource...
php
{ "resource": "" }
q255368
Validate.hasKey
test
public static function hasKey($key, $name, array $array) { Validate::isArray($array, $name); if (!array_key_exists($key, $array)) { throw new \UnexpectedValueException( sprintf( Resources::INVALID_VALUE_MSG, $name, ...
php
{ "resource": "" }
q255369
Range.getRangeString
test
public function getRangeString() { $rangeString = ''; $rangeString .= ('bytes=' . $this->start . '-'); if ($this->end != null) { $rangeString .= $this->end; } return $rangeString; }
php
{ "resource": "" }
q255370
QueueRestProxy.listQueuesAsync
test
public function listQueuesAsync(ListQueuesOptions $options = null) { $method = Resources::HTTP_GET; $headers = array(); $postParams = array(); $queryParams = array(); $path = Resources::EMPTY_STRING; if (is_null($options)) { $options = ne...
php
{ "resource": "" }
q255371
QueueRestProxy.clearMessages
test
public function clearMessages($queueName, QueueServiceOptions $options = null) { $this->clearMessagesAsync($queueName, $options)->wait(); }
php
{ "resource": "" }
q255372
QueueRestProxy.createMessage
test
public function createMessage( $queueName, $messageText, CreateMessageOptions $options = null ) { return $this->createMessageAsync($queueName, $messageText, $options)->wait(); }
php
{ "resource": "" }
q255373
QueueRestProxy.createMessageAsync
test
public function createMessageAsync( $queueName, $messageText, CreateMessageOptions $options = null ) { Validate::canCastAsString($queueName, 'queueName'); Validate::notNullOrEmpty($queueName, 'queueName'); Validate::canCastAsString($messageText, 'messageText'); ...
php
{ "resource": "" }
q255374
QueueRestProxy.createQueue
test
public function createQueue( $queueName, Models\CreateQueueOptions $options = null ) { $this->createQueueAsync($queueName, $options)->wait(); }
php
{ "resource": "" }
q255375
QueueRestProxy.createQueueAsync
test
public function createQueueAsync( $queueName, Models\CreateQueueOptions $options = null ) { Validate::canCastAsString($queueName, 'queueName'); Validate::notNullOrEmpty($queueName, 'queueName'); $method = Resources::HTTP_PUT; $headers = array(); $pos...
php
{ "resource": "" }
q255376
QueueRestProxy.deleteMessage
test
public function deleteMessage( $queueName, $messageId, $popReceipt, QueueServiceOptions $options = null ) { $this->deleteMessageAsync( $queueName, $messageId, $popReceipt, $options )->wait(); }
php
{ "resource": "" }
q255377
QueueRestProxy.deleteMessageAsync
test
public function deleteMessageAsync( $queueName, $messageId, $popReceipt, QueueServiceOptions $options = null ) { Validate::canCastAsString($queueName, 'queueName'); Validate::notNullOrEmpty($queueName, 'queueName'); Validate::canCastAsString($messageId, 'messa...
php
{ "resource": "" }
q255378
QueueRestProxy.deleteQueue
test
public function deleteQueue($queueName, QueueServiceOptions $options = null) { $this->deleteQueueAsync($queueName, $options)->wait(); }
php
{ "resource": "" }
q255379
QueueRestProxy.deleteQueueAsync
test
public function deleteQueueAsync( $queueName, QueueServiceOptions $options = null ) { Validate::canCastAsString($queueName, 'queueName'); Validate::notNullOrEmpty($queueName, 'queueName'); $method = Resources::HTTP_DELETE; $headers = array(); $postPa...
php
{ "resource": "" }
q255380
QueueRestProxy.getQueueMetadata
test
public function getQueueMetadata($queueName, QueueServiceOptions $options = null) { return $this->getQueueMetadataAsync($queueName, $options)->wait(); }
php
{ "resource": "" }
q255381
QueueRestProxy.getQueueMetadataAsync
test
public function getQueueMetadataAsync( $queueName, QueueServiceOptions $options = null ) { Validate::canCastAsString($queueName, 'queueName'); Validate::notNullOrEmpty($queueName, 'queueName'); $method = Resources::HTTP_GET; $headers = array(); $post...
php
{ "resource": "" }
q255382
QueueRestProxy.listMessages
test
public function listMessages($queueName, ListMessagesOptions $options = null) { return $this->listMessagesAsync($queueName, $options)->wait(); }
php
{ "resource": "" }
q255383
QueueRestProxy.listMessagesAsync
test
public function listMessagesAsync( $queueName, ListMessagesOptions $options = null ) { Validate::canCastAsString($queueName, 'queueName'); Validate::notNullOrEmpty($queueName, 'queueName'); $method = Resources::HTTP_GET; $headers = array(); $queryPar...
php
{ "resource": "" }
q255384
QueueRestProxy.peekMessages
test
public function peekMessages($queueName, PeekMessagesOptions $options = null) { return $this->peekMessagesAsync($queueName, $options)->wait(); }
php
{ "resource": "" }
q255385
QueueRestProxy.peekMessagesAsync
test
public function peekMessagesAsync( $queueName, PeekMessagesOptions $options = null ) { Validate::canCastAsString($queueName, 'queueName'); Validate::notNullOrEmpty($queueName, 'queueName'); $method = Resources::HTTP_GET; $headers = array(); $queryPar...
php
{ "resource": "" }
q255386
SharedAccessSignatureHelper.generateAccountSharedAccessSignatureToken
test
public function generateAccountSharedAccessSignatureToken( $signedVersion, $signedPermissions, $signedService, $signedResourceType, $signedExpiry, $signedStart = "", $signedIP = "", $signedProtocol = "" ) { // check that version is valid ...
php
{ "resource": "" }
q255387
SharedAccessSignatureHelper.validateAndSanitizeSignedService
test
protected function validateAndSanitizeSignedService($signedService) { // validate signed service is not null or empty Validate::canCastAsString($signedService, 'signedService'); Validate::notNullOrEmpty($signedService, 'signedService'); // The signed service should only be a combina...
php
{ "resource": "" }
q255388
SharedAccessSignatureHelper.validateAndSanitizeSignedResourceType
test
protected function validateAndSanitizeSignedResourceType($signedResourceType) { // validate signed resource type is not null or empty Validate::canCastAsString($signedResourceType, 'signedResourceType'); Validate::notNullOrEmpty($signedResourceType, 'signedResourceType'); // The sig...
php
{ "resource": "" }
q255389
SharedAccessSignatureHelper.validateAndSanitizeSignedPermissions
test
protected function validateAndSanitizeSignedPermissions( $signedPermissions ) { // validate signed permissions are not null or empty Validate::canCastAsString($signedPermissions, 'signedPermissions'); Validate::notNullOrEmpty($signedPermissions, 'signedPermissions'); $validP...
php
{ "resource": "" }
q255390
SharedAccessSignatureHelper.validateAndSanitizeSignedProtocol
test
protected function validateAndSanitizeSignedProtocol($signedProtocol) { Validate::canCastAsString($signedProtocol, 'signedProtocol'); // sanitize string $sanitizedSignedProtocol = strtolower($signedProtocol); if (strlen($sanitizedSignedProtocol) > 0) { if (strcmp($sanitiz...
php
{ "resource": "" }
q255391
SharedAccessSignatureHelper.validateAndSanitizeStringWithArray
test
protected function validateAndSanitizeStringWithArray($input, array $array) { $result = ''; foreach ($array as $value) { if (strpos($input, $value) !== false) { //append the valid permission to result. $result .= $value; //remove all the ch...
php
{ "resource": "" }
q255392
SharedAccessSignatureHelper.generateCanonicalResource
test
protected static function generateCanonicalResource( $accountName, $service, $resource ) { static $serviceMap = array( Resources::RESOURCE_TYPE_BLOB => 'blob', Resources::RESOURCE_TYPE_FILE => 'file', Resources::RESOURCE_TYPE_QUEUE => 'queue', ...
php
{ "resource": "" }
q255393
ServiceException.parseErrorMessage
test
protected static function parseErrorMessage(ResponseInterface $response) { //try to parse using xml serializer, if failed, return the whole body //as the error message. $serializer = new XmlSerializer(); $errorMessage = ''; try { $internalErrors = libxml_use_inter...
php
{ "resource": "" }
q255394
ServiceException.getRequestID
test
public function getRequestID() { $requestID = ''; if (array_key_exists( Resources::X_MS_REQUEST_ID, $this->getResponse()->getHeaders() )) { $requestID = $this->getResponse() ->getHeaders()[Resources::X_MS_REQUEST_ID][0]; } r...
php
{ "resource": "" }
q255395
ServiceException.getDate
test
public function getDate() { $date = ''; if (array_key_exists( Resources::DATE, $this->getResponse()->getHeaders() )) { $date = $this->getResponse() ->getHeaders()[Resources::DATE][0]; } return $date; }
php
{ "resource": "" }
q255396
ServiceOptions.setMiddlewares
test
public function setMiddlewares(array $middlewares) { foreach ($middlewares as $middleware) { self::validateIsMiddleware($middleware); } $this->middlewares = $middlewares; }
php
{ "resource": "" }
q255397
ServiceOptions.validateIsMiddleware
test
private static function validateIsMiddleware($middleware) { if (!(is_callable($middleware) || $middleware instanceof IMiddleware)) { Validate::isTrue( false, Resources::INVALID_TYPE_MSG . 'callable or IMiddleware' ); } }
php
{ "resource": "" }
q255398
ConnectionStringParser._parse
test
private function _parse() { $key = null; $value = null; $connectionStringValues = array(); while (true) { $this->_skipWhiteSpaces(); if ($this->_pos == strlen($this->_value) && $this->_state != ConnectionSt...
php
{ "resource": "" }
q255399
ConnectionStringParser._createException
test
private function _createException($position, $errorString) { $arguments = func_get_args(); // Remove first and second arguments (position and error string) unset($arguments[0], $arguments[1]); // Create a short error message. $errorString = vsprintf($errorString, $arguments...
php
{ "resource": "" }