Skip to content

Commit 1f13adc

Browse files
committed
NTR - Fix minor syntax
1 parent cc4032e commit 1f13adc

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/Data/AccessToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public function isExpired() : bool
2525
$payload = json_decode(base64_decode(explode('.', $this->accessToken)[1]), true);
2626
$expiresAt = $payload['exp'];
2727

28-
return $expiresAt * 1000 < time();
28+
return $expiresAt - 10 < time();
2929
}
3030
}

src/Data/Webhook/AppAction/AppAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function createFromPayload(array $payload, ?array $headers = []):
5151
$source = $action = $meta = null;
5252

5353
if ($rawSource = $payload['source']) {
54-
$source = new Source($rawSource['url'], $rawSource['shopId'], (int) $rawSource['appVersion']);
54+
$source = new Source($rawSource['url'], $rawSource['shopId'], (string) $rawSource['appVersion']);
5555
}
5656

5757

src/Data/Webhook/Event/Event.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public static function createFromPayload(array $payload, ?array $headers = []):
5151
$source = $data = null;
5252

5353
if ($rawSource = $payload['source']) {
54-
$source = new Source($rawSource['url'], $rawSource['shopId'], (int) $rawSource['appVersion']);
54+
$source = new Source($rawSource['url'], $rawSource['shopId'], (string) $rawSource['appVersion']);
5555
}
5656

5757

src/Data/Webhook/Source.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ class Source extends Struct
1010

1111
private string $shopId;
1212

13-
private int $appVersion;
13+
private string $appVersion;
1414

1515
/**
1616
* Create the event from Event::createFromPayload.
1717
*/
18-
public function __construct(string $shopUrl, string $shopId, int $appVersion)
18+
public function __construct(string $shopUrl, string $shopId, string $appVersion)
1919
{
2020
$this->shopUrl = $shopUrl;
2121
$this->shopId = $shopId;
@@ -32,7 +32,7 @@ public function getShopId(): string
3232
return $this->shopId;
3333
}
3434

35-
public function getAppVersion(): int
35+
public function getAppVersion(): string
3636
{
3737
return $this->appVersion;
3838
}

src/Repository/Struct/VersionResponse.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class VersionResponse extends Struct
88
{
99
protected string $versionId;
1010

11-
protected string $versionName;
11+
protected ?string $versionName;
1212

1313
protected string $id;
1414

@@ -42,12 +42,12 @@ public function setVersionId(string $versionId): void
4242
$this->versionId = $versionId;
4343
}
4444

45-
public function getVersionName(): string
45+
public function getVersionName(): ?string
4646
{
4747
return $this->versionName;
4848
}
4949

50-
public function setVersionName(string $versionName): void
50+
public function setVersionName(?string $versionName): void
5151
{
5252
$this->versionName = $versionName;
5353
}

tests/AdminAuthenticatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public function testCallTokenCallback(): void
8787

8888
public function testTokenExpired(): void
8989
{
90-
$token = 'abc.' . base64_encode(json_encode(['exp' => (time() - 1000)/1000])) . '.xyz';
90+
$token = 'abc.' . base64_encode(json_encode(['exp' => time() - 100])) . '.xyz';
9191

9292
$accessToken = new AccessToken($token);
9393

9494
static::assertTrue($accessToken->isExpired());
9595

96-
$token = 'abc.' . base64_encode(json_encode(['exp' => (time() + 1000)/1000])) . '.xyz';
96+
$token = 'abc.' . base64_encode(json_encode(['exp' => time() + 100])) . '.xyz';
9797

9898
$accessToken = new AccessToken($token);
9999

0 commit comments

Comments
 (0)