aspireupdate/includes/autoload.php
Colin Stewart c8238ba74b
Add coding standard. (#127)
* Add Coding Standard.

* Add PHPCS cache directory.

* Coding Standards: Apply PHPCBF to codebase.

* Coding Standards: Add GitHub workflow.

---------

Signed-off-by: Alex Sirota <alex@newpathconsulting.com>
Co-authored-by: Alex Sirota <alex@newpathconsulting.com>
2024-11-05 04:43:57 -05:00

25 lines
584 B
PHP

<?php
/**
* The Autoloader.
*
* @package aspire-update
*/
spl_autoload_register( 'aspire_update_autoloader' );
/**
* The Class Autoloader.
*
* @param string $class_name The name of the class to load.
* @return void
*/
function aspire_update_autoloader( $class_name ) {
if ( false !== strpos( $class_name, 'AspireUpdate\\' ) ) {
$class_name = strtolower( str_replace( [ 'AspireUpdate\\', '_' ], [ '', '-' ], $class_name ) );
$file = __DIR__ . DIRECTORY_SEPARATOR . 'class-' . $class_name . '.php';
if ( file_exists( $file ) ) {
require_once $file;
}
}
}