// Define yoursearch query
String searchQuery = '@AuraEnabled';

// List to store the apex class Ids from our search result
Map<Id,String> apexClassIdNameMap = new Map<Id,String>();

// Multi-dimentional array with the search results
sObject[][] searchResults = [FIND :searchQuery IN ALL FIELDS RETURNING ApexClass(Id,Name)];

// Iterate the multi dimensional array and populate the apexClassIdNameMap
for(Integer i=0,imax=searchResults.size();i<imax;i++){
	for(Integer j=0,jmax=searchResults[i].size();j<jmax;j++){
		apexClassIdNameMap.put(
			(Id) searchResults[i][j].get('Id'),
			(String)searchResults[i][j].get('Name')
		);
	}
}

// Output the search results
String resultString = 'Found: {0} result(s) that contain the search string "{1}"';
System.debug('## SEARCH RESULTS ##');
System.debug(String.format(resultString, new String[]{String.valueOf(apexClassIdNameMap.values().size()), searchQuery}));
System.debug('Apex Class names: ' + String.join(apexClassIdNameMap.values(),','));

// Query the permission sets / profiles that have access to thes apex classes from our search results
// Show profiles first, then permission sets
SetupEntityAccess[] seaRecords = [
	SELECT		SetupEntityId, Parent.Name, Parent.Label, Parent.IsOwnedByProfile, Parent.Profile.Name
	FROM		SetupEntityAccess 
	WHERE 		SetupEntityId IN :apexClassIdNameMap.keySet() AND 
				SetupEntityType = 'ApexClass'
	ORDER BY	Parent.IsOwnedByProfile DESC, Parent.Profile.Name ASC, Parent.Label ASC
];

// Output string for the debug log
String outputString = 'Apex Class :: {0} :: {1} :: {2}';

System.debug('');
System.debug('## PROFILE AND PERMISSION SET ACCESS ##');

// Output the classes with access to the debug log
for(Integer i=0,imax=seaRecords.size();i<imax;i++){
	
	// Define if the parent is a Profile or a Permission Set
	String parentType = (seaRecords[i].parent.IsOwnedByProfile) ? 'Profile' : 'Permission Set';
	String parentName = (seaRecords[i].parent.IsOwnedByProfile) ? seaRecords[i].parent.Profile.Name : seaRecords[i].parent.Label;
	
	// Output the details
	System.debug(
		String.format(
			outputString,
			new String[]{
				apexClassIdNameMap.get(seaRecords[i].SetupEntityId),
				parentType,
				parentName
			}
		)
	);	
}