Skip to content
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: 4 additions & 0 deletions .horde.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ dependencies:
phpstan/phpstan: ^2
nocommands:
- bin/demo-client.php

quality:
phpstan:
level: 5
6 changes: 3 additions & 3 deletions bin/demo-client.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@
title: 'Demo PR - API Client Test',
head: $headBranch,
base: $baseBranch,
body: "This is a demo pull request created by the GitHub API Client.\n\n" .
"Created at: " . date('Y-m-d H:i:s') . "\n" .
"This PR can be safely closed.",
body: "This is a demo pull request created by the GitHub API Client.\n\n"
. "Created at: " . date('Y-m-d H:i:s') . "\n"
. "This PR can be safely closed.",
draft: (getenv('PR_DRAFT') === '1'),
maintainerCanModify: true
);
Expand Down
12 changes: 6 additions & 6 deletions bin/demo-token-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@
try {
echo "📊 Checking Rate Limit...\n";
$rateLimit = $client->getRateLimit();

echo " ├─ Limit: " . number_format($rateLimit->limit) . " requests/hour\n";
echo " ├─ Used: " . number_format($rateLimit->used) . " requests\n";
echo " ├─ Remaining: " . number_format($rateLimit->remaining) . " requests\n";
echo " ├─ Usage: " . number_format($rateLimit->getUsagePercentage(), 1) . "%\n";

if ($rateLimit->isExhausted()) {
echo " └─ ⚠️ EXHAUSTED - Resets at " . $rateLimit->getResetDateTime()->format('Y-m-d H:i:s T') . "\n";
} else {
$seconds = $rateLimit->getSecondsUntilReset();
$minutes = floor($seconds / 60);
echo " └─ ✓ Resets in " . $minutes . " minutes (" . $rateLimit->getResetDateTime()->format('Y-m-d H:i:s T') . ")\n";
}

echo "\n";
} catch (\Exception $e) {
echo " └─ ✗ Error: " . $e->getMessage() . "\n\n";
Expand All @@ -68,7 +68,7 @@
try {
echo "🔐 Checking Token Scopes/Permissions...\n";
$scopes = $client->getTokenScopes();

if ($scopes->isEmpty()) {
echo " └─ ⚠️ No scopes granted (token may be invalid)\n\n";
} else {
Expand All @@ -80,14 +80,14 @@
echo " │ ├─ Write Repositories: " . ($scopes->canWriteRepositories() ? "✓ YES" : "✗ NO") . "\n";
echo " │ └─ Read Organizations: " . ($scopes->canReadOrganizations() ? "✓ YES" : "✗ NO") . "\n";
echo " │\n";

// List all individual scopes
echo " └─ Individual Scopes:\n";
foreach ($scopes->toArray() as $scope) {
echo " • " . $scope . "\n";
}
}

echo "\n";
} catch (\Exception $e) {
echo " └─ ✗ Error: " . $e->getMessage() . "\n\n";
Expand Down
227 changes: 0 additions & 227 deletions create-pr.php

This file was deleted.

49 changes: 49 additions & 0 deletions src/CreateInstallationAccessTokenParams.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

namespace Horde\GithubApiClient;

/**
* Data transfer object for creating an installation access token
*
* Copyright 2026 The Horde Project (http://www.horde.org/)
*
* See the enclosed file LICENSE for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Horde
* @package GithubApiClient
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
*/
class CreateInstallationAccessTokenParams
{
/**
* @param array<string> $repositories List of repository names to grant access to (optional)
* @param array<string, string> $permissions Permissions to grant (optional)
*/
public function __construct(
public readonly array $repositories = [],
public readonly array $permissions = []
) {}

/**
* Convert to array for API request
*
* @return array<string, array>
*/
public function toArray(): array

Check failure on line 35 in src/CreateInstallationAccessTokenParams.php

View workflow job for this annotation

GitHub Actions / CI

Method Horde\GithubApiClient\CreateInstallationAccessTokenParams::toArray() return type has no value type specified in iterable type array.
{
$data = [];

if ($this->repositories !== []) {
$data['repositories'] = $this->repositories;
}

if ($this->permissions !== []) {
$data['permissions'] = $this->permissions;
}

return $data;
}
}
Loading