/**
* @param string $ace
*/
protected function decodeFromBinary($ace)
{
$ace = bin2hex($ace);
$this->type = new AceType(hexdec(substr($ace, 0, 2)));
$this->flags = new AceFlags(hexdec(substr($ace, 2, 2)));
$this->aceRights = new AceRights($this->hexSLong32Be2Int(substr($ace, 8, 8)));
// If this is an object-specific ACE type, then it contains additional object GUID(s) and flags...
$position = 16;
if (substr(array_search($this->type->getValue(), AceType::TYPE), -strlen("OBJECT")) === "OBJECT") {
$this->objectFlags = new AceObjectFlags($this->hexULong32Le2int(substr($ace, 16, 8)));
$position += 8;
if ($this->objectFlags->has(AceObjectFlags::FLAG['OBJECT_TYPE_PRESENT'])) {
$this->objectType = new GUID(hex2bin(substr($ace, $position, 32)));
$position += 32;
}
if ($this->objectFlags->has(AceObjectFlags::FLAG['INHERITED_OBJECT_TYPE_PRESENT'])) {
$this->inheritedObjectType = new GUID(hex2bin(substr($ace, $position, 32)));
$position += 32;
}
}
$this->trustee = new SID(hex2bin(substr($ace, $position)));
$position += strlen(bin2hex($this->trustee->toBinary()));
$size = $this->hexUShort16Le2Int(substr($ace, 4, 4));
if ($position < $size * 2) {
$this->applciationData = hex2bin(substr($ace, $position));
}
}