private function isWritable($path)
{
// redefine argument
$path = rtrim((string) $path, '/');
// create random file
$file = uniqid('', true) . '.tmp';
$return = @file_put_contents($path . '/' . $file, 'temporary file', FILE_APPEND);
if ($return === false) {
return false;
}
// unlink the random file
@unlink($path . '/' . $file);
// return
return true;
}