chore(namespace): rewirtten namspeace from app to GitContributionGraph.

This commit is contained in:
2026-07-12 22:47:34 +02:00
parent 91bda21f89
commit 41e88144a4
35 changed files with 122 additions and 68 deletions
@@ -0,0 +1,54 @@
<?php
declare(strict_types=1);
namespace GitContributionGraph\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
#[AsCommand(name: 'graph:contributions:refetch')]
class RefetchContributionsCommand extends Command
{
private SymfonyStyle $io;
public function __construct(
#[AutowireIterator('app.provider')]
private readonly iterable $providers,
) {
parent::__construct();
}
public function initialize(InputInterface $input, OutputInterface $output)
{
$this->io = new SymfonyStyle($input, $output);
}
public function __invoke(
//TODO: check if its possible to add the preview with real strings from the providers.
#[Option("(repeatable/comma-split, restricts to named provider(s), default = all configured", "provider", "p", "")]
string $providers = ""
) {
$requested = $providers === '' ? null : explode(',', $providers);
$byName = [];
foreach ($this->providers as $provider) {
$byName[$provider->getName()] = $provider;
}
if ($requested !== null) {
foreach ($requested as $name) {
if (!isset($byName[$name])) {
$this->io->error("Unknown provider: {$name}");
return Command::FAILURE;
}
}
$byName = array_intersect_key($byName, array_flip($requested));
}
}
}
+4 -4
View File
@@ -2,11 +2,11 @@
declare(strict_types=1);
namespace App\Controller;
namespace GitContributionGraph\Controller;
use App\Service\ContributionAggregator;
use App\Service\Provider\ProviderHealthChecker;
use App\Service\Renderer\SvgRenderer;
use GitContributionGraph\Service\ContributionAggregator;
use GitContributionGraph\Service\Provider\ProviderHealthChecker;
use GitContributionGraph\Service\Renderer\SvgRenderer;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\HttpFoundation\RedirectResponse;
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Entity;
namespace GitContributionGraph\Entity;
final class Contribution
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Entity;
namespace GitContributionGraph\Entity;
/**
* @implements \IteratorAggregate<int, Contribution>
+1 -1
View File
@@ -1,6 +1,6 @@
<?php
namespace App;
namespace GitContributionGraph;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
+2 -2
View File
@@ -2,9 +2,9 @@
declare(strict_types=1);
namespace App\Service;
namespace GitContributionGraph\Service;
use App\Service\Provider\ProviderInterface;
use GitContributionGraph\Service\Provider\ProviderInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
+3 -3
View File
@@ -2,10 +2,10 @@
declare(strict_types=1);
namespace App\Service;
namespace GitContributionGraph\Service;
use App\Entity\Contribution;
use App\Entity\ContributionCollection;
use GitContributionGraph\Entity\Contribution;
use GitContributionGraph\Entity\ContributionCollection;
use PDO;
class ContributionStore
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException;
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
use Psr\Log\LoggerInterface;
use Symfony\Contracts\HttpClient\HttpClientInterface;
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
use Symfony\Contracts\HttpClient\Exception\TransportExceptionInterface;
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
enum ProviderErrorCode: string
{
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
interface ProviderInterface
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
final class ProviderStatus
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Provider;
namespace GitContributionGraph\Service\Provider;
enum ProviderStatusType: string
{
+1 -1
View File
@@ -2,7 +2,7 @@
declare(strict_types=1);
namespace App\Service\Renderer;
namespace GitContributionGraph\Service\Renderer;
/**
* Renders a GitHub-style contribution heatmap as an inline SVG.