Is it a good idea?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi guys,

In my framework I have some classes that depends from others (like authentication depends of database)... So I wrote is method inside the framework class, and I would like to know if is it an intelligent solution or not:

class dependent
{
	function dependent (&$framework)
	{
		$independent =& $framework->load_core_class('independent');
	}
}

AND THE LOADING METHOD:

function load_core_class($class='')
{
	if(!class_exists($class))
	{
		if(file_exists($this->core_dir.$class.'.class.php'))
		{
			include_once($this->core_dir.$class.'.class.php');
			return $this->core->$class =& new $class($this);
		}
		else
		{
			return false;
		}
	}
	elseif(!isset($this->core->$class))
	{
		return $this->core->$class =& new $class($this);
	}
	else
	{
		return $this->core->$class;
	}
}

Best regards to you all,
Bruno B B Magalhaes

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux