本文整理汇总了PHP中Zend_Gdata::__call方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata::__call方法的具体用法?PHP Zend_Gdata::__call怎么用?PHP Zend_Gdata::__call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Gdata
的用法示例。
在下文中一共展示了Zend_Gdata::__call方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __call
/**
* Provides a magic factory method to instantiate new objects with
* shorter syntax than would otherwise be required by the Zend Framework
* naming conventions. For more information, see Zend_Gdata_App::__call().
*
* This overrides the default behavior of __call() so that query classes
* do not need to have their domain manually set when created with
* a magic factory method.
*
* @see Zend_Gdata_App::__call()
* @param string $method The method name being called
* @param array $args The arguments passed to the call
* @throws Zend_Gdata_App_Exception
*/
public function __call($method, $args)
{
if (preg_match('/^new(\\w+Query)/', $method, $matches)) {
$class = $matches[1];
$foundClassName = null;
foreach ($this->_registeredPackages as $name) {
try {
// Autoloading disabled on next line for compatibility
// with magic factories. See ZF-6660.
if (!class_exists($name . '_' . $class, false)) {
// require_once 'Zend/Loader.php';
@Zend_Loader::loadClass($name . '_' . $class);
}
$foundClassName = $name . '_' . $class;
break;
} catch (Zend_Exception $e) {
// package wasn't here- continue searching
}
}
if ($foundClassName != null) {
$reflectionObj = new ReflectionClass($foundClassName);
// Prepend the domain to the query
$args = array_merge(array($this->getDomain()), $args);
return $reflectionObj->newInstanceArgs($args);
} else {
// require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception("Unable to find '{$class}' in registered packages");
}
} else {
return parent::__call($method, $args);
}
}
示例2: __call
/**
* Provides a magic factory method to instantiate new objects with
* shorter syntax than would otherwise be required by the Zend Framework
* naming conventions. For more information, see Zend_Gdata_App::__call().
*
* This overrides the default behavior of __call() so that query classes
* do not need to have their domain manually set when created with
* a magic factory method.
*
* @see Zend_Gdata_App::__call()
* @param string $method The method name being called
* @param array $args The arguments passed to the call
* @throws Zend_Gdata_App_Exception
*/
public function __call($method, $args)
{
if (preg_match('/^new(\\w+Query)/', $method, $matches)) {
$class = $matches[1];
$foundClassName = null;
foreach ($this->_registeredPackages as $name) {
try {
require_once 'Zend/Loader.php';
@Zend_Loader::loadClass("{$name}_{$class}");
$foundClassName = "{$name}_{$class}";
break;
} catch (Zend_Exception $e) {
// package wasn't here- continue searching
}
}
if ($foundClassName != null) {
$reflectionObj = new ReflectionClass($foundClassName);
// Prepend the domain to the query
$args = array_merge(array($this->getDomain()), $args);
return $reflectionObj->newInstanceArgs($args);
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception("Unable to find '{$class}' in registered packages");
}
} else {
return parent::__call($method, $args);
}
}