protected function getSubstringBetweenParentheses($string)
{
$startingPosition = 0;
$openParentheses = 0;
$substring = '';
for ($i = $startingPosition; $i < strlen($string); $i++) {
if ($string[$i] === ')') {
$openParentheses--;
}
if ($openParentheses > 0) {
$substring .= $string[$i];
}
if ($string[$i] === '(') {
$openParentheses++;
}
}
if ($openParentheses < 0) {
throw new InvalidPointcutExpressionException('Pointcut expression is in excess of ' . abs($openParentheses) . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966689);
}
if ($openParentheses > 0) {
throw new InvalidPointcutExpressionException('Pointcut expression lacks of ' . $openParentheses . ' closing parenthesis/es, defined in ' . $this->sourceHint, 1168966690);
}
return $substring;
}