public function parse($sddl)
{
if (!preg_match(self::MATCH_SDDL, (string) $sddl, $matches)) {
throw new SddlParserException('The SDDL string is not valid.');
}
$sd = (new SecurityDescriptor())->setOwner($this->getSid($matches[1], 'owner'))->setGroup($this->getSid($matches[2], 'group'));
$this->parseAcl(strtoupper($matches[4]), $matches[5], $sd);
if (isset($matches[7])) {
$this->parseAcl(strtoupper($matches[7]), $matches[8], $sd);
}
return $sd;
}