determines whether role: name1 inherits role: name2.
domain is a prefix to the roles.

@param string $name1
@param string $name2
@param mixed  ...$domain

@return bool

@throws CasbinException
767452
public function hasLink($name1, $name2, ...$domain)
    {
        if (1 == \count($domain)) {
            $name1 = $domain[0].'::'.$name1;
            $name2 = $domain[0].'::'.$name2;
        } elseif (\count($domain) > 1) {
            throw new CasbinException('error: domain should be 1 parameter');
        }

        if ($name1 == $name2) {
            return true;
        }

        if (!$this->hasRole($name1) || !$this->hasRole($name2)) {
            return false;
        }

        $role1 = $this->createRole($name1);

        return $role1->hasRole($name2, $this->maxHierarchyLevel);
    }
53470
public boolean addRoleForUserInDomain(String user, String role, String domain) {
        return addGroupingPolicy(user, role, domain);
    }
626961
public function setDomain($domain)
    {
        if (is_string($domain)) {
            $this->domain = $domain;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($domain) . "' for argument 'domain' given. String expected."
            );
        }
    }
639403
public function inherit($roles, $inherits) {

		if(true === is_string($roles)) {
			$roles = [$roles];
		}

		if(true === is_string($inherits)) {
			$inherits = [$inherits];
		}

		if(false === is_array($roles)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($roles)), E_USER_ERROR);
		}

		if(false === is_array($inherits)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string or array, "%s" given', __METHOD__, gettype($inherits)), E_USER_ERROR);
		}

		foreach($inherits as $inherit) {

			if(true === isset($this -> permissions[$inherit])) {

				foreach($this -> permissions[$inherit] as $resource => $allowed) {

					foreach($roles as $role) {
						$this -> fill($role, $resource, $allowed);
					}
				}

			}
		}

		return $this; 
	}
775895
public function setDomain(?string $domain) : void
    {
        $this->domain = (($domain === null) ? null : strtolower($domain));
    }
489383
public function isAuthority($domain): bool
    {
        foreach ($this->resolvers as $resolver) {
            if ($resolver->isAuthority($domain)) {
                return true;
            }
        }

        return false;
    }
842208
public static function has($name) {
		if(empty($name)) {
			throw new InvalidArgumentException('Domain name can not be empty!');
		}
		if(!\App::$domain->has($name)) {
			return false;
		}
		$domain = \App::$domain->get($name);
		if(!$domain instanceof Domain) {
			return false;
		}
		return true;
	}
454868
public function useDomain($domain)
    {
        $old = $this->_currentDomain;
        $this->_currentDomain = $domain;
        textdomain($domain);
        return $old;
    }
130035
public function get($name = null, $domain = null, $method = '*')
    {
        if (is_null($name)) {
            return $this->item;
        }

        $name = strtolower($name);
        $method = strtolower($method);

        if (isset($this->item[$name])) {
            if (is_null($domain)) {
                $result = $this->item[$name];
            } else {
                $result = [];
                foreach ($this->item[$name] as $item) {
                    if ($item[2] == $domain && ('*' == $item[4] || $method == $item[4])) {
                        $result[] = $item;
                    }
                }
            }
        } else {
            $result = null;
        }

        return $result;
    }
301663
@Override
    public boolean hasLink(String name1, String name2, String... domain) {
        if (domain.length == 1) {
            name1 = domain[0] + "::" + name1;
            name2 = domain[0] + "::" + name2;
        } else if (domain.length > 1) {
            throw new Error("error: domain should be 1 parameter");
        }

        if (name1.equals(name2)) {
            return true;
        }

        if (!hasRole(name1) || !hasRole(name2)) {
            return false;
        }

        Role role1 = createRole(name1);
        return role1.hasRole(name2, maxHierarchyLevel);
    }
1100642
public function setDomain($domain) {
        if(!$this->setModified('domain', $domain)->isModified()) {
            return $this;
        }
        $this->domain = $domain;
        return $this;
    }
575835
protected function startScan($domain)
    {
        $result = $this->eye->api()->sslStart($domain);

        if (isset($result['multiple_ips']) && isset($result['token'])) {
            $result = $this->eye->api()->sslStart($domain, $result['multiple_ips'], $result['token']);
        }

        if (isset($result['error'])) {
            return $this->eye->logger()->error('SSL API scan error', $result['error'], $domain);
        }

        if (($result['status_id'] == "1") && (isset($result['job_id']))) {
            Cache::put('eyewitness_ssl_job_id_'.$domain, $result['job_id'], 50);
        } else {
            $this->eye->logger()->error('SSL API invalid result', print_r($result, true), $domain);
        }
    }
88005
private function getRootDomain($domain)
    {
        $domainParts = explode('.', $domain);
        $count       = count($domainParts);

        return $count > 1
            ? $domainParts[$count - 2].'.'.$domainParts[$count - 1]
            : $domainParts[0];
    }
494357
public function domain($domain, $protocol = null) {

		if(false === is_string($domain)) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($domain)), E_USER_ERROR);
		}

		//Check if identifier exists
		if(false === Router :: routeExists($this -> identifier, $domain)) {
			return trigger_error(sprintf('Identifier "%s" with domain "%s" does not exists', $this -> identifier, $domain), E_USER_ERROR);	
		}

		if(null !== $protocol && false === is_string($protocol)) {
			return trigger_error(sprintf('Argument 2 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($protocol)), E_USER_ERROR);
		}

		if(null === $protocol) {
			$protocol = Request :: getScheme();
		}

		$this -> domain = sprintf('%s://%s', $protocol, $domain);

		return $this;
	}
309613
public function getRoles($domain = false, $expanded = true)
    {
        $roles = [];

        if (!$this->tokenStorage->getToken()) {
            return $roles;
        }

        $this->iterateAdminRoles(function ($role, $isMaster) use ($domain, &$roles): void {
            if ($isMaster) {
                // if the user has the MASTER permission, allow to grant access the admin roles to other users
                $roles[$role] = $this->translateRole($role, $domain);
            }
        });

        $isMaster = $this->authorizationChecker->isGranted(
            $this->pool->getOption('role_super_admin', 'ROLE_SUPER_ADMIN')
        );

        // get roles from the service container
        foreach ($this->rolesHierarchy as $name => $rolesHierarchy) {
            if ($this->authorizationChecker->isGranted($name) || $isMaster) {
                $roles[$name] = $this->translateRole($name, $domain);
                if ($expanded) {
                    $result = array_map([$this, 'translateRole'], $rolesHierarchy, array_fill(0, \count($rolesHierarchy), $domain));
                    $roles[$name] .= ': '.implode(', ', $result);
                }
                foreach ($rolesHierarchy as $role) {
                    if (!isset($roles[$role])) {
                        $roles[$role] = $this->translateRole($role, $domain);
                    }
                }
            }
        }

        return $roles;
    }
887937
public function hasRole($name)
    {
        if (is_string($name)) {
            return collect($this->roles)->contains($name);
        }

        return (bool) collect($this->roles)->intersect($name->lists('name'))->count();
    }
771690
public function hasRole($name)
    {
        if (!$this->relationLoaded('role')) {
            $this->load('role');
        }

        return in_array($this->role->name, (is_array($name) ? $name : [$name]));
    }