generated from Templates_CodeFirst/templateHtmlCss
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
835 B
33 lines
835 B
<?php
|
|
|
|
class Autoload{
|
|
private static ?Autoload $_instance = null;
|
|
|
|
public static function charger(){
|
|
if(self::$_instance != null){
|
|
throw new RuntimeException(sprintf("%s already start", __CLASS__));
|
|
}
|
|
|
|
self::$_instance = new self();
|
|
|
|
if(!spl_autoload_register(array(self::$_instance, '_autoload'))){
|
|
throw new RuntimeException('Could not stop autoload');
|
|
}
|
|
|
|
self::$_instance = null;
|
|
}
|
|
|
|
private static function _autoload($class){
|
|
global $rep;
|
|
$filename = $class.'.php';
|
|
$dir = array('modeles/', 'config/', 'controllers/', 'metier/', 'gateway/');
|
|
foreach ($dir as $d){
|
|
$file=$rep.$d.$filename;
|
|
if(file_exists($file)){
|
|
include $file;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|