• 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

80.0
/src/Internal/OperationItem.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\ClientOperation;
20

21
/** @internal */
22
class OperationItem
23
{
24
    private static int $nextSeqNo = -1;
25

26
    private int $segNo;
27

28
    private ClientOperation $operation;
29

30
    private int $maxRetries;
31

32
    private float $timeout;
33

34
    private DateTimeImmutable $created;
35

36
    private string $connectionId = '';
37

38
    private string $correlationId;
39

40
    private int $retryCount;
41

42
    private DateTimeImmutable $lastUpdated;
43

44
    public function __construct(ClientOperation $operation, int $maxRetries, float $timeout)
45
    {
46
        $this->segNo = ++self::$nextSeqNo;
394✔
47
        $this->operation = $operation;
394✔
48
        $this->maxRetries = $maxRetries;
394✔
49
        $this->timeout = $timeout;
394✔
50
        $this->created = DateTime::utcNow();
394✔
51
        $this->correlationId = Guid::generateAsHex();
394✔
52
        $this->retryCount = 0;
394✔
53
        $this->lastUpdated = $this->created;
394✔
54
    }
55

56
    public function segNo(): int
57
    {
58
        return $this->segNo;
×
59
    }
60

61
    public function operation(): ClientOperation
62
    {
63
        return $this->operation;
394✔
64
    }
65

66
    public function maxRetries(): int
67
    {
68
        return $this->maxRetries;
×
69
    }
70

71
    public function timeout(): float
72
    {
73
        return $this->timeout;
12✔
74
    }
75

76
    public function created(): DateTimeImmutable
77
    {
78
        return $this->created;
×
79
    }
80

81
    public function connectionId(): string
82
    {
83
        return $this->connectionId;
12✔
84
    }
85

86
    public function correlationId(): string
87
    {
88
        return $this->correlationId;
394✔
89
    }
90

91
    public function retryCount(): int
92
    {
93
        return $this->retryCount;
×
94
    }
95

96
    public function incRetryCount(): void
97
    {
98
        ++$this->retryCount;
×
99
    }
100

101
    public function lastUpdated(): DateTimeImmutable
102
    {
103
        return $this->lastUpdated;
12✔
104
    }
105

106
    public function setConnectionId(string $connectionId): void
107
    {
108
        $this->connectionId = $connectionId;
394✔
109
    }
110

111
    public function setCorrelationId(string $correlationId): void
112
    {
113
        $this->correlationId = $correlationId;
×
114
    }
115

116
    /**
117
     * @param DateTimeImmutable $lastUpdated
118
     */
119
    public function setLastUpdated(DateTimeImmutable $lastUpdated): void
120
    {
121
        $this->lastUpdated = $lastUpdated;
394✔
122
    }
123

124
    public function __toString(): string
125
    {
126
        return \sprintf(
394✔
127
            'Operation %s (%s): %s, retry count: %d, created: %s, last updated: %s',
394✔
128
            $this->operation->name(),
394✔
129
            $this->correlationId,
394✔
130
            (string) $this->operation,
394✔
131
            $this->retryCount,
394✔
132
            DateTime::format($this->created),
394✔
133
            DateTime::format($this->lastUpdated)
394✔
134
        );
394✔
135
    }
136
}
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