dolibarr 24.0.0-beta
autoloader.php
1<?php
2/* Copyright (C) 2024-2026 MDW <mdeweerd@users.noreply.github.com>
3 */
10spl_autoload_register(
15 static function ($class) {
16 // @phpstan-ignore argument.type
17 if (preg_match('/^DebugBar/', $class)) {
18 $file = DOL_DOCUMENT_ROOT.'/includes/maximebf/debugbar/src/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
19 //var_dump($class.' - '.file_exists($file).' - '.$file);
20 if (file_exists($file)) {
21 require_once $file;
22 return true;
23 }
24 return false;
25 }
26 if (preg_match('/^'.preg_quote('Psr\Log', '/').'/', $class)) {
27 $file = DOL_DOCUMENT_ROOT.'/includes/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
28 //var_dump($class.' - '.file_exists($file).' - '.$file);
29 if (file_exists($file)) {
30 require_once $file;
31 return true;
32 }
33 return false;
34 }
35 if (preg_match('/^'.preg_quote('Symfony\Component\VarDumper', '/').'/', $class)) {
36 $class = preg_replace('/'.preg_quote('Symfony\Component\VarDumper', '/').'/', '', $class);
37 $file = DOL_DOCUMENT_ROOT.'/includes/symfony/var-dumper/'.str_replace('\\', DIRECTORY_SEPARATOR, $class).'.php';
38 if (file_exists($file)) {
39 require_once $file;
40 return true;
41 }
42 return false;
43 }
44 return true;
45 }
46);