[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/core/src/ -> lmbHandle.class.php (source)

   1  <?php
   2  /*
   3   * Limb PHP Framework
   4   *
   5   * @link http://limb-project.com 
   6   * @copyright  Copyright &copy; 2004-2007 BIT(http://bit-creative.com)
   7   * @license    LGPL http://www.gnu.org/copyleft/lesser.html 
   8   */
   9  lmb_require(dirname(__FILE__) . '/lmbProxy.class.php');
  10  
  11  /**

  12   * class lmbHandle.

  13   *

  14   * @package core

  15   * @version $Id$

  16   */
  17  class lmbHandle extends lmbProxy
  18  {
  19    protected $args;
  20    protected $class_path;
  21    protected $class;
  22  
  23    function __construct($class_path, $args = array(), $class = null)
  24    {
  25      if(is_null($class))
  26        $this->class = $this->_getClassName($class_path);
  27      else
  28        $this->class = $class;
  29  
  30      $this->class_path = $class_path;
  31      $this->args = $args;
  32    }
  33  
  34    function isHandle()
  35    {
  36      return true;
  37    }
  38  
  39    function getClass()
  40    {
  41      return $this->class;
  42    }
  43  
  44    protected function _createOriginalObject()
  45    {
  46      lmb_require($this->_getClassFullPath());
  47  
  48      $refl = new ReflectionClass($this->class);
  49      return call_user_func_array(array($refl, 'newInstance'),$this->args);
  50    }
  51  
  52    protected function _getClassName($class_path)
  53    {
  54      $items = explode('.', end(explode('/', $class_path)));
  55      return $items[0];
  56    }
  57  
  58    protected function _getClassFullPath()
  59    {
  60      if(substr($this->class_path, -4, 4) != '.php')
  61        return $this->class_path . '.class.php';
  62      else
  63        return $this->class_path;
  64    }
  65  }
  66  ?>


Generated: Sat Sep 6 04:46:52 2008 Cross-referenced by PHPXref 0.7