protected function saveTxt($data, $filename)
{
$file = __DIR__ . '/../results/' . $filename . '.txt';
$myfile = fopen($file, 'w') or die('Unable to open file!');
if (is_array($data)) {
foreach ($data as $dataType) {
foreach ($dataType as $singleData) {
$txt = $singleData . "\n";
fwrite($myfile, $txt);
}
}
} else {
$txt = $data;
fwrite($myfile, $txt);
}
fclose($myfile);
if (!file_exists($file)) {
return false;
}
return $file;
}