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

ericfortmeyer / activity-log / 20527476519

26 Dec 2025 06:39PM UTC coverage: 42.491%. Remained the same
20527476519

push

github

web-flow
fix: remove validation (#67)

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

0 of 10 new or added lines in 2 files covered. (0.0%)

348 of 819 relevant lines covered (42.49%)

1.31 hits per line

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

0.0
/src/AppReleaseEvent.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace EricFortmeyer\ActivityLog;
6

7
use Phpolar\Model\AbstractModel;
8
use Phpolar\Validators\MaxLength;
9
use Phpolar\Validators\Pattern;
10
use Psr\Http\Message\RequestInterface;
11

12
final class AppReleaseEvent extends AbstractModel
13
{
14
    private const EVENT_TYPE_HEADER_KEY = "X-GitHub-Event";
15
    private const HOOK_ID_HEADER_KEY = "X-GitHub-Hook-ID";
16
    private const RELEASE_EVENT_TYPE = "release";
17
    private const ACCEPTABLE_RELEASE_ACTION = ["created"];
18
    public readonly AppRelease $release;
19

20
    #[MaxLength(100)]
21
    #[Pattern("/^[[:digit:]]+$/")]
22
    public int|string $hookId;
23

24
    public function __construct(null|array|object $data = [])
25
    {
26
        $this->release = new AppRelease(
×
27
            is_object($data) === true && property_exists($data, "release") === true
×
28
                ? $data->release
×
29
                : []
×
30
        );
×
31
    }
32

33
    public function isValid(): bool
34
    {
NEW
35
        return true;
×
36
    }
37

38
    public static function fromRequest(string $requestBody, RequestInterface $request): self
39
    {
40
        $data = json_decode($requestBody);
×
41
        return new self(is_object($data) ? $data : [])->withHookId(
×
42
            $request->getHeader(self::HOOK_ID_HEADER_KEY)[0] ?? "invalid!!!"
×
43
        );
×
44
    }
45

46
    public static function isReleaseEventRequest(RequestInterface $request): bool
47
    {
48
        return ($request->getHeader(self::EVENT_TYPE_HEADER_KEY)[0] ?? "invalid!!!") === self::RELEASE_EVENT_TYPE;
×
49
    }
50

51
    public static function isCreatedRelease(string $requestBody): bool
52
    {
NEW
53
        $json = json_decode($requestBody);
×
54
        return is_object($json) === true
×
55
            && property_exists($json, "action") === true
×
56
            && in_array($json->action, self::ACCEPTABLE_RELEASE_ACTION);
×
57
    }
58

59
    private function withHookId(int|string $hookId): self
60
    {
61
        $newThis = clone $this;
×
62
        $newThis->hookId = $hookId;
×
63
        return $newThis;
×
64
    }
65
}
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