|
|
@ -1,40 +1,37 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
//prs0 compliant
|
|
|
|
|
|
|
|
class Autoload
|
|
|
|
class Autoload
|
|
|
|
{
|
|
|
|
{
|
|
|
|
private static $_instance = null;
|
|
|
|
private static $instance = null;
|
|
|
|
|
|
|
|
|
|
|
|
public static function charger()
|
|
|
|
public static function charger()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(null !== self::$_instance) {
|
|
|
|
if (null !== self::$instance) {
|
|
|
|
throw new RuntimeException(sprintf('%s is already started', __CLASS__));
|
|
|
|
throw new RuntimeException(sprintf('%s is already started', __CLASS__));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
self::$_instance = new self();
|
|
|
|
self::$instance = new self();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(!spl_autoload_register(array(self::$_instance, '_autoload'), false)) {
|
|
|
|
if (!spl_autoload_register(array(self::$instance, '_autoload'), false)) {
|
|
|
|
throw RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
|
|
|
|
throw RuntimeException(sprintf('%s : Could not start the autoload', __CLASS__));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function shutDown()
|
|
|
|
public static function shutDown()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if(null !== self::$_instance) {
|
|
|
|
if (null !== self::$instance) {
|
|
|
|
|
|
|
|
|
|
|
|
if(!spl_autoload_unregister(array(self::$_instance, '_autoload'))) {
|
|
|
|
if(!spl_autoload_unregister(array(self::$instance, '_autoload'))) {
|
|
|
|
throw new RuntimeException('Could not stop the autoload');
|
|
|
|
throw new RuntimeException('Could not stop the autoload');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
self::$_instance = null;
|
|
|
|
self::$instance = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static function _autoload($className)
|
|
|
|
private static function _autoload($className)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
// echo $className;
|
|
|
|
|
|
|
|
$folder = "./";
|
|
|
|
$folder = "./";
|
|
|
|
$className = ltrim($className, '\\');
|
|
|
|
$className = ltrim($className, '\\');
|
|
|
|
$fileName = '';
|
|
|
|
$fileName = '';
|
|
|
|