Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👽 Implement Pop Score Endpoints #96

Merged
merged 4 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"wrapper"
],
"type": "library",
"minimum-stability": "dev",
"minimum-stability": "stable",
"require": {
"php": "^8.1",
"ext-json": "*",
Expand All @@ -26,7 +26,7 @@
"larastan/larastan": "^2.9.2",
"laravel/pint": "^1.13",
"pestphp/pest": "^2",
"pestphp/pest-plugin-type-coverage": "2.x-dev"
"pestphp/pest-plugin-type-coverage": "^2.8.3"
},
"license": "MIT",
"authors": [
Expand Down
9 changes: 2 additions & 7 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
parameters:
ignoreErrors:
-
message: "#^Expression on left side of \\?\\? is not nullable\\.$#"
message: "#^Unable to resolve the template type TMapValue in call to method Illuminate\\\\Support\\\\Collection\\<\\(int\\|string\\),mixed\\>\\:\\:map\\(\\)$#"
count: 1
path: src/Console/CreateWebhook.php

-
message: "#^Parameter \\#2 \\$array of function preg_grep expects array, array\\<int, string\\>\\|false given\\.$#"
count: 1
path: src/Console/CreateWebhook.php
path: src/Models/Model.php

-
message: "#^Cannot call method assertExitCode\\(\\) on Illuminate\\\\Testing\\\\PendingCommand\\|int\\.$#"
Expand Down
4 changes: 2 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ parameters:
- '#Call to an undefined static method MarcReichel\\IGDBLaravel\\Models\\Game::foo\(\).#'
- '#Unable to resolve the template type TValue in call to function collect#'
- '#Unable to resolve the template type TKey in call to function collect#'
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
- identifier: missingType.iterableValue
- identifier: missingType.generics
4 changes: 2 additions & 2 deletions src/Console/CreateWebhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ public function handle(): int

private function getModels(): array
{
$glob = glob(__DIR__ . '/../Models/*.php') ?? [];
$glob = glob(__DIR__ . '/../Models/*.php') ?: [];

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

return collect($grep ?: [])
Expand Down
10 changes: 10 additions & 0 deletions src/Enums/Popularity/Source.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

declare(strict_types=1);

namespace MarcReichel\IGDBLaravel\Enums\Popularity;

enum Source: int
{
case IGDB = 121;
}
1 change: 1 addition & 0 deletions src/Enums/Webhook/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ enum Category: int
case CollectionRelationType = 1781504066;
case LanguageSupportType = 1157224631;
case Website = 698516688;
case PopularityType = 1657974190;
}
19 changes: 19 additions & 0 deletions src/Events/PopularityTypeCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

declare(strict_types=1);

namespace MarcReichel\IGDBLaravel\Events;

use Illuminate\Http\Request;
use MarcReichel\IGDBLaravel\Models\PopularityType;

class PopularityTypeCreated extends Event
{
public PopularityType $data;

public function __construct(PopularityType $data, Request $request)
{
parent::__construct($request);
$this->data = $data;
}
}
9 changes: 9 additions & 0 deletions src/Events/PopularityTypeDeleted.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace MarcReichel\IGDBLaravel\Events;

class PopularityTypeDeleted extends PopularityTypeCreated
{
}
9 changes: 9 additions & 0 deletions src/Events/PopularityTypeUpdated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace MarcReichel\IGDBLaravel\Events;

class PopularityTypeUpdated extends PopularityTypeCreated
{
}
12 changes: 12 additions & 0 deletions src/Models/PopularityPrimitive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace MarcReichel\IGDBLaravel\Models;

class PopularityPrimitive extends Model
{
protected array $casts = [
'popularity_type' => PopularityType::class,
];
}
9 changes: 9 additions & 0 deletions src/Models/PopularityType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace MarcReichel\IGDBLaravel\Models;

class PopularityType extends Model
{
}
2 changes: 1 addition & 1 deletion tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static function modelsDataProvider(): array
{
$files = glob(__DIR__ . '/../src/Models/*.php');
$classNames = [];
$blackList = ['Search', 'Webhook'];
$blackList = ['PopularityPrimitive', 'Search', 'Webhook'];

if (!$files) {
return $classNames;
Expand Down
Loading