Skip to content

Commit 1c19c3c

Browse files
authored
chore: objects split into separate files (#94)
1 parent c297a17 commit 1c19c3c

11 files changed

Lines changed: 110 additions & 71 deletions

src/Bound.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66

77
use JsonSerializable;
88

9-
enum BoundType: string
10-
{
11-
case INCLUSIVE = 'inclusive';
12-
case EXCLUSIVE = 'exclusive';
13-
}
14-
159
final readonly class Bound implements JsonSerializable
1610
{
1711
public function __construct(

src/BoundType.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Thenativeweb\Eventsourcingdb;
6+
7+
enum BoundType: string
8+
{
9+
case INCLUSIVE = 'inclusive';
10+
case EXCLUSIVE = 'exclusive';
11+
}

src/Ed25519.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Thenativeweb\Eventsourcingdb;
6+
7+
final readonly class Ed25519
8+
{
9+
public function __construct(
10+
public string $privateKey,
11+
public string $publicKey,
12+
) {
13+
}
14+
}

src/ObserveEventsOptions.php

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,6 @@
66

77
use JsonSerializable;
88

9-
enum ObserveIfEventIsMissing: string
10-
{
11-
case READ_EVERYTHING = 'read-everything';
12-
case WAIT_FOR_EVENT = 'wait-for-event';
13-
}
14-
15-
final readonly class ObserveFromLatestEvent implements JsonSerializable
16-
{
17-
public function __construct(
18-
public string $subject,
19-
public string $type,
20-
public ObserveIfEventIsMissing $ifEventIsMissing,
21-
) {
22-
}
23-
24-
public function jsonSerialize(): array
25-
{
26-
return [
27-
'subject' => $this->subject,
28-
'type' => $this->type,
29-
'ifEventIsMissing' => $this->ifEventIsMissing->value,
30-
];
31-
}
32-
}
33-
349
final readonly class ObserveEventsOptions implements JsonSerializable
3510
{
3611
public function __construct(

src/ObserveFromLatestEvent.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Thenativeweb\Eventsourcingdb;
6+
7+
use JsonSerializable;
8+
9+
final readonly class ObserveFromLatestEvent implements JsonSerializable
10+
{
11+
public function __construct(
12+
public string $subject,
13+
public string $type,
14+
public ObserveIfEventIsMissing $ifEventIsMissing,
15+
) {
16+
}
17+
18+
public function jsonSerialize(): array
19+
{
20+
return [
21+
'subject' => $this->subject,
22+
'type' => $this->type,
23+
'ifEventIsMissing' => $this->ifEventIsMissing->value,
24+
];
25+
}
26+
}

src/ObserveIfEventIsMissing.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Thenativeweb\Eventsourcingdb;
6+
7+
enum ObserveIfEventIsMissing: string
8+
{
9+
case READ_EVERYTHING = 'read-everything';
10+
case WAIT_FOR_EVENT = 'wait-for-event';
11+
}

src/Order.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Thenativeweb\Eventsourcingdb;
6+
7+
enum Order: string
8+
{
9+
case CHRONOLOGICAL = 'chronological';
10+
case ANTICHRONOLOGICAL = 'antichronological';
11+
}

src/ReadEventsOptions.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,6 @@
66

77
use JsonSerializable;
88

9-
enum Order: string
10-
{
11-
case CHRONOLOGICAL = 'chronological';
12-
case ANTICHRONOLOGICAL = 'antichronological';
13-
}
14-
15-
enum ReadIfEventIsMissing: string
16-
{
17-
case READ_NOTHING = 'read-nothing';
18-
case READ_EVERYTHING = 'read-everything';
19-
}
20-
21-
final readonly class ReadFromLatestEvent implements JsonSerializable
22-
{
23-
public function __construct(
24-
public string $subject,
25-
public string $type,
26-
public ReadIfEventIsMissing $ifEventIsMissing,
27-
) {
28-
}
29-
30-
public function jsonSerialize(): array
31-
{
32-
return [
33-
'subject' => $this->subject,
34-
'type' => $this->type,
35-
'ifEventIsMissing' => $this->ifEventIsMissing->value,
36-
];
37-
}
38-
}
39-
409
final readonly class ReadEventsOptions implements JsonSerializable
4110
{
4211
public function __construct(

src/ReadFromLatestEvent.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Thenativeweb\Eventsourcingdb;
6+
7+
use JsonSerializable;
8+
9+
final readonly class ReadFromLatestEvent implements JsonSerializable
10+
{
11+
public function __construct(
12+
public string $subject,
13+
public string $type,
14+
public ReadIfEventIsMissing $ifEventIsMissing,
15+
) {
16+
}
17+
18+
public function jsonSerialize(): array
19+
{
20+
return [
21+
'subject' => $this->subject,
22+
'type' => $this->type,
23+
'ifEventIsMissing' => $this->ifEventIsMissing->value,
24+
];
25+
}
26+
}

src/ReadIfEventIsMissing.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Thenativeweb\Eventsourcingdb;
6+
7+
enum ReadIfEventIsMissing: string
8+
{
9+
case READ_NOTHING = 'read-nothing';
10+
case READ_EVERYTHING = 'read-everything';
11+
}

0 commit comments

Comments
 (0)