<?php
spl_autoload_register(
	static function ( $class ) {
		$prefix   = 'AdVajra\\';
		$base_dir = dirname( __DIR__ ) . '/inc/';
		$length   = strlen( $prefix );

		if ( strncmp( $prefix, $class, $length ) !== 0 ) {
			return;
		}

		$relative_class = substr( $class, $length );
		$file           = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';

		if ( file_exists( $file ) ) {
			require $file;
		}
	}
);

return true;
