composer package updates
[openemr.git] / vendor / phenx / php-font-lib / src / FontLib / Autoloader.php
blobcd305453e48ed7c99c0f8aac652a81328f5e98ad
1 <?php
2 /**
3 * @package php-font-lib
4 * @link https://github.com/PhenX/php-font-lib
5 * @author Fabien Ménager <fabien.menager@gmail.com>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7 */
9 namespace FontLib;
11 /**
12 * Autoloads FontLib classes
14 * @package php-font-lib
16 class Autoloader {
17 const PREFIX = 'FontLib';
19 /**
20 * Register the autoloader
22 public static function register() {
23 spl_autoload_register(array(new self, 'autoload'));
26 /**
27 * Autoloader
29 * @param string
31 public static function autoload($class) {
32 $prefixLength = strlen(self::PREFIX);
33 if (0 === strncmp(self::PREFIX, $class, $prefixLength)) {
34 $file = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, $prefixLength));
35 $file = realpath(__DIR__ . (empty($file) ? '' : DIRECTORY_SEPARATOR) . $file . '.php');
36 if (file_exists($file)) {
37 require_once $file;
43 Autoloader::register();