• 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/SaveRemarksForMonth.php
1
<?php
2

3
namespace EricFortmeyer\ActivityLog\Http\RequestProcessors;
4

5
use Phpolar\{
6
    Model\Model,
7
    Storage\NotFound
8
};
9
use Phpolar\Phpolar\Auth\Authorize;
10
use EricFortmeyer\ActivityLog\{
11
    RemarksForMonth,
12
    MonthFilters,
13
    CreditHours,
14
    TimeEntry
15
};
16
use EricFortmeyer\ActivityLog\Services\{
17
    RemarksForMonthService,
18
    CreditHoursService,
19
    TemplateBinder,
20
    TimeEntryService
21
};
22
use EricFortmeyer\ActivityLog\UserInterface\Contexts\TimeEntriesContext;
23
use EricFortmeyer\ActivityLog\Utils\Hasher;
24

25
final class SaveRemarksForMonth extends AbstractTenantBasedRequestProcessor
26
{
27
    public function __construct(
28
        private readonly RemarksForMonthService $remarksService,
29
        private readonly CreditHoursService $creditHoursService,
30
        private readonly TimeEntryService $timeEntryService,
31
        private readonly TemplateBinder $templateEngine,
32
        readonly Hasher $hasher,
33
    ) {
34
        parent::__construct($hasher);
×
35
    }
36

37
    #[Authorize]
38
    public function process(
39
        #[Model] RemarksForMonth $remarks = new RemarksForMonth(),
40
        #[Model] MonthFilters $monthFilters = new MonthFilters()
41
    ): string {
42
        if ($remarks->isValid() === true) {
×
43
            $this->remarksService->save($remarks, $this->getTenantId());
×
44
        }
45
        $remarks->isPosted();
×
46

47
        $creditHours = $this->creditHoursService->get(
×
48
            CreditHours::getIdFromMonth(
×
49
                year: $remarks->year,
×
50
                month: $remarks->month,
×
51
                tenantId: $this->getTenantId(),
×
52
            ),
×
53
        );
×
54

55
        $timeEntries = $this->timeEntryService->getAllByMonth(
×
56
            month: $remarks->month,
×
57
            year: $remarks->year,
×
58
            tenantId: $this->getTenantId(),
×
59
        );
×
60
        $currentEntry = new TimeEntry();
×
61
        TimeEntry::setUninitializedValues(
×
62
            $currentEntry,
×
63
            $remarks->month,
×
64
            $remarks->year,
×
65
        );
×
NEW
66
        return $this->templateEngine->apply(
×
67
            "index",
×
NEW
68
            $creditHours instanceof NotFound
×
NEW
69
                ? new TimeEntriesContext(
×
NEW
70
                    timeEntries: $timeEntries,
×
NEW
71
                    tenantId: $this->getTenantId(),
×
NEW
72
                    currentEntry: $currentEntry,
×
NEW
73
                    filters: $monthFilters,
×
NEW
74
                    remarks: $remarks,
×
NEW
75
                    user: $this->user,
×
NEW
76
                )
×
NEW
77
                : new TimeEntriesContext(
×
NEW
78
                    timeEntries: $timeEntries,
×
NEW
79
                    tenantId: $this->getTenantId(),
×
NEW
80
                    currentEntry: $currentEntry,
×
NEW
81
                    filters: $monthFilters,
×
NEW
82
                    remarks: $remarks,
×
NEW
83
                    creditHours: $creditHours,
×
NEW
84
                    user: $this->user,
×
NEW
85
                )
×
UNCOV
86
        );
×
87
    }
88
}
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