src/abstract-plugin.php
public static function filepath_to_classname( $file, $installed_dir, $namespace ) {
		/**
		 * Convert path and filename into namespace and class
		 */
		$path_info        = str_ireplace( $installed_dir, '', $file );
		$path_info        = pathinfo( $path_info );
		$converted_dir    = str_replace( '/', '\\', $path_info['dirname'] );
		$converted_dir    = ucwords( $converted_dir, '_\\' );
		$filename_search  = [ static::$filename_prefix, '-' ];
		$filename_replace = [ '', '_' ];
		$class            = str_ireplace( $filename_search, $filename_replace, $path_info['filename'] );
		$class_name       = $namespace . $converted_dir . '\\' . ucwords( $class, '_' );

		return $class_name;
	}
public static function filepath_to_classname( $file, $installed_dir, $namespace ) {
		/**
		 * Convert path and filename into namespace and class
		 */
		$path_info        = str_ireplace( $installed_dir, '', $file );
		$path_info        = pathinfo( $path_info );
		$converted_dir    = str_replace( '/', '\\', $path_info['dirname'] );
		$converted_dir    = ucwords( $converted_dir, '_\\' );
		$filename_search  = [ static::$filename_prefix, '-' ];
		$filename_replace = [ '', '_' ];
		$class            = str_ireplace( $filename_search, $filename_replace, $path_info['filename'] );
		$class_name       = $namespace . $converted_dir . '\\' . ucwords( $class, '_' );

		return $class_name;
	}
public static function filepath_to_classname ( $ file , $ installed_dir , $ namespace ) { /**
		 * Convert path and filename into namespace and class
		 */ $ path_info = str_ireplace ( $ installed_dir , '' , $ file ) ; $ path_info = pathinfo ( $ path_info ) ; $ converted_dir = str_replace ( '/' , '\\' , $ path_info [ 'dirname' ] ) ; $ converted_dir = ucwords ( $ converted_dir , '_\\' ) ; $ filename_search = [ static :: $ filename_prefix , '-' ] ; $ filename_replace = [ '' , '_' ] ; $ class = str_ireplace ( $ filename_search , $ filename_replace , $ path_info [ 'filename' ] ) ; $ class_name = $ namespace . $ converted_dir . '\\' . ucwords ( $ class , '_' ) ; return $ class_name ; }
Utility function to get class name from filename if you follow this abstract plugin's naming standards

@param string $file          Absolute path to file.
@param string $installed_dir Absolute path to plugin folder.
@param string $namespace     Namespace of calling class, if any.

@return string $class_name Name of Class to load based on file path.
Utility function to get class name from filename if you follow this abstract plugin s naming standards