當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Common\Lang類代碼示例

本文整理匯總了PHP中OpenCloud\Common\Lang的典型用法代碼示例。如果您正苦於以下問題:PHP Lang類的具體用法?PHP Lang怎麽用?PHP Lang使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Lang類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getName

 /**
  * Returns name of this database. Because it's so important (i.e. as an
  * identifier), it will throw an error if not set/empty.
  *
  * @return type
  * @throws Exceptions\DatabaseNameError
  */
 public function getName()
 {
     if (empty($this->name)) {
         throw new Exceptions\DatabaseNameError(Lang::translate('The database does not have a Url yet'));
     }
     return $this->name;
 }
開發者ID:svn2github,項目名稱:rackspace-cloud-files-cdn,代碼行數:14,代碼來源:Database.php

示例2: updateJson

 /**
  * creates the JSON for update
  *
  * @return stdClass
  */
 protected function updateJson($params = array())
 {
     if (!$this->getUpdateKeys()) {
         throw new Exceptions\UpdateError(Lang::translate('Missing [updateKeys]'));
     }
     return $this->getJson($this->getUpdateKeys());
 }
開發者ID:BulatSa,項目名稱:Ctex,代碼行數:12,代碼來源:Object.php

示例3: __construct

 /**
  * constructur ensures that the record type is PTR
  */
 public function __construct($parent, $info = null)
 {
     $this->type = 'PTR';
     parent::__construct($parent, $info);
     if ($this->type != 'PTR') {
         throw new Exceptions\RecordTypeError(sprintf(Lang::translate('Invalid record type [%s], must be PTR'), $this->type));
     }
 }
開發者ID:omusico,項目名稱:home365,代碼行數:11,代碼來源:PtrRecord.php

示例4: __construct

 public function __construct(Client $client, $type = null, $name = null, $region = null, $urlType = null)
 {
     parent::__construct($client, $type, $name, $region, $urlType);
     if (strpos($this->getUrl()->getPath(), '/v1') !== false) {
         throw new Exceptions\UnsupportedVersionError(sprintf(Lang::translate('Sorry; API version /v1 is not supported [%s]'), $this->getUrl()));
     }
     $this->loadNamespaces();
 }
開發者ID:Kevin-ZK,項目名稱:vaneDisk,代碼行數:8,代碼來源:Service.php

示例5: SetTempUrlSecret

 /**
  * sets the shared secret value for the TEMP_URL
  *
  * @param string $secret the shared secret
  * @return HttpResponse
  */
 public function SetTempUrlSecret($secret)
 {
     $response = $this->Request($this->Url(), 'POST', array('X-Account-Meta-Temp-Url-Key' => $secret));
     if ($response->HttpStatus() > 204) {
         throw new Exceptions\HttpError(sprintf(Lang::translate('Error in request, status [%d] for URL [%s] [%s]'), $response->HttpStatus(), $this->Url(), $response->HttpBody()));
     }
     return $response;
 }
開發者ID:omusico,項目名稱:home365,代碼行數:14,代碼來源:Service.php

示例6: setTempUrlSecret

 /** 
  * Sets the shared secret value for the TEMP_URL
  *
  * @param string $secret the shared secret
  * @return HttpResponse
  */
 public function setTempUrlSecret($secret)
 {
     $response = $this->request($this->url(), 'POST', array('X-Account-Meta-Temp-Url-Key' => $secret));
     // @codeCoverageIgnoreStart
     if ($response->httpStatus() > 204) {
         throw new Exceptions\HttpError(sprintf(Lang::translate('Error in request, status [%d] for URL [%s] [%s]'), $response->httpStatus(), $this->url(), $response->httpBody()));
     }
     // @codeCoverageIgnoreEnd
     return $response;
 }
開發者ID:BulatSa,項目名稱:Ctex,代碼行數:16,代碼來源:Service.php

示例7: Delete

 /**
  * Deletes an isolated network
  *
  * @api
  * @return \OpenCloud\HttpResponse
  * @throws NetworkDeleteError if HTTP status is not Success
  */
 public function Delete()
 {
     switch ($this->id) {
         case RAX_PUBLIC:
         case RAX_PRIVATE:
             throw new Exceptions\DeleteError(Lang::translate('Network may not be deleted'));
             break;
         default:
             return parent::Delete();
             break;
     }
 }
開發者ID:omusico,項目名稱:home365,代碼行數:19,代碼來源:Network.php

示例8: __construct

 /**
  * Called when creating a new Compute service object
  *
  * _NOTE_ that the order of parameters for this is *different* from the
  * parent Service class. This is because the earlier parameters are the
  * ones that most typically change, whereas the later ones are not
  * modified as often.
  *
  * @param \OpenCloud\Identity $conn - a connection object
  * @param string $serviceRegion - identifies the region of this Compute
  *      service
  * @param string $urltype - identifies the URL type ("publicURL",
  *      "privateURL")
  * @param string $serviceName - identifies the name of the service in the
  *      catalog
  */
 public function __construct(OpenStack $conn, $serviceName, $serviceRegion, $urltype)
 {
     $this->getLogger()->info(Lang::translate('Initializing compute...'));
     parent::__construct($conn, 'compute', $serviceName, $serviceRegion, $urltype);
     // check the URL version
     $path = parse_url($this->Url(), PHP_URL_PATH);
     if (substr($path, 0, 3) == '/v1') {
         throw new Exceptions\UnsupportedVersionError(sprintf(Lang::translate('Sorry; API version /v1 is not supported [%s]'), $this->Url()));
     }
     $this->load_namespaces();
     $this->_namespaces[] = 'OS-FLV-DISABLED';
 }
開發者ID:artlabsdesign,項目名稱:missbloom,代碼行數:28,代碼來源:Service.php

示例9: createJson

 /**
  * Returns the JSON object for creating the backup
  */
 protected function createJson()
 {
     if (!isset($this->instanceId)) {
         throw new Exceptions\BackupInstanceError(Lang::translate('The `instanceId` attribute is required and must be a string'));
     }
     if (!isset($this->name)) {
         throw new Exceptions\BackupNameError(Lang::translate('Backup name is required'));
     }
     $out = ['backup' => ['name' => $this->name, 'instance' => $this->instanceId]];
     if (isset($this->description)) {
         $out['backup']['description'] = $this->description;
     }
     return (object) $out;
 }
開發者ID:gpenverne,項目名稱:php-opencloud,代碼行數:17,代碼來源:Backup.php

示例10: Update

 /**
  * Always throws an error; updates are not permitted
  *
  * @throws NetworkUpdateError always
  */
 public function Update($params = array())
 {
     throw new Exceptions\NetworkUpdateError(Lang::translate('Isolated networks cannot be updated'));
 }
開發者ID:artlabsdesign,項目名稱:missbloom,代碼行數:9,代碼來源:Network.php

示例11: Name

 /**
  * returns a (default) name of the object
  *
  * The name is constructed by the object class and the object's ID.
  *
  * @api
  * @return string
  */
 public function Name()
 {
     return sprintf(Lang::translate('%s-%s'), get_class($this), $this->Parent()->Id());
 }
開發者ID:omusico,項目名稱:home365,代碼行數:12,代碼來源:SubResource.php

示例12: getUrl

 public function getUrl($path = null, array $params = array())
 {
     if (!$this->name) {
         throw new Exceptions\NoNameError(Lang::translate('Object has no name'));
     }
     return $this->container->getUrl($this->name);
 }
開發者ID:santikrass,項目名稱:apache,代碼行數:7,代碼來源:DataObject.php

示例13: checkJsonError

 /**
  * Checks the most recent JSON operation for errors.
  *
  * @throws Exceptions\JsonError
  * @codeCoverageIgnore
  */
 public static function checkJsonError()
 {
     switch (json_last_error()) {
         case JSON_ERROR_NONE:
             return;
         case JSON_ERROR_DEPTH:
             $jsonError = 'JSON error: The maximum stack depth has been exceeded';
             break;
         case JSON_ERROR_STATE_MISMATCH:
             $jsonError = 'JSON error: Invalid or malformed JSON';
             break;
         case JSON_ERROR_CTRL_CHAR:
             $jsonError = 'JSON error: Control character error, possibly incorrectly encoded';
             break;
         case JSON_ERROR_SYNTAX:
             $jsonError = 'JSON error: Syntax error';
             break;
         case JSON_ERROR_UTF8:
             $jsonError = 'JSON error: Malformed UTF-8 characters, possibly incorrectly encoded';
             break;
         default:
             $jsonError = 'Unexpected JSON error';
             break;
     }
     if (isset($jsonError)) {
         throw new JsonError(Lang::translate($jsonError));
     }
 }
開發者ID:Kevin-ZK,項目名稱:vaneDisk,代碼行數:34,代碼來源:Base.php

示例14: getCredentials

 /**
  * Formats the credentials array (as a string) for authentication
  *
  * @return string
  * @throws Common\Exceptions\CredentialError
  */
 public function getCredentials()
 {
     if (!empty($this->secret['username']) && !empty($this->secret['password'])) {
         $credentials = array('auth' => array('passwordCredentials' => array('username' => $this->secret['username'], 'password' => $this->secret['password'])));
         if (!empty($this->secret['tenantName'])) {
             $credentials['auth']['tenantName'] = $this->secret['tenantName'];
         } elseif (!empty($this->secret['tenantId'])) {
             $credentials['auth']['tenantId'] = $this->secret['tenantId'];
         }
         return json_encode($credentials);
     } else {
         throw new Exceptions\CredentialError(Lang::translate('Unrecognized credential secret'));
     }
 }
開發者ID:santikrass,項目名稱:apache,代碼行數:20,代碼來源:OpenStack.php

示例15: CreateJson

 /**
  * Creates the JSON for creating a new server
  *
  * @param string $element creates {server ...} by default, but can also
  *      create {rebuild ...} by changing this parameter
  * @return json
  */
 protected function CreateJson()
 {
     // create a blank object
     $obj = new \stdClass();
     // set a bunch of properties
     $obj->server = new \stdClass();
     $obj->server->imageRef = $this->imageRef;
     $obj->server->name = $this->name;
     $obj->server->flavorRef = $this->flavorRef;
     $obj->server->metadata = $this->metadata;
     if (is_array($this->networks) && count($this->networks)) {
         $obj->server->networks = array();
         foreach ($this->networks as $net) {
             if (get_class($net) != 'OpenCloud\\Compute\\Network') {
                 throw new Exceptions\InvalidParameterError(sprintf(Lang::translate('"networks" parameter must be an ' . 'array of Compute\\Network objects; [%s] found'), get_class($net)));
             }
             $netobj = new \stdClass();
             $netobj->uuid = $net->id;
             $obj->server->networks[] = $netobj;
         }
     }
     // handle personality files
     if (count($this->personality)) {
         $obj->server->personality = array();
         foreach ($this->personality as $path => $data) {
             $fileobj = new \stdClass();
             $fileobj->path = $path;
             $fileobj->contents = $data;
             $obj->server->personality[] = $fileobj;
         }
     }
     return json_encode($obj);
 }
開發者ID:sajib88,項目名稱:studentdoctor,代碼行數:40,代碼來源:Server.php


注:本文中的OpenCloud\Common\Lang類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。