aclProvider = $provider; return $this; } /** * @return ACLProvider */ public function getAclProvider() { if ($this->aclProvider instanceof ACLProvider) { return $this->aclProvider; } $locator = $this->aclProvider; if (null === $locator && $this instanceof \Pimple && $this->offsetExists('acl')) { $locator = function () { return $this['acl']; }; } if (null === $locator) { throw new \LogicException(ACLProvider::class . ' instance or locator was not set'); } $instance = $locator(); 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); } }