Scalr\Model\Entity\WebhookEndpoint::getScope PHP Метод

getScope() публичный Метод

См. также: Scalr\DataType\ScopeInterface::getScope()
public getScope ( )
    public function getScope()
    {
        switch ($this->level) {
            case self::LEVEL_ENVIRONMENT:
                return self::SCOPE_ENVIRONMENT;
            case self::LEVEL_ACCOUNT:
                return self::SCOPE_ACCOUNT;
            case self::LEVEL_SCALR:
                return self::SCOPE_SCALR;
            default:
                throw new \UnexpectedValueException(sprintf("Unknown level type: %d in %s::%s", $this->level, get_class($this), __FUNCTION__));
        }
    }

Usage Example

Пример #1
0
 /**
  * @param WebhookEndpoint $endpoint
  * @throws Exception
  */
 private function canEditEndpoint($endpoint)
 {
     return $this->request->getScope() == $endpoint->getScope() && ($endpoint->getScope() == WebhookEndpoint::SCOPE_SCALR || $endpoint->getScope() == WebhookEndpoint::SCOPE_ACCOUNT && $endpoint->accountId == $this->user->getAccountId() || $endpoint->getScope() == WebhookEndpoint::SCOPE_ENVIRONMENT && $endpoint->envId == $this->getEnvironmentId() && $endpoint->accountId == $this->user->getAccountId());
 }
All Usage Examples Of Scalr\Model\Entity\WebhookEndpoint::getScope