Code refactoring, #16
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/branches/evo@114 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
37
Load.php
Normal file
37
Load.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright NetMonsters <team@netmonsters.ru>
|
||||
* @link http://netmonsters.ru
|
||||
* @package Majestic
|
||||
* @subpackage Load
|
||||
* @since 2010-02-24
|
||||
* @version SVN: $Id$
|
||||
* @filesource $URL$
|
||||
*/
|
||||
|
||||
class Load
|
||||
{
|
||||
|
||||
static protected $autoload;
|
||||
|
||||
static public function autoload($class)
|
||||
{
|
||||
if (! isset(self::$autoload[$class])) {
|
||||
throw new MJException('There is no such class "' . $class . '" in autoload.');
|
||||
}
|
||||
require(PATH . self::$autoload[$class]);
|
||||
}
|
||||
|
||||
static public function setAutoloadFrom($file)
|
||||
{
|
||||
if (! file_exists($file)) {
|
||||
throw new MJException('Autoload source doesn\'t exists! Try to generate it!');
|
||||
}
|
||||
self::$autoload = require($file);
|
||||
}
|
||||
|
||||
static public function getFilePath($class)
|
||||
{
|
||||
return self::$autoload[$class];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user