• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Common\Lang类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中OpenCloud\Common\Lang的典型用法代码示例。如果您正苦于以下问题:PHP Lang类的具体用法?PHP Lang怎么用?PHP Lang使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Lang类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: resourceName

 /**
  * Returns the resource name for the URL of the object; must be overridden
  * in child classes
  *
  * For example, a server is `/servers/`, a database instance is
  * `/instances/`. Must be overridden in child classes.
  *
  * @throws Exceptions\UrlError
  */
 public static function resourceName()
 {
     if (isset(static::$url_resource)) {
         return static::$url_resource;
     }
     throw new Exceptions\UrlError(sprintf(Lang::translate('No URL resource defined for class [%s] in ResourceName()'), get_class()));
 }
开发者ID:Kevin-ZK,项目名称:vaneDisk,代码行数:16,代码来源:PersistentObject.php


示例17: __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, $serviceType, $serviceName, $serviceRegion, $urltype)
 {
     parent::__construct($conn, $serviceType, $serviceName, $serviceRegion, $urltype);
     $this->_url = Lang::noslash(parent::Url());
     $this->getLogger()->info(Lang::translate('Initializing Nova...'));
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:22,代码来源:Nova.php


示例18: createJson

 /**
  * Generates the JSON string for Create()
  *
  * @return \stdClass
  */
 protected function createJson()
 {
     if (empty($this->flavor) || !is_object($this->flavor)) {
         throw new Exceptions\InstanceFlavorError(Lang::translate('The `flavor` attribute is required and must be a Flavor object'));
     }
     if (!isset($this->name)) {
         throw new Exceptions\InstanceError(Lang::translate('Instance name is required'));
     }
     return (object) array('instance' => (object) array('flavorRef' => $this->flavor->links[0]->href, 'name' => $this->name, 'volume' => $this->volume));
 }
开发者ID:kasobus,项目名称:EDENS-Mautic,代码行数:15,代码来源:Instance.php


示例19: Service

 /**
  * Generic Service factory method
  *
  * Contains code reused by the other service factory methods.
  *
  * @param string $class the name of the Service class to produce
  * @param string $name the name of the Compute service to attach to
  * @param string $region the name of the region to use
  * @param string $urltype the URL type (normally "publicURL")
  * @return Service (or subclass such as Compute, ObjectStore)
  * @throws ServiceValueError
  */
 public function Service($class, $name = null, $region = null, $urltype = null)
 {
     // debug message
     $this->debug('Factory for class [%s] [%s/%s/%s]', $class, $name, $region, $urltype);
     if (strpos($class, '\\OpenCloud\\') === 0) {
         $class = str_replace('\\OpenCloud\\', '', $class);
     }
     // check for defaults
     if (!isset($name)) {
         $name = $this->defaults[$class]['name'];
     }
     if (!isset($region)) {
         $region = $this->defaults[$class]['region'];
     }
     if (!isset($urltype)) {
         $urltype = $this->defaults[$class]['urltype'];
     }
     // report errors
     if (!$name) {
         throw new Exceptions\ServiceValueError(Lang::translate('No value for ' . $class . ' name'));
     }
     if (!$region) {
         throw new Exceptions\ServiceValueError(Lang::translate('No value for ' . $class . ' region'));
     }
     if (!$urltype) {
         throw new Exceptions\ServiceValueError(Lang::translate('No value for ' . $class . ' URL type'));
     }
     // return the object
     $fullclass = '\\OpenCloud\\' . $class . '\\Service';
     return new $fullclass($this, $name, $region, $urltype);
 }
开发者ID:sajib88,项目名称:studentdoctor,代码行数:43,代码来源:OpenStack.php


示例20: execute

 /**
  * Executes the current request
  *
  * This method actually performs the request using the values set
  * previously. It throws a OpenCloud\HttpError exception on
  * any CURL error.
  *
  * @return OpenCloud\HttpResponse
  * @throws OpenCloud\HttpError
  * 
  * @codeCoverageIgnore
  */
 public function execute()
 {
     // set all the headers
     $headarr = array();
     foreach ($this->headers as $name => $value) {
         $headarr[] = $name . ': ' . $value;
     }
     $this->setOption(CURLOPT_HTTPHEADER, $headarr);
     // set up to retry if necessary
     $try_counter = 0;
     do {
         $data = curl_exec($this->handle);
         if (curl_errno($this->handle) && $try_counter < $this->retries) {
             $this->getLogger()->info(Lang::translate('Curl error [%d]; retrying [%s]'), array('error' => curl_errno($this->handle), 'url' => $this->url));
         }
     } while (++$try_counter <= $this->retries && curl_errno($this->handle) != 0);
     // log retries error
     if ($this->retries && curl_errno($this->handle)) {
         throw new HttpRetryError(sprintf(Lang::translate('No more retries available, last error [%d]'), curl_errno($this->handle)));
     }
     // check for CURL errors
     switch (curl_errno($this->handle)) {
         case 0:
             // everything's ok
             break;
         case 3:
             throw new HttpUrlError(sprintf(Lang::translate('Malformed URL [%s]'), $this->url));
             break;
         case 28:
             // timeout
             throw new HttpTimeoutError(Lang::translate('Operation timed out; check RAXSDK_TIMEOUT value'));
             break;
         default:
             throw new HttpError(sprintf(Lang::translate('HTTP error on [%s], curl code [%d] message [%s]'), $this->url, curl_errno($this->handle), curl_error($this->handle)));
     }
     // otherwise, return the HttpResponse
     return new Response\Http($this, $data);
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:50,代码来源:Curl.php



注:本文中的OpenCloud\Common\Lang类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Message\Formatter类代码示例发布时间:2022-05-23
下一篇:
PHP OpenCloud\Rackspace类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap