|
- <?php
-
- namespace App\Kintone;
-
- use App\Features\InstanceAble;
- use LogicException;
-
- class KintoneAccessStore
- {
- use InstanceAble;
-
- private array $store = [];
-
- public function set(string $modelName, KintoneAccess $access)
- {
- $this->store[$modelName] = $access;
- }
- public function has(string $modelName): bool
- {
- return data_get($this->store, $modelName) !== null;
- }
- public function get(string $modelName): KintoneAccess
- {
- $accesss = data_get($this->store, $modelName);
- if ($accesss === null) {
- throw new LogicException(sprintf("KintoneAccessStore 未登録 %s", $modelName));
- }
- return $accesss;
- }
- }
|