aclProvider = $provider; return $this; } /** * @return ACLProvider */ public function getAclProvider() { if ($this->aclProvider instanceof ACLProvider) { return $this->aclProvider; } if (null === $this->aclProvider && $this instanceof \Pimple && $this->offsetExists('acl')) { $this->aclProvider = function () { return $this['acl']; }; } if (null === $this->aclProvider) { throw new \LogicException(ACLProvider::class . ' instance or locator was not set'); } $instance = call_user_func($this->aclProvider); if (!$instance instanceof ACLProvider) { throw new \LogicException(sprintf( 'Expects locator to return instance of "%s", got "%s"', ACLProvider::class, is_object($instance) ? get_class($instance) : gettype($instance) )); } $this->aclProvider = $instance; return $this->aclProvider; } /** * @param User $user * @return \ACL */ public function getAclForUser(User $user) { return $this->getAclProvider()->get($user); } }