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


PHP Configuration::getConsumer方法代码示例

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


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

示例1: testMendeleyWithCustomConstructorWorks

 function testMendeleyWithCustomConstructorWorks()
 {
     $consumer = Configuration::getConsumer();
     $mendeley = new Mendeley($consumer['key'], $consumer['secret']);
     $groupId = 164791;
     $url = 'groups/' . $groupId;
     $params = array('page' => 1, 'items' => 1);
     $result = $mendeley->get($url, $params);
     $this->assertEqual((int) $result->group_id, $groupId);
 }
开发者ID:jakob-stoeck,项目名称:mendeleyapi,代码行数:10,代码来源:MendeleyTest.php

示例2: __construct

 /**
  * @param string
  * 	consumer key, you may optionally give a consumer key and secret to the class constructor which overrides the default values in the configuration file.
  * @param string
  * 	consumer secret
  */
 public function __construct($consumerKey = null, $consumerSecret = null)
 {
     require_once 'Configuration.php';
     require_once Configuration::getPathToOauth();
     if (!empty($consumerKey) && !empty($consumerSecret)) {
         $consumer = array('key' => $consumerKey, 'secret' => $consumerSecret);
     } else {
         $consumer = Configuration::getConsumer();
     }
     $this->consumer = new OAuthConsumer($consumer['key'], $consumer['secret'], null);
     $this->signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
     $this->cache = new MendeleyCache('_' . md5($this->consumer->key));
 }
开发者ID:jakob-stoeck,项目名称:mendeleyapi,代码行数:19,代码来源:Mendeley.php

示例3: testCacheSetAndGet

 function testCacheSetAndGet()
 {
     $name = 'test';
     $value = 123;
     $consumer = Configuration::getConsumer();
     $suffix = '_' . md5($consumer['key']);
     $cache = new MendeleyCache($suffix);
     $dir = $cache->getDir();
     $cache->del($name);
     $this->assertFalse(file_exists($dir . $name . $suffix));
     $cache->set($name, $value);
     $this->assertTrue(file_exists($dir . $name . $suffix));
     $test = $cache->get($name);
     $this->assertTrue($test === $value);
     $cache->del($name);
     $this->assertFalse(file_exists($dir . $name . $suffix));
 }
开发者ID:jakob-stoeck,项目名称:mendeleyapi,代码行数:17,代码来源:MendeleyCacheTest.php


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