protected function pendingApplicationsCSV()
{
$lines = $this->getPendingApplications();
if (!count($lines)) {
return '';
}
$handle = fopen('php://memory', 'w');
$header = false;
foreach ($lines as $line) {
if (!$header) {
fputcsv($handle, array_keys($line));
$header = true;
}
fputcsv($handle, $line);
}
fseek($handle, 0);
return stream_get_contents($handle);
}