Skip to content

Commit

Permalink
👽 Implement Pop Score Endpoints
Browse files Browse the repository at this point in the history
- Closes #95
  • Loading branch information
marcreichel committed Jul 1, 2024
1 parent 4c7721d commit 6d474f8
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 3 deletions.
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

0 comments on commit 6d474f8

Please sign in to comment.