mirror of
https://github.com/safishamsi/graphify.git
synced 2026-07-12 18:37:12 +00:00
81a43f028f
Java, C, C++, Ruby, C#, Kotlin, Scala, PHP via tree-sitter (13 total) benchmark.py measures BFS subgraph tokens vs corpus tokens 5 skill bug fixes (cohesion crash, dead step, missing MCP tool)
40 lines
786 B
PHP
40 lines
786 B
PHP
<?php
|
|
|
|
namespace App\Http;
|
|
|
|
use App\Auth\Authenticator;
|
|
use App\Cache\CacheManager;
|
|
|
|
class ApiClient
|
|
{
|
|
private string $baseUrl;
|
|
private Authenticator $auth;
|
|
|
|
public function __construct(string $baseUrl)
|
|
{
|
|
$this->baseUrl = $baseUrl;
|
|
$this->auth = new Authenticator();
|
|
}
|
|
|
|
public function get(string $path): string
|
|
{
|
|
return $this->fetch($path, 'GET');
|
|
}
|
|
|
|
public function post(string $path, string $body): string
|
|
{
|
|
return $this->fetch($path, 'POST');
|
|
}
|
|
|
|
private function fetch(string $path, string $method): string
|
|
{
|
|
$token = $this->auth->getToken();
|
|
return $method . ' ' . $this->baseUrl . $path;
|
|
}
|
|
}
|
|
|
|
function parseResponse(string $raw): array
|
|
{
|
|
return json_decode($raw, true);
|
|
}
|