Skip to content

Commit 46c385e

Browse files
authored
Merge pull request #96 from marcreichel/feat/#95-popularity-score
👽 Implement Pop Score Endpoints
2 parents 4c7721d + 821008e commit 46c385e

File tree

12 files changed

+78
-14
lines changed

12 files changed

+78
-14
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"wrapper"
1111
],
1212
"type": "library",
13-
"minimum-stability": "dev",
13+
"minimum-stability": "stable",
1414
"require": {
1515
"php": "^8.1",
1616
"ext-json": "*",
@@ -26,7 +26,7 @@
2626
"larastan/larastan": "^2.9.2",
2727
"laravel/pint": "^1.13",
2828
"pestphp/pest": "^2",
29-
"pestphp/pest-plugin-type-coverage": "2.x-dev"
29+
"pestphp/pest-plugin-type-coverage": "^2.8.3"
3030
},
3131
"license": "MIT",
3232
"authors": [

phpstan-baseline.neon

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
parameters:
22
ignoreErrors:
33
-
4-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
4+
message: "#^Unable to resolve the template type TMapValue in call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:map\\(\\)$#"
55
count: 1
6-
path: src/Console/CreateWebhook.php
7-
8-
-
9-
message: "#^Parameter \\#2 \\$array of function preg_grep expects array, array\\<int, string\\>\\|false given\\.$#"
10-
count: 1
11-
path: src/Console/CreateWebhook.php
6+
path: src/Models/Model.php
127

138
-
149
message: "#^Cannot call method assertExitCode\\(\\) on Illuminate\\\\Testing\\\\PendingCommand\\|int\\.$#"

phpstan.neon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ parameters:
1313
- '#Call to an undefined static method MarcReichel\\IGDBLaravel\\Models\\Game::foo\(\).#'
1414
- '#Unable to resolve the template type TValue in call to function collect#'
1515
- '#Unable to resolve the template type TKey in call to function collect#'
16-
checkMissingIterableValueType: false
17-
checkGenericClassInNonGenericObjectType: false
16+
- identifier: missingType.iterableValue
17+
- identifier: missingType.generics

src/Console/CreateWebhook.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ public function handle(): int
8989

9090
private function getModels(): array
9191
{
92-
$glob = glob(__DIR__ . '/../Models/*.php') ?? [];
92+
$glob = glob(__DIR__ . '/../Models/*.php') ?: [];
9393

94-
$pattern = '/\/(?:Model|Search|Webhook|Image)\.php$/';
94+
$pattern = '/\/(?:Model|PopularityPrimitive|Search|Webhook|Image)\.php$/';
9595
$grep = preg_grep($pattern, $glob, PREG_GREP_INVERT);
9696

9797
return collect($grep ?: [])

src/Enums/Popularity/Source.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MarcReichel\IGDBLaravel\Enums\Popularity;
6+
7+
enum Source: int
8+
{
9+
case IGDB = 121;
10+
}

src/Enums/Webhook/Category.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,5 @@ enum Category: int
5858
case CollectionRelationType = 1781504066;
5959
case LanguageSupportType = 1157224631;
6060
case Website = 698516688;
61+
case PopularityType = 1657974190;
6162
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MarcReichel\IGDBLaravel\Events;
6+
7+
use Illuminate\Http\Request;
8+
use MarcReichel\IGDBLaravel\Models\PopularityType;
9+
10+
class PopularityTypeCreated extends Event
11+
{
12+
public PopularityType $data;
13+
14+
public function __construct(PopularityType $data, Request $request)
15+
{
16+
parent::__construct($request);
17+
$this->data = $data;
18+
}
19+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MarcReichel\IGDBLaravel\Events;
6+
7+
class PopularityTypeDeleted extends PopularityTypeCreated
8+
{
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MarcReichel\IGDBLaravel\Events;
6+
7+
class PopularityTypeUpdated extends PopularityTypeCreated
8+
{
9+
}

src/Models/PopularityPrimitive.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace MarcReichel\IGDBLaravel\Models;
6+
7+
class PopularityPrimitive extends Model
8+
{
9+
protected array $casts = [
10+
'popularity_type' => PopularityType::class,
11+
];
12+
}

0 commit comments

Comments
 (0)