-
-
Notifications
You must be signed in to change notification settings - Fork 433
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
rolloutValue
fields in remote config parameters (#927)
- Loading branch information
1 parent
dd9560b
commit 603bcc4
Showing
5 changed files
with
100 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Kreait\Firebase\RemoteConfig; | ||
|
||
use JsonSerializable; | ||
|
||
/** | ||
* @phpstan-type RemoteConfigRolloutValueShape array{ | ||
* rolloutId: non-empty-string, | ||
* value: string, | ||
* percent: int<0, 100> | ||
* } | ||
* | ||
* @see https://firebase.google.com/docs/reference/remote-config/rest/v1/RemoteConfig#rolloutvalue | ||
*/ | ||
final class RolloutValue implements JsonSerializable | ||
{ | ||
/** | ||
* @param RemoteConfigRolloutValueShape $data | ||
*/ | ||
private function __construct(private readonly array $data) | ||
{ | ||
} | ||
|
||
/** | ||
* @param RemoteConfigRolloutValueShape $data | ||
*/ | ||
public static function fromArray(array $data): self | ||
{ | ||
return new self($data); | ||
} | ||
|
||
/** | ||
* @return RemoteConfigRolloutValueShape | ||
*/ | ||
public function toArray(): array | ||
{ | ||
return $this->data; | ||
} | ||
|
||
/** | ||
* @return RemoteConfigRolloutValueShape | ||
*/ | ||
public function jsonSerialize(): array | ||
{ | ||
return $this->data; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters