arborint wrote:Given that you used the word package "in the loose sense of the word" I would be suspicions of your design.
I said "in the loose sense of the word" because I really don't fully understand what the definition of a package is and I suspect that it is exclusive to PEAR. But what I am making is a single class hierarchy.
perhaps there is a better way to achieve what you are trying to do. Questions like this sometimes indicate that there is a problem.
My hierarchy currently has 23 files (one class per file). I just wanted to know if I could provide the users of the package with a single file to include all the files. Seeing as feyd says there is a hit, I am now going to the effort of writing require statements above each class that extends another:
Code: Select all
require_once 'Another.php'; // this wouldn't of been necessary if all the classes were loaded in the right order by a master including file
class SomeClass extends Another {
and implementating a couple of functions which people will be able to use in their __autoload()
Code: Select all
/**
* To assist those using __autoload(). Returns whether the class name
* is an OsisForm class
*
* @param string $className
* @return bool
*/
static public function isDecendentClass($className)
{
return substr($className, 0, strlen(__CLASS__)) == __CLASS__;
}
/**
* Load an OsisForm class
*
* @param string $className
* @return void
*/
static public function loadClass($className)
{
$className = str_replace('_', '/', $className) . '.php';
require_once $className;
}
But as with anything performance related, your goals, your design choices, and so much more all come into play. You will need to be (much) more specific if you want a more specific answer.
What makes you think I want a more specific answer?
What do you suspect I am doing wrong?
Basically I don't really understand why you made that statement.