当前位置: 首页>>代码示例>>PHP>>正文


PHP Api::setId方法代码示例

本文整理汇总了PHP中Api::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::setId方法的具体用法?PHP Api::setId怎么用?PHP Api::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Api的用法示例。


在下文中一共展示了Api::setId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fromXML

 public static function fromXML(SimpleXMLElement $xml)
 {
     //        LoggerInterface::log("api xml: " . print_r($xml->saveXML(), true), LoggerInterface::DEBUG);
     $api = new Api();
     $api->setId((string) $xml->id);
     $api->setDisplayName((string) $xml->displayName);
     $api->setVersion((string) $xml->version);
     $api->setType(ApiType::fromXML($xml->type));
     $api->setEndpoint((string) $xml->endpoint);
     $api->setAuthentication(ProvisionAuthentication::fromXML($xml->authentication));
     $api->setTdrEnabled($xml->tdrEnabled->enabled == 'true' ? true : false);
     $api->setTdrOnLimitReached((string) $xml->tdrOnLimitReached['type']);
     $api->setTdrOnUse((string) $xml->tdrOnUse['type']);
     $api->setStatus((string) $xml->status);
     $v = Validation::fromXML($xml->validation);
     if ($v !== null) {
         $api->setValidation($v);
     }
     $api->setSubscriptionStep((string) $xml->subscriptionStep);
     $api->setNotificationFormat((string) $xml->notificationFormat);
     $https = self::get_bool_value((string) $xml->https);
     if ($https) {
         $api->setHttps(HTTPSType::fromXML($xml->https));
     } else {
         $httpsType = new HTTPSType();
         $httpsType->setEnabled(false);
         $api->setHttps($httpsType);
     }
     $contexts = array();
     foreach ($xml->contexts->context as $contextXML) {
         $context = ApiContext::fromXML($contextXML);
         $contexts[] = $context;
     }
     $api->setContexts($contexts);
     $api->setTdrData(TdrData::fromXML($xml->tdr));
     if ($xml->properties && $xml->properties->property) {
         foreach ($xml->properties->property as $prop) {
             $api->properties[(string) $prop['name']] = (string) $prop;
         }
     }
     $api->setHeaderTransformationEnabled(current($xml->headerTransEnabled) == "true");
     if ($xml->headerTransformations && $xml->headerTransformations->headerTransformation) {
         foreach ($xml->headerTransformations->headerTransformation as $transform) {
             $api->headerTransformations[] = HeaderTransformation::fromXML($transform);
         }
     }
     if ($xml->allowedHttpMethods && $xml->allowedHttpMethods->httpMethod) {
         foreach ($xml->allowedHttpMethods->httpMethod as $method) {
             $api->allowedHttpMethods[] = current($method);
         }
     }
     return $api;
 }
开发者ID:kyroskoh,项目名称:apigrove,代码行数:53,代码来源:Api.class.php

示例2: setApi

 /**
  *
  * Insert/Update an Api on the database
  * @param Api $api
  * @throws Exception
  */
 public function setApi(Api &$api, $insertMode = FALSE)
 {
     $method = "PUT";
     $path = "/cxf/e3/prov/v1/apis/" . rawurlencode($api->getId());
     if ($insertMode) {
         $method = "POST";
         $path = "/cxf/e3/prov/v1/apis/";
     }
     /**
      * Send the XML payload the the Provisioning Backend
      */
     $api->toXML();
     LoggerInterface::log(($insertMode ? "Creating" : "Updating") . " API: {$api->toXML()}\nEndpoint: ({$method}) {$path}", LoggerInterface::INFO);
     $reply = $this->restClient->makeCall($path, $method, $api->toXML());
     $xml = simplexml_load_string($reply->getPayload());
     $api->setId((string) $xml->id);
     return $xml;
 }
开发者ID:kyroskoh,项目名称:apigrove,代码行数:24,代码来源:ApiManager.class.php


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