Skip to content

Commit 0e9f132

Browse files
committed
feat: add a single provider resolution implementation
1 parent d4fd7f1 commit 0e9f132

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace OpenFeature\implementation\multiprovider;
6+
7+
use OpenFeature\interfaces\provider\Provider;
8+
use OpenFeature\interfaces\provider\ResolutionDetails;
9+
use Throwable;
10+
11+
/**
12+
* Represents the result of evaluating a single provider in a multi-provider setup.
13+
* Contains the resolution details, any error that was thrown, and the source provider information.
14+
*/
15+
class ProviderResolutionResult
16+
{
17+
public function __construct(
18+
private string $providerName,
19+
private Provider $provider,
20+
private ?ResolutionDetails $details = null,
21+
private ?Throwable $error = null,
22+
) {
23+
}
24+
25+
public function getProviderName(): string
26+
{
27+
return $this->providerName;
28+
}
29+
30+
public function getProvider(): Provider
31+
{
32+
return $this->provider;
33+
}
34+
35+
public function getDetails(): ?ResolutionDetails
36+
{
37+
return $this->details;
38+
}
39+
40+
public function getError(): ?Throwable
41+
{
42+
return $this->error;
43+
}
44+
45+
public function hasError(): bool
46+
{
47+
return $this->error !== null;
48+
}
49+
50+
public function isSuccessful(): bool
51+
{
52+
return $this->details !== null && $this->error === null;
53+
}
54+
}

0 commit comments

Comments
 (0)