本文整理汇总了PHP中Zend_XmlRpc_Server::loadFunctions方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Server::loadFunctions方法的具体用法?PHP Zend_XmlRpc_Server::loadFunctions怎么用?PHP Zend_XmlRpc_Server::loadFunctions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_XmlRpc_Server
的用法示例。
在下文中一共展示了Zend_XmlRpc_Server::loadFunctions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testLoadFunctionsReadsMethodsFromServerDefinitionObjects
public function testLoadFunctionsReadsMethodsFromServerDefinitionObjects()
{
$mockedMethod = $this->getMock('Zend_Server_Method_Definition', array(), array(), '', false, false);
$mockedDefinition = $this->getMock('Zend_Server_Definition', array(), array(), '', false, false);
$mockedDefinition->expects($this->once())->method('getMethods')->will($this->returnValue(array('bar' => $mockedMethod)));
$this->_server->loadFunctions($mockedDefinition);
}
示例2: testLoadFunctionsThrowsExceptionWithBadData
public function testLoadFunctionsThrowsExceptionWithBadData()
{
$o = new stdClass();
try {
$this->_server->loadFunctions($o);
$this->fail('loadFunctions() should not accept objects');
} catch (Exception $e) {
// success
}
$o = array($o);
try {
$this->_server->loadFunctions($o);
$this->fail('loadFunctions() should not allow non-reflection objects in an array');
} catch (Exception $e) {
// success
}
}
示例3: get
/**
* Add dispatch table from a file
*
* Unserializes a stored dispatch table from $filename. Returns false if it
* fails in any way, true on success.
*
* Useful to prevent needing to build the dispatch list on each XMLRPC
* request. Sample usage:
*
* <code>
* if (!Zend_XmlRpc_Server_Cache::get($filename, $server)) {
* require_once 'Some/Service/Class.php';
* require_once 'Another/Service/Class.php';
*
* // Attach Some_Service_Class with namespace 'some'
* $server->attach('Some_Service_Class', 'some');
*
* // Attach Another_Service_Class with namespace 'another'
* $server->attach('Another_Service_Class', 'another');
*
* Zend_XmlRpc_Server_Cache::save($filename, $server);
* }
*
* $response = $server->handle();
* echo $response;
* </code>
*
* @param string $filename
* @param Zend_XmlRpc_Server $server
* @return bool
*/
public static function get($filename, Zend_XmlRpc_Server $server)
{
if (!is_string($filename) || !file_exists($filename) || !is_readable($filename)) {
return false;
}
if (false === ($dispatch = @file_get_contents($filename))) {
return false;
}
if (false === ($dispatchArray = @unserialize($dispatch))) {
return false;
}
$server->loadFunctions($dispatchArray);
return true;
}
示例4: get
/**
* Add dispatch table from a file
*
* Unserializes a stored dispatch table. Returns false if it
* fails in any way, true on success.
*
* Useful to prevent needing to build the dispatch list on each XMLRPC
* request. Sample usage:
*
* <code>
* if (!Zym_XmlRpc_Server_Cache::get($id, $coreCache, $server)) {
* require_once 'Some/Service/Class.php';
* require_once 'Another/Service/Class.php';
*
* // Attach Some_Service_Class with namespace 'some'
* $server->setClass('Some_Service_Class', 'some');
*
* // Attach Another_Service_Class with namespace 'another'
* $server->setClass('Another_Service_Class', 'another');
*
* Zym_XmlRpc_Server_Cache::save($id, $coreCache, $server);
* }
*
* $response = $server->handle();
* echo $response;
* </code>
*
* @param string $id
* @param Zend_Cache_Core $coreCache
* @param Zend_XmlRpc_Server $server
*
* @return boolean
*/
public static function get($id, Zend_Cache_Core $coreCache, Zend_XmlRpc_Server $server)
{
$dispatchArray = @unserialize($coreCache->load($id, false, true));
try {
$server->loadFunctions($dispatchArray);
} catch (Zend_XmlRpc_Server_Exception $e) {
return false;
}
return true;
}
示例5: testFunctions
/**
* get/loadFunctions() test
*/
public function testFunctions()
{
try {
$this->_server->addFunction(array('Zend_XmlRpc_Server_testFunction', 'Zend_XmlRpc_Server_testFunction2'), 'zsr');
} catch (Exception $e) {
$this->fail('Error attaching functions: ' . $e->getMessage());
}
$expected = $this->_server->listMethods();
$functions = $this->_server->getFunctions();
$server = new Zend_XmlRpc_Server();
$server->loadFunctions($functions);
$actual = $server->listMethods();
$this->assertSame($expected, $actual);
}
示例6: get
/**
* Add dispatch table from a file
*
* Unserializes a stored dispatch table from $filename. Returns false if it
* fails in any way, true on success.
*
* Useful to prevent needing to build the dispatch list on each XMLRPC
* request. Sample usage:
*
* <code>
* if (!Zend_XmlRpc_Server_Cache::get($id, $coreCache, $server)) {
* require_once 'Some/Service/Class.php';
* require_once 'Another/Service/Class.php';
*
* // Attach Some_Service_Class with namespace 'some'
* $server->attach('Some_Service_Class', 'some');
*
* // Attach Another_Service_Class with namespace 'another'
* $server->attach('Another_Service_Class', 'another');
*
* Zend_XmlRpc_Server_Cache::save($id, $coreCache, $server);
* }
*
* $response = $server->handle();
* echo $response;
* </code>
*
* @param string $filename
* @param Zend_XmlRpc_Server $server
*/
public static function get($id, Zend_Cache_Core $coreCache, Zend_XmlRpc_Server $server)
{
$dispatchArray = @unserialize($coreCache->load($id, false, true));
$server->loadFunctions($dispatchArray);
}