19declare(strict_types=1);
37 public function __construct(
private readonly
bool $active,
private readonly Closure $build_user)
39 $this->cache =
new WeakMap();
58 return !$this->
user($user)->needsToAcceptNewDocument();
63 return !$this->
user($user)->neverAgreed();
68 return !$this->
user($user)->cannotAgree();
74 && $this->
user($user)->needsToAcceptNewDocument();
79 return $this->
user($user)->agreeDate()->value();
84 if (!isset($this->cache[$user])) {
85 $this->cache[$user] = ($this->build_user)($user);
88 return $this->cache[$user];