Completed
Push — master ( 8b5ec4...bccd56 )
by Brent
11:18 queued 09:11
created

PersonalDataExportController::responseStream()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 9.44
c 0
b 0
f 0
cc 4
nc 4
nop 1
1
<?php
2
3
namespace Spatie\PersonalDataExport\Http\Controllers;
4
5
use Illuminate\Routing\Controller;
6
use Spatie\PersonalDataExport\Http\Middleware\EnsureAuthorizedToDownload;
7
use Spatie\PersonalDataExport\Http\Middleware\FiresPersonalDataExportDownloadedEvent;
8
use Spatie\PersonalDataExport\Http\Responses\ZipDownloadResponse;
9
use Symfony\Component\HttpFoundation\StreamedResponse;
10
11
class PersonalDataExportController extends Controller
12
{
13
    public function __construct()
14
    {
15
        $this->middleware(EnsureAuthorizedToDownload::class);
16
        $this->middleware(FiresPersonalDataExportDownloadedEvent::class);
17
    }
18
19
    public function __invoke(string $zipFilename): StreamedResponse
20
    {
21
        return new ZipDownloadResponse($zipFilename);
22
    }
23
}
24