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

ericfortmeyer / activity-log / 19605856536

23 Nov 2025 04:25AM UTC coverage: 53.631% (+0.1%) from 53.501%
19605856536

push

github

web-flow
Merge pull request #34 from ericfortmeyer/add-hasher

refactor: add hashing abstraction

18 of 21 new or added lines in 8 files covered. (85.71%)

384 of 716 relevant lines covered (53.63%)

2.19 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
    PurePhp\HtmlSafeContext,
8
    PurePhp\TemplateEngine,
9
    Storage\NotFound
10
};
11
use Phpolar\Phpolar\Auth\Authorize;
12
use EricFortmeyer\ActivityLog\{
13
    RemarksForMonth,
14
    MonthFilters,
15
    CreditHours,
16
    TimeEntry
17
};
18
use EricFortmeyer\ActivityLog\Services\{
19
    RemarksForMonthService,
20
    CreditHoursService,
21
    TimeEntryService
22
};
23
use EricFortmeyer\ActivityLog\UserInterface\Contexts\TimeEntriesContext;
24
use EricFortmeyer\ActivityLog\Utils\Hasher;
25

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

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

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

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