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


PHP Zend_Gdata::__call方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:netvlies,项目名称:zf,代码行数:46,代码来源:Gapps.php

示例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);
     }
 }
开发者ID:hubgit,项目名称:events,代码行数:42,代码来源:Gapps.php


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