Reange and optimize

This commit is contained in:
Mathieu Sanchez
2017-12-19 23:42:09 +01:00
parent cbe1959e4f
commit cb635858f1
25 changed files with 7915 additions and 7839 deletions

View File

@ -4,19 +4,21 @@ namespace base;
class Autoloader {
/**
* Enregistre notre autoloader
*/
static function register() {
spl_autoload_register(array(__CLASS__, 'autoload'));
}
/**
* Enregistre notre autoloader
*/
static function register() {
spl_autoload_register( array( __CLASS__, 'autoload' ) );
}
/**
* Inclue le fichier correspondant à notre classe
* @param $class string Le nom de la classe à charger
*/
static function autoload($class) {
if (preg_match('#^' . Config::NAMESPACE . '\\\(.+)$#', $class, $matches))
require 'src/' . str_replace('\\', '/', $matches[1]) . '.php';
}
/**
* Inclue le fichier correspondant à notre classe
*
* @param $class string Le nom de la classe à charger
*/
static function autoload( $class ) {
if ( preg_match( '#^' . Config::NAMESPACE . '\\\(.+)$#', $class, $matches ) ) {
require 'src/' . str_replace( '\\', '/', $matches[1] ) . '.php';
}
}
}