Skip to content

Commit

Permalink
Fixed CuratorResource compatibility with amphp/http-client 5-beta.7.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bilge committed Jan 9, 2023
1 parent 8709212 commit a2adfa9
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/Resource/Curator/CuratorList/DeleteCuratorListApp.php
Expand Up @@ -26,7 +26,7 @@ protected function getSource(): DataSource
{
$body = new FormBody;
$body->addFields([
'appid' => $this->appId,
'appid' => (string)$this->appId,
'listid' => $this->listId,
'sessionid' => $this->session->getStoreSessionCookie()->getValue(),
]);
Expand Down
6 changes: 3 additions & 3 deletions src/Resource/Curator/CuratorList/PutCuratorList.php
Expand Up @@ -45,11 +45,11 @@ private function toFormBody(CuratorList $list): RequestBody
'listid' => $list->getListId(),
'order' => 'specified',
'sessionid' => $this->session->getStoreSessionCookie()->getValue(),
'showtitleanddesc' => 1,
'state' => $list->getTitle() === '' ? 0 : 1,
'showtitleanddesc' => '1',
'state' => $list->getTitle() === '' ? '0' : '1',
'title' => $list->getTitle(),
'title_blurb_locs' => '{}',
'type' => 2,
'type' => '2',
]);

return $body;
Expand Down
2 changes: 1 addition & 1 deletion src/Resource/Curator/CuratorList/PutCuratorListApp.php
Expand Up @@ -29,7 +29,7 @@ protected function getSource(): DataSource
{
$body = new FormBody;
$body->addFields([
'appid' => $this->appId,
'appid' => (string)$this->appId,
'listid' => $this->listId,
'sessionid' => $this->session->getStoreSessionCookie()->getValue(),
]);
Expand Down
4 changes: 2 additions & 2 deletions src/Resource/Curator/PutCuratorReview.php
Expand Up @@ -27,10 +27,10 @@ protected function getSource(): DataSource
{
$body = new FormBody;
$body->addFields([
'appid' => $this->review->getAppId(),
'appid' => (string)$this->review->getAppId(),
'blurb' => $this->review->getBody(),
'link_url' => $this->review->getUrl(),
'recommendation_state' => $this->review->getRecommendationState()->toInt(),
'recommendation_state' => (string)$this->review->getRecommendationState()->toInt(),
'sessionid' => $this->session->getStoreSessionCookie()->getValue(),
]);

Expand Down
19 changes: 8 additions & 11 deletions src/Resource/Curator/RecommendationState.php
Expand Up @@ -6,9 +6,9 @@
use Eloquent\Enumeration\AbstractEnumeration;

/**
* @method static RECOMMENDED()
* @method static INFORMATIONAL()
* @method static NOT_RECOMMENDED()
* @method static self RECOMMENDED
* @method static self INFORMATIONAL
* @method static self NOT_RECOMMENDED
*/
final class RecommendationState extends AbstractEnumeration
{
Expand All @@ -18,13 +18,10 @@ final class RecommendationState extends AbstractEnumeration

public function toInt(): int
{
switch ($this) {
case self::RECOMMENDED:
return 0;
case self::INFORMATIONAL:
return 2;
case self::NOT_RECOMMENDED:
return 1;
}
return match ($this) {
self::RECOMMENDED() => 0,
self::INFORMATIONAL() => 2,
self::NOT_RECOMMENDED() => 1,
};
}
}

0 comments on commit a2adfa9

Please sign in to comment.