• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ericfortmeyer / activity-log / 20488915339

24 Dec 2025 03:11PM UTC coverage: 49.13% (-2.7%) from 51.874%
20488915339

push

github

web-flow
fix: add support for emailing reports (#62)

Fixes #9

Signed-off-by: Eric Fortmeyer <e.fortmeyer01@gmail.com>

72 of 224 new or added lines in 12 files covered. (32.14%)

5 existing lines in 3 files now uncovered.

339 of 690 relevant lines covered (49.13%)

1.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Http/RequestProcessors/DownloadDataExport.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace EricFortmeyer\ActivityLog\Http\RequestProcessors;
6

7
use DateTimeImmutable;
8
use EricFortmeyer\ActivityLog\Services\DataExportService;
9
use EricFortmeyer\ActivityLog\Services\TemplateBinder;
10
use EricFortmeyer\ActivityLog\UserInterface\Contexts\ServerErrorContext;
11
use Phpolar\HttpRequestProcessor\RequestProcessorInterface;
12
use Phpolar\Phpolar\Auth\Authorize;
13

14
final class DownloadDataExport implements RequestProcessorInterface
15
{
16
    public function __construct(
17
        private readonly DataExportService $dataExportService,
18
        private readonly TemplateBinder $templateEngine
NEW
19
    ) {}
×
20

21
    #[Authorize]
22
    public function process(): string
23
    {
NEW
24
        $result = $this->dataExportService->export();
×
25

NEW
26
        if ($result === false) {
×
NEW
27
            return $this->templateEngine->apply(
×
NEW
28
                "500",
×
NEW
29
                new ServerErrorContext(
×
NEW
30
                    message: "An error occurred exporting the data."
×
NEW
31
                )
×
NEW
32
            );
×
33
        }
34

NEW
35
        $fileName = join(
×
NEW
36
            "",
×
NEW
37
            [
×
NEW
38
                "export",
×
NEW
39
                new DateTimeImmutable()->format(DATE_ATOM),
×
NEW
40
                ".csv",
×
NEW
41
            ]
×
NEW
42
        );
×
NEW
43
        header(sprintf("Content-Disposition: attachment; filename=%s;", $fileName));
×
44

NEW
45
        return $result;
×
46
    }
47
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc