<?php
 declare(strict_types=1); namespace Shopify\Auth; class FileSessionStorage implements SessionStorage { private readonly string $path; public function __construct(string $path = '/tmp/shopify_api_sessions') { if (!is_dir($path)) { mkdir($path); } $this->path = $path; } public function loadSession(string $sessionId): ?Session { $path = $this->getPath($sessionId); if (!file_exists($path)) { return null; } return unserialize(file_get_contents($path)); } public function storeSession(Session $session): bool { return file_put_contents($this->getPath($session->getId()), serialize($session)) > 0; } private function getPath(string $sessionId): string { return "{$this->path}/{$sessionId}"; } public function deleteSession(string $sessionId): bool { $path = $this->getPath($sessionId); if (file_exists($path)) { unlink($path); } return true; } } 