config->getComponentPaths($i); // And add the CorePath $paths[Priority::getLowestPriority()][] = Core::$coreDir . DS . 'Config'; // Then go over every individual paths $configFiles = []; foreach ($paths as $priority => $foldersArray) { foreach ($foldersArray as $folder) { // Get the contents from the folder $contents = array_diff(scandir($folder), array('..', '.')); // Then go over the folders, and see which ones are an admin view foreach ($contents as $file) { // If the file matches the expected filename, add it to the list if (substr($file, 0, 7) === 'config.' && !isset($configFiles[$file])) $configFiles[$file] = ['folder' => $folder, 'priority' => substr(Priority::getPriority($priority), 10)]; } } } // At the end, sort the files ksort($configFiles); // And return them return $configFiles; } }