protected function copyFile(Repo $repo, $file, $destination) { $data = $repo->getBlob($file->sha); if (isset($data->content)) { $handle = fopen($destination, 'w'); fwrite($handle, base64_decode($data->content)); fclose($handle); } }