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

prooph / event-store-client / 9555551525

17 Jun 2024 10:16PM UTC coverage: 70.262% (-1.1%) from 71.395%
9555551525

push

github

prolic
update coveralls repo token

3466 of 4933 relevant lines covered (70.26%)

67.7 hits per line

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

74.07
/src/Internal/SubscriptionItem.php
1
<?php
2

3
/**
4
 * This file is part of `prooph/event-store-client`.
5
 * (c) 2018-2024 Alexander Miertsch <kontakt@codeliner.ws>
6
 * (c) 2018-2024 Sascha-Oliver Prolic <saschaprolic@googlemail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace Prooph\EventStoreClient\Internal;
15

16
use DateTimeImmutable;
17
use Prooph\EventStore\Util\DateTime;
18
use Prooph\EventStore\Util\Guid;
19
use Prooph\EventStoreClient\ClientOperations\SubscriptionOperation;
20

21
/** @internal  */
22
class SubscriptionItem
23
{
24
    private DateTimeImmutable $created;
25

26
    private string $connectionId = '';
27

28
    private string $correlationId;
29

30
    private bool $isSubscribed = false;
31

32
    private int $retryCount = 0;
33

34
    private DateTimeImmutable $lastUpdated;
35

36
    public function __construct(private SubscriptionOperation $operation, private int $maxRetries, private float $timeout)
37
    {
38
        $this->created = DateTime::utcNow();
87✔
39
        $this->correlationId = Guid::generateAsHex();
87✔
40
        $this->lastUpdated = $this->created;
87✔
41
    }
42

43
    public function operation(): SubscriptionOperation
44
    {
45
        return $this->operation;
87✔
46
    }
47

48
    public function maxRetries(): int
49
    {
50
        return $this->maxRetries;
×
51
    }
52

53
    public function timeout(): float
54
    {
55
        return $this->timeout;
×
56
    }
57

58
    public function created(): DateTimeImmutable
59
    {
60
        return $this->created;
×
61
    }
62

63
    public function connectionId(): string
64
    {
65
        return $this->connectionId;
×
66
    }
67

68
    public function correlationId(): string
69
    {
70
        return $this->correlationId;
19✔
71
    }
72

73
    public function isSubscribed(): bool
74
    {
75
        return $this->isSubscribed;
87✔
76
    }
77

78
    public function retryCount(): int
79
    {
80
        return $this->retryCount;
×
81
    }
82

83
    public function lastUpdated(): DateTimeImmutable
84
    {
85
        return $this->lastUpdated;
×
86
    }
87

88
    public function setConnectionId(string $connectionId): void
89
    {
90
        $this->connectionId = $connectionId;
87✔
91
    }
92

93
    public function setCorrelationId(string $correlationId): void
94
    {
95
        $this->correlationId = $correlationId;
87✔
96
    }
97

98
    public function setIsSubscribed(bool $isSubscribed): void
99
    {
100
        $this->isSubscribed = $isSubscribed;
77✔
101
    }
102

103
    public function incRetryCount(): void
104
    {
105
        ++$this->retryCount;
×
106
    }
107

108
    public function setLastUpdated(DateTimeImmutable $lastUpdated): void
109
    {
110
        $this->lastUpdated = $lastUpdated;
87✔
111
    }
112

113
    public function __toString(): string
114
    {
115
        return \sprintf(
87✔
116
            'Subscription %s (%s): %s, is subscribed: %s, retry count: %d, created: %s, last updated: %s',
87✔
117
            $this->operation->name(),
87✔
118
            $this->correlationId,
87✔
119
            (string) $this->operation,
87✔
120
            $this->isSubscribed ? 'yes' : 'no',
87✔
121
            $this->retryCount,
87✔
122
            DateTime::format($this->created),
87✔
123
            DateTime::format($this->lastUpdated)
87✔
124
        );
87✔
125
    }
126
}
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

© 2025 Coveralls, Inc