本文整理汇总了PHP中WindowsAzure\Common\Internal\Validate::notNull方法的典型用法代码示例。如果您正苦于以下问题:PHP Validate::notNull方法的具体用法?PHP Validate::notNull怎么用?PHP Validate::notNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowsAzure\Common\Internal\Validate
的用法示例。
在下文中一共展示了Validate::notNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFromOptions
/**
* Create IngestManifestAsset from array.
*
* @param array $options Array containing values for object properties
*
* @return WindowsAzure\MediaServices\Models\IngestManifestAsset
*/
public static function createFromOptions($options)
{
Validate::notNull($options['ParentIngestManifestId'], 'options[ParentIngestManifestId]');
$asset = new self($options['ParentIngestManifestId']);
$asset->fromArray($options);
return $asset;
}
示例2: objectSerialize
/**
* Serialize an object with specified root element name.
*
* @param object $targetObject The target object.
* @param string $rootName The name of the root element.
*
* @return string
*/
public static function objectSerialize($targetObject, $rootName)
{
Validate::notNull($targetObject, 'targetObject');
Validate::isString($rootName, 'rootName');
$contianer = new \stdClass();
$contianer->{$rootName} = $targetObject;
return json_encode($contianer);
}
示例3: handleRequest
/**
* Adds WRAP authentication header to the request headers.
*
* @param HttpClient $request HTTP channel object.
*
* @return \HTTP_Request2
*/
public function handleRequest($request)
{
Validate::notNull($request, 'request');
$wrapAccessToken = $this->_wrapTokenManager->getAccessToken($request->getUrl());
$authorization = sprintf(Resources::WRAP_AUTHORIZATION, $wrapAccessToken);
$request->setHeader(Resources::AUTHENTICATION, $authorization);
return $request;
}
示例4: writeInnerXml
/**
* Writes an XML representing the category.
*
* @param \XMLWriter $xmlWriter The XML writer.
*
* @return none
*/
public function writeInnerXml($xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
$this->writeOptionalAttribute($xmlWriter, 'term', $this->term);
$this->writeOptionalAttribute($xmlWriter, 'scheme', $this->scheme);
$this->writeOptionalAttribute($xmlWriter, 'label', $this->label);
if (!empty($this->undefinedContent)) {
$xmlWriter->WriteRaw($this->undefinedContent);
}
}
示例5: objectSerialize
/**
* Serialize an object with specified root element name.
*
* @param object $targetObject The target object.
* @param string $rootName The name of the root element.
*
* @return string
*/
public static function objectSerialize($targetObject, $rootName)
{
Validate::notNull($targetObject, 'targetObject');
Validate::isString($rootName, 'rootName');
$xmlWriter = new \XmlWriter();
$xmlWriter->openMemory();
$xmlWriter->setIndent(true);
$reflectionClass = new \ReflectionClass($targetObject);
$methodArray = $reflectionClass->getMethods();
$attributes = self::_getInstanceAttributes($targetObject, $methodArray);
$xmlWriter->startElement($rootName);
if (!is_null($attributes)) {
foreach (array_keys($attributes) as $attributeKey) {
$xmlWriter->writeAttribute($attributeKey, $attributes[$attributeKey]);
}
}
foreach ($methodArray as $method) {
if (strpos($method->name, 'get') === 0 && $method->isPublic() && $method->name != 'getAttributes') {
$variableName = substr($method->name, 3);
$variableValue = $method->invoke($targetObject);
if (!empty($variableValue)) {
if (gettype($variableValue) === 'object') {
$xmlWriter->writeRaw(XmlSerializer::objectSerialize($variableValue, $variableName));
} else {
$xmlWriter->writeElement($variableName, $variableValue);
}
}
}
}
$xmlWriter->endElement();
return $xmlWriter->outputMemory(true);
}
示例6: uploadAssetFile
/**
* Upload asset file to storage.
*
* @param WindowsAzure\MediaServices\Models\Locator $locator Write locator for
* file upload
*
* @param string $name Uploading filename
* @param string $body Uploading content
*
* @return none
*/
public function uploadAssetFile($locator, $name, $body)
{
Validate::isA($locator, 'WindowsAzure\\Mediaservices\\Models\\Locator', 'locator');
Validate::isString($name, 'name');
Validate::notNull($body, 'body');
$method = Resources::HTTP_PUT;
$urlFile = $locator->getBaseUri() . '/' . $name;
$url = new Url($urlFile . $locator->getContentAccessComponent());
$filters = array();
$statusCode = Resources::STATUS_CREATED;
$headers = array(Resources::CONTENT_TYPE => Resources::BINARY_FILE_TYPE, Resources::X_MS_VERSION => Resources::STORAGE_API_LATEST_VERSION, Resources::X_MS_BLOB_TYPE => BlobType::BLOCK_BLOB);
$httpClient = new HttpClient();
$httpClient->setMethod($method);
$httpClient->setHeaders($headers);
$httpClient->setExpectedStatusCode($statusCode);
$httpClient->setBody($body);
$httpClient->send($filters, $url);
}
示例7: writeInnerXml
/**
* Writes an XML representing the feed object.
*
* @param \XMLWriter $xmlWriter The XML writer.
*
* @return none
*/
public function writeInnerXml($xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
if (!is_null($this->attributes)) {
if (is_array($this->attributes)) {
foreach ($this->attributes as $attributeName => $attributeValue) {
$xmlWriter->writeAttribute($attributeName, $attributeValue);
}
}
}
if (!is_null($this->author)) {
$this->writeArrayItem($xmlWriter, $this->author, Resources::AUTHOR);
}
if (!is_null($this->category)) {
$this->writeArrayItem($xmlWriter, $this->category, Resources::CATEGORY);
}
if (!is_null($this->contributor)) {
$this->writeArrayItem($xmlWriter, $this->contributor, Resources::CONTRIBUTOR);
}
if (!is_null($this->generator)) {
$this->generator->writeXml($xmlWriter);
}
$this->writeOptionalElementNS($xmlWriter, 'atom', 'icon', Resources::ATOM_NAMESPACE, $this->icon);
$this->writeOptionalElementNS($xmlWriter, 'atom', 'logo', Resources::ATOM_NAMESPACE, $this->logo);
$this->writeOptionalElementNS($xmlWriter, 'atom', 'id', Resources::ATOM_NAMESPACE, $this->id);
if (!is_null($this->link)) {
$this->writeArrayItem($xmlWriter, $this->link, Resources::LINK);
}
$this->writeOptionalElementNS($xmlWriter, 'atom', 'rights', Resources::ATOM_NAMESPACE, $this->rights);
$this->writeOptionalElementNS($xmlWriter, 'atom', 'subtitle', Resources::ATOM_NAMESPACE, $this->subtitle);
$this->writeOptionalElementNS($xmlWriter, 'atom', 'title', Resources::ATOM_NAMESPACE, $this->title);
if (!is_null($this->updated)) {
$xmlWriter->writeElementNS('atom', 'updated', Resources::ATOM_NAMESPACE, $this->updated->format(\DateTime::ATOM));
}
}
示例8: setProperty
/**
* Sets the value of a custom property.
*
* @param string $propertyName The name of the property.
* @param mixed $propertyValue The value of the property.
*
* @return none
*/
public function setProperty($propertyName, $propertyValue)
{
Validate::isString($propertyName, 'propertyName');
Validate::notNull($propertyValue, 'propertyValue');
$this->_customProperties[strtolower($propertyName)] = $propertyValue;
}
示例9: uploadAssetFile
/**
* Upload asset file to storage.
*
* @param WindowsAzure\MediaServices\Models\Locator $locator Write locator for
* file upload
*
* @param string $name Uploading filename
* @param string | resource $file Uploading content or file handle
*
* @return none
*/
public function uploadAssetFile($locator, $name, $file)
{
Validate::isA($locator, 'WindowsAzure\\Mediaservices\\Models\\Locator', 'locator');
Validate::isString($name, 'name');
Validate::notNull($file, 'body');
$urlFile = $locator->getBaseUri() . '/' . $name;
$url = $urlFile . $locator->getContentAccessComponent();
if (is_resource($file)) {
$this->_uploadAssetFileFromResource($url, $file);
} else {
$this->_uploadAssetFileFromString($url, $file);
}
}
示例10: writeInnerXml
/**
* Writes an inner XML representing the content.
*
* @param \XMLWriter $xmlWriter The XML writer.
*
* @return none
*/
public function writeInnerXml($xmlWriter)
{
Validate::notNull($xmlWriter, 'xmlWriter');
$xmlWriter->writeRaw($this->text);
}
示例11: createFromOptions
/**
* Create access policy from array
*
* @param array $options Array containing values for object properties
*
* @return WindowsAzure\MediaServices\Models\AccessPolicy
*/
public static function createFromOptions($options)
{
Validate::notNull($options['Name'], 'options[Name]');
$accessPolicy = new AccessPolicy($options['Name']);
$accessPolicy->fromArray($options);
return $accessPolicy;
}
示例12: generateTestToken
public static function generateTestToken($template, $verificationKey, $contentKeyUUID, $tokenExpiration = null, $notBefore = null)
{
Validate::notNull($template, 'template');
Validate::isA($template, 'WindowsAzure\\MediaServices\\Templates\\TokenRestrictionTemplate', 'template');
if ($verificationKey == null) {
$verificationKey = $template->getPrimaryVerificationKey();
}
Validate::notNull($verificationKey, 'verificationKey');
Validate::isA($verificationKey, 'WindowsAzure\\MediaServices\\Templates\\SymmetricVerificationKey', 'verificationKey');
if ($tokenExpiration == null) {
$tokenExpiration = time() + 60 * 10;
}
if ($notBefore == null) {
$notBefore = time() - 60 * 5;
}
if ($template->getTokenType() == TokenType::SWT) {
return TokenRestrictionTemplateSerializer::generateTestTokenSWT($template, $verificationKey, $contentKeyUUID, $tokenExpiration);
} else {
return TokenRestrictionTemplateSerializer::generateTestTokenJWT($template, $verificationKey, $contentKeyUUID, $tokenExpiration, $notBefore);
}
}
示例13: updateMessage
/**
* Updates the visibility timeout of a message and/or the message contents.
*
* @param string $queueName The queue name.
* @param string $messageId The id of the message.
* @param string $popReceipt The valid pop receipt
* value returned from an earlier call to the Get Messages or Update Message
* operation.
* @param string $messageText The message contents.
* @param int $visibilityTimeoutInSeconds Specifies the new
* visibility timeout value, in seconds, relative to server time.
* The new value must be larger than or equal to 0, and cannot be larger
* than 7 days. The visibility timeout of a message cannot be set to a value
* later than the expiry time. A message can be updated until it has been
* deleted or has expired.
* @param QueueServiceOptions $options The optional
* parameters.
*
* @return WindowsAzure\Common\Models\UpdateMessageResult
*/
public function updateMessage($queueName, $messageId, $popReceipt, $messageText, $visibilityTimeoutInSeconds, $options = null)
{
Validate::isString($queueName, 'queueName');
Validate::notNullOrEmpty($queueName, 'queueName');
Validate::isString($messageId, 'messageId');
Validate::notNullOrEmpty($messageId, 'messageId');
Validate::isString($popReceipt, 'popReceipt');
Validate::notNullOrEmpty($popReceipt, 'popReceipt');
Validate::isString($messageText, 'messageText');
Validate::isInteger($visibilityTimeoutInSeconds, 'visibilityTimeoutInSeconds');
Validate::notNull($visibilityTimeoutInSeconds, 'visibilityTimeoutInSeconds');
$method = Resources::HTTP_PUT;
$headers = array();
$postParams = array();
$queryParams = array();
$path = $queueName . '/messages' . '/' . $messageId;
$body = Resources::EMPTY_STRING;
$statusCode = Resources::STATUS_NO_CONTENT;
if (is_null($options)) {
$options = new QueueServiceOptions();
}
$this->addOptionalQueryParam($queryParams, Resources::QP_VISIBILITY_TIMEOUT, $visibilityTimeoutInSeconds);
$this->addOptionalQueryParam($queryParams, Resources::QP_TIMEOUT, $options->getTimeout());
$this->addOptionalQueryParam($queryParams, Resources::QP_POPRECEIPT, $popReceipt);
if (!empty($messageText)) {
$this->addOptionalHeader($headers, Resources::CONTENT_TYPE, Resources::URL_ENCODED_CONTENT_TYPE);
$message = new QueueMessage();
$message->setMessageText($messageText);
$body = $message->toXml($this->dataSerializer);
}
$response = $this->send($method, $headers, $queryParams, $postParams, $path, $statusCode, $body);
$popReceipt = $response->getHeader(Resources::X_MS_POPRECEIPT);
$timeNextVisible = $response->getHeader(Resources::X_MS_TIME_NEXT_VISIBLE);
$date = Utilities::rfc1123ToDateTime($timeNextVisible);
$result = new UpdateMessageResult();
$result->setPopReceipt($popReceipt);
$result->setTimeNextVisible($date);
return $result;
}
示例14: createFromOptions
/**
* Create asset from array
*
* @param array $options Array containing values for object properties
*
* @return WindowsAzure\MediaServices\Models\JobTemplate
*/
public static function createFromOptions($options)
{
Validate::notNull($options['JobTemplateBody'], 'options[JobTemplateBody]');
$jobTemplate = new JobTemplate($options['JobTemplateBody'], $options['TemplateType']);
$jobTemplate->fromArray($options);
return $jobTemplate;
}
示例15: createFromOptions
/**
* Create task template from array.
*
* @param array $options Array containing values for object properties
*
* @return WindowsAzure\MediaServices\Models\TaskTemplate
*/
public static function createFromOptions($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;
}