chore(*.php): use pint for php formatting

This commit is contained in:
Cory Dransfeldt 2025-06-14 16:55:03 -07:00
parent bd1855a65e
commit 753f3433ce
No known key found for this signature in database
40 changed files with 2261 additions and 1900 deletions

View file

@ -2,43 +2,44 @@
namespace App\Classes;
use App\Classes\BaseHandler;
use App\Classes\GlobalsFetcher;
abstract class PageFetcher extends BaseHandler
{
protected ?array $globals = null;
protected ?array $globals = null;
protected function cacheGet(string $key): mixed
{
return $this->cache && $this->cache->exists($key) ? json_decode($this->cache->get($key), true) : null;
}
protected function cacheGet(string $key): mixed
{
return $this->cache && $this->cache->exists($key) ? json_decode($this->cache->get($key), true) : null;
}
protected function cacheSet(string $key, mixed $value, int $ttl = 300): void
{
if ($this->cache) $this->cache->setex($key, $ttl, json_encode($value));
}
protected function cacheSet(string $key, mixed $value, int $ttl = 300): void
{
if ($this->cache) {
$this->cache->setex($key, $ttl, json_encode($value));
}
}
protected function fetchSingleFromApi(string $endpoint, string $url): ?array
{
$data = $this->fetchFromApi($endpoint, "url=eq./{$url}");
protected function fetchSingleFromApi(string $endpoint, string $url): ?array
{
$data = $this->fetchFromApi($endpoint, "url=eq./{$url}");
return $data[0] ?? null;
}
return $data[0] ?? null;
}
protected function fetchPostRpc(string $endpoint, array $body): ?array
{
return $this->makeRequest("POST", $endpoint, ['json' => $body]);
}
protected function fetchPostRpc(string $endpoint, array $body): ?array
{
return $this->makeRequest('POST', $endpoint, ['json' => $body]);
}
public function getGlobals(): ?array
{
if ($this->globals !== null) return $this->globals;
public function getGlobals(): ?array
{
if ($this->globals !== null) {
return $this->globals;
}
$fetcher = new GlobalsFetcher();
$fetcher = new GlobalsFetcher();
$this->globals = $fetcher->fetch();
$this->globals = $fetcher->fetch();
return $this->globals;
}
return $this->globals;
}
}