Пример #1
0
 public static function configure($config)
 {
     $config = (object) $config;
     self::$_formmaters = array('application/json' => new formatters\jsonFormatter(), 'multipart/form-data' => new formatters\formDataFormatter());
     if (!isset($config->apiKey)) {
         throw new Exception('A api key deve ser definida no método configure.');
     }
     self::$_apiKey = $config->apiKey;
     if (isset($config->baseUrl)) {
         self::$_baseUrl = $config->baseUrl;
     }
     if (isset($config->version)) {
         self::$_version = $config->version;
     }
     if (isset($config->defaultContentType)) {
         self::$_defaultContentType = $config->defaultContentType;
     }
     if (isset($config->_trustedCAListPath)) {
         self::$_trustedCAListPath = $config->_trustedCAListPath;
     } else {
         self::$_trustedCAListPath = dirname(__FILE__) . '/files/ca-bundle.crt';
     }
     self::$_versionedBaseUrl = self::$_baseUrl . '/v' . self::$_version;
     self::init();
 }