You will need an associative array where each key is associated with an array of files, to achieve this, try this:
public static function groupByOwners($files)
{
foreach($files as $file => $name) {
if (isset($newArray[$name])) {
// if key exists, add to its array of elements
array_push($newArray[$name], $file);
} else {
// else create a new array element
$newArray[$name] = array($file);
}
}
return $newArray;
}