本文整理汇总了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);
}
示例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));
}
示例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));
}