diff --git a/config/reference.php b/config/reference.php index ea15291..cd63856 100644 --- a/config/reference.php +++ b/config/reference.php @@ -121,7 +121,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * } * @psalm-type ServicesConfig = array{ * _defaults?: DefaultsType, - * _instanceof?: InstanceofType, + * _instanceof?: array, * ... * } * @psalm-type ExtensionType = array @@ -857,6 +857,7 @@ use Symfony\Component\Config\Loader\ParamConfigurator as Param; * http_errors?: bool|Param, * expect?: mixed, * ssl_key?: mixed, + * force_ip_resolve?: mixed, // Default: null * stream?: bool|Param, * synchronous?: bool|Param, * read_timeout?: scalar|Param|null, diff --git a/src/Service/ContributionStore.php b/src/Service/ContributionStore.php new file mode 100644 index 0000000..7d61f90 --- /dev/null +++ b/src/Service/ContributionStore.php @@ -0,0 +1,35 @@ +dbPath))){ + mkdir(\dirname($this->dbPath), 0755, recursive: true); + } + $this->pdo = new PDO('sqlite:' . $this->dbPath); + $this->pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION); + $this->prepareSchema(); + } + + private function prepareSchema():void{ + $this->pdo->exec(' + CREATE TABLE IF NOT EXISTS contributions ( + provider TEXT NOT NULL, + date TEXT NOT NULL, + count INTEGER NOT NULL CHECK (count >= 0), + PRIMARY KEY (provider, date) + ) WITHOUT ROWID, STRICT + '); + } + +}