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


PHP Configuration::getDefaultConfiguration方法代码示例

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


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

示例1: __construct

 /**
  * Constructor of the class
  *
  * @param Configuration $config config for this ApiClient
  */
 public function __construct(\Squiggle\Configuration $config = null)
 {
     if ($config === null) {
         $config = Configuration::getDefaultConfiguration();
     }
     $this->config = $config;
     $this->serializer = new ObjectSerializer();
 }
开发者ID:squiggle-dev,项目名称:squiggle-php,代码行数:13,代码来源:ApiClient.php

示例2: __construct

 /**
  * Constructor of the class
  *
  * @param Configuration $config config for this ApiClient
  */
 public function __construct(\QuantiModo\Client\Configuration $config = null)
 {
     if ($config === null) {
         $config = Configuration::getDefaultConfiguration();
     }
     $this->config = $config;
     $this->serializer = new ObjectSerializer();
 }
开发者ID:quantimodo,项目名称:quantimodo-sdk-php,代码行数:13,代码来源:ApiClient.php

示例3: deserialize

 /**
  * Deserialize a JSON string into an object
  *
  * @param mixed  $data       object or primitive to be deserialized
  * @param string $class      class name is passed as a string
  * @param string $httpHeader HTTP headers
  *
  * @return object an instance of $class
  */
 public function deserialize($data, $class, $httpHeader = null)
 {
     if (null === $data) {
         $deserialized = null;
     } elseif (substr($class, 0, 4) === 'map[') {
         // for associative array e.g. map[string,int]
         $inner = substr($class, 4, -1);
         $deserialized = array();
         if (strrpos($inner, ",") !== false) {
             $subClass_array = explode(',', $inner, 2);
             $subClass = $subClass_array[1];
             foreach ($data as $key => $value) {
                 $deserialized[$key] = $this->deserialize($value, $subClass);
             }
         }
     } elseif (strcasecmp(substr($class, -2), '[]') == 0) {
         $subClass = substr($class, 0, -2);
         $values = array();
         foreach ($data as $key => $value) {
             $values[] = $this->deserialize($value, $subClass);
         }
         $deserialized = $values;
     } elseif ($class === '\\DateTime') {
         $deserialized = new \DateTime($data);
     } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
         settype($data, $class);
         $deserialized = $data;
     } elseif ($class === '\\SplFileObject') {
         // determine file name
         if (preg_match('/Content-Disposition: inline; filename=[\'"]?([^\'"\\s]+)[\'"]?$/i', $httpHeader, $match)) {
             $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . $match[1];
         } else {
             $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
         }
         $deserialized = new \SplFileObject($filename, "w");
         $byte_written = $deserialized->fwrite($data);
         error_log("[INFO] Written {$byte_written} byte to {$filename}. Please move the file to a proper folder or delete the temp file after processing.\n", 3, Configuration::getDefaultConfiguration()->getDebugFile());
     } else {
         $instance = new $class();
         foreach ($instance::$swaggerTypes as $property => $type) {
             $propertySetter = $instance::$setters[$property];
             if (!isset($propertySetter) || !isset($data->{$instance::$attributeMap[$property]})) {
                 continue;
             }
             $propertyValue = $data->{$instance::$attributeMap[$property]};
             if (isset($propertyValue)) {
                 $instance->{$propertySetter}($this->deserialize($propertyValue, $type));
             }
         }
         $deserialized = $instance;
     }
     return $deserialized;
 }
开发者ID:Tpaga,项目名称:tpaga-php,代码行数:62,代码来源:ObjectSerializer.php

示例4: deserialize

 /**
  * Deserialize a JSON string into an object
  *
  * @param mixed  $data          object or primitive to be deserialized
  * @param string $class         class name is passed as a string
  * @param string $httpHeaders   HTTP headers
  * @param string $discriminator discriminator if polymorphism is used
  *
  * @return object an instance of $class
  */
 public static function deserialize($data, $class, $httpHeaders = null, $discriminator = null)
 {
     if (null === $data) {
         return null;
     } elseif (substr($class, 0, 4) === 'map[') {
         // for associative array e.g. map[string,int]
         $inner = substr($class, 4, -1);
         $deserialized = array();
         if (strrpos($inner, ",") !== false) {
             $subClass_array = explode(',', $inner, 2);
             $subClass = $subClass_array[1];
             foreach ($data as $key => $value) {
                 $deserialized[$key] = self::deserialize($value, $subClass, null, $discriminator);
             }
         }
         return $deserialized;
     } elseif (strcasecmp(substr($class, -2), '[]') == 0) {
         $subClass = substr($class, 0, -2);
         $values = array();
         foreach ($data as $key => $value) {
             $values[] = self::deserialize($value, $subClass, null, $discriminator);
         }
         return $values;
     } elseif ($class === 'object') {
         settype($data, 'array');
         return $data;
     } elseif ($class === '\\DateTime') {
         // Some API's return an invalid, empty string as a
         // date-time property. DateTime::__construct() will return
         // the current time for empty input which is probably not
         // what is meant. The invalid empty string is probably to
         // be interpreted as a missing field/value. Let's handle
         // this graceful.
         if (!empty($data)) {
             return new \DateTime($data);
         } else {
             return null;
         }
     } elseif (in_array($class, array('void', 'bool', 'string', 'double', 'byte', 'mixed', 'integer', 'float', 'int', 'DateTime', 'number', 'boolean', 'object'))) {
         settype($data, $class);
         return $data;
     } elseif ($class === '\\SplFileObject') {
         // determine file name
         if (array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
             $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . sanitizeFilename($match[1]);
         } else {
             $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), '');
         }
         $deserialized = new \SplFileObject($filename, "w");
         $byte_written = $deserialized->fwrite($data);
         if (Configuration::getDefaultConfiguration()->getDebug()) {
             error_log("[DEBUG] Written {$byte_written} byte to {$filename}. Please move the file to a proper folder or delete the temp file after processing." . PHP_EOL, 3, Configuration::getDefaultConfiguration()->getDebugFile());
         }
         return $deserialized;
     } else {
         // If a discriminator is defined and points to a valid subclass, use it.
         if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) {
             $subclass = '\\Swagger\\Client\\Model\\' . $data->{$discriminator};
             if (is_subclass_of($subclass, $class)) {
                 $class = $subclass;
             }
         }
         $instance = new $class();
         foreach ($instance::swaggerTypes() as $property => $type) {
             $propertySetter = $instance::setters()[$property];
             if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) {
                 continue;
             }
             $propertyValue = $data->{$instance::attributeMap()[$property]};
             if (isset($propertyValue)) {
                 $instance->{$propertySetter}(self::deserialize($propertyValue, $type, null, $discriminator));
             }
         }
         return $instance;
     }
 }
开发者ID:ModelSolv,项目名称:swagger-codegen,代码行数:86,代码来源:ObjectSerializer.php


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