mirror of
https://github.com/YunoHost-Apps/kanboard_ynh.git
synced 2024-09-03 19:36:17 +02:00
38 lines
658 B
PHP
38 lines
658 B
PHP
|
<?php
|
||
|
|
||
|
namespace Core;
|
||
|
|
||
|
/**
|
||
|
* Loader class
|
||
|
*
|
||
|
* @package core
|
||
|
* @author Frederic Guillot
|
||
|
*/
|
||
|
class Loader
|
||
|
{
|
||
|
/**
|
||
|
* Load the missing class
|
||
|
*
|
||
|
* @access public
|
||
|
* @param string $class Class name
|
||
|
*/
|
||
|
public function load($class)
|
||
|
{
|
||
|
$filename = __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
|
||
|
|
||
|
if (file_exists($filename)) {
|
||
|
require $filename;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Register the autoloader
|
||
|
*
|
||
|
* @access public
|
||
|
*/
|
||
|
public function execute()
|
||
|
{
|
||
|
spl_autoload_register(array($this, 'load'));
|
||
|
}
|
||
|
}
|