LdapTools\Security\SddlParser::getSid PHP Method

getSid() protected method

protected getSid ( string $sid, string $type ) : SID
$sid string
$type string
return SID
    protected function getSid($sid, $type)
    {
        $sid = strtoupper($sid);
        // This is a SID short name, or explicit SID, that requires no domain SID lookup...
        if (array_key_exists($sid, SID::SHORT_NAME) || LdapUtilities::isValidSid($sid)) {
            $sid = new SID($sid);
            // This is a SID that requires a domain SID or root domain SID lookup...
        } elseif (array_key_exists($sid, SID::SHORT_NAME_DOMAIN) || array_key_exists($sid, SID::SHORT_NAME_ROOT_DOMAIN)) {
            $sid = $this->getWellKnownDomainSid($sid, array_key_exists($sid, SID::SHORT_NAME_ROOT_DOMAIN));
        } else {
            throw new SddlParserException(sprintf('The value "%s" is not a valid SID for the %s.', $sid, $type));
        }
        return $sid;
    }