autoload.php 555 B

123456789101112131415
  1. <?php
  2. if (file_exists(__DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php')) {
  3. require_once __DIR__ . \DIRECTORY_SEPARATOR . 'vendor' . \DIRECTORY_SEPARATOR . 'autoload.php';
  4. }
  5. spl_autoload_register(function ($class) {
  6. $name = str_replace('Darabonba\\OpenApi\\', '', $class);
  7. $file = __DIR__ . \DIRECTORY_SEPARATOR . 'src' . \DIRECTORY_SEPARATOR . str_replace('\\', \DIRECTORY_SEPARATOR, $name) . '.php';
  8. if (file_exists($file)) {
  9. require_once $file;
  10. return true;
  11. }
  12. return false;
  13. });