You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 satır
698B

  1. <?php
  2. namespace App\Kintone;
  3. use App\Features\InstanceAble;
  4. use LogicException;
  5. class KintoneAccessStore
  6. {
  7. use InstanceAble;
  8. private array $store = [];
  9. public function set(string $modelName, KintoneAccess $access)
  10. {
  11. $this->store[$modelName] = $access;
  12. }
  13. public function has(string $modelName): bool
  14. {
  15. return data_get($this->store, $modelName) !== null;
  16. }
  17. public function get(string $modelName): KintoneAccess
  18. {
  19. $accesss = data_get($this->store, $modelName);
  20. if ($accesss === null) {
  21. throw new LogicException(sprintf("KintoneAccessStore 未登録 %s", $modelName));
  22. }
  23. return $accesss;
  24. }
  25. }