当前位置: 首页>>代码示例>>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;未经允许,请勿转载。