Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
62
app/Services/Git/IssueSnapshot.php
Normal file
62
app/Services/Git/IssueSnapshot.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services\Git;
|
||||
|
||||
use Carbon\CarbonImmutable;
|
||||
|
||||
/**
|
||||
* A provider-neutral open issue.
|
||||
*/
|
||||
final readonly class IssueSnapshot
|
||||
{
|
||||
public function __construct(
|
||||
public int $number,
|
||||
public string $title,
|
||||
public string $htmlUrl,
|
||||
/** @var array<int, string> */
|
||||
public array $labels = [],
|
||||
public bool $isGoodFirstIssue = false,
|
||||
public bool $isHelpWanted = false,
|
||||
public ?string $author = null,
|
||||
public ?string $assignee = null,
|
||||
public int $comments = 0,
|
||||
public ?CarbonImmutable $createdAt = null,
|
||||
public ?CarbonImmutable $updatedAt = null,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Decide whether a label set marks an issue as newcomer-friendly, using
|
||||
* the spellings configured in config/git.php.
|
||||
*
|
||||
* @param array<int, string> $labels
|
||||
*/
|
||||
public static function matchesLabelGroup(array $labels, string $group): bool
|
||||
{
|
||||
$wanted = array_map('mb_strtolower', config("git.labels.{$group}", []));
|
||||
$present = array_map('mb_strtolower', $labels);
|
||||
|
||||
return array_intersect($wanted, $present) !== [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function toAttributes(): array
|
||||
{
|
||||
return [
|
||||
'number' => $this->number,
|
||||
'title' => $this->title,
|
||||
'html_url' => $this->htmlUrl,
|
||||
'labels' => $this->labels,
|
||||
'is_good_first_issue' => $this->isGoodFirstIssue,
|
||||
'is_help_wanted' => $this->isHelpWanted,
|
||||
'author' => $this->author,
|
||||
'assignee' => $this->assignee,
|
||||
'comments' => $this->comments,
|
||||
'issue_created_at' => $this->createdAt,
|
||||
'issue_updated_at' => $this->updatedAt,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user