// This suggests there's a bug in code using this class.
throw new \
LogicException('preSave() is called again without calling postSave() or releaseThreadLock()'
);
} if (!
$this->
hasParentComment()) { // This is a comment with no parent comment (depth 0): we start
// by retrieving the maximum thread level.
$max =
$storage->
getMaxThread($this);
// Strip the "/" from the end of the thread.
$max =
rtrim((string) $max, '/'
);
// We need to get the value at the correct depth.
$parts =
explode('.',
$max);
$n = Number::
alphadecimalToInt($parts[0
]);
$prefix = '';
} else { // This is a comment with a parent comment, so increase the part of
// the thread value at the proper depth.
// Get the parent comment:
$parent =
$this->
getParentComment();
// Strip the "/" from the end of the parent thread.
$parent->
setThread((string) rtrim((string) $parent->
getThread(), '/'
));
$prefix =
$parent->
getThread() . '.';