src/Robo/Commands/Blt/AliasCommand.php
protected function getClosingBracketPosition($contents, $start_pos) {
    $brackets = ['{'];
    for ($pos = $start_pos; $pos < strlen($contents); $pos++) {
      $char = substr($contents, $pos, 1);
      if ($char == '{') {
        array_push($brackets, $char);
      }
      elseif ($char == '}') {
        array_pop($brackets);
      }
      if (count($brackets) == 0) {
        return $pos;
      }
    }

    return NULL;
  }
protected function getClosingBracketPosition($contents, $start_pos) {
    $brackets = ['{'];
    for ($pos = $start_pos; $pos < strlen($contents); $pos++) {
      $char = substr($contents, $pos, 1);
      if ($char == '{') {
        array_push($brackets, $char);
      }
      elseif ($char == '}') {
        array_pop($brackets);
      }
      if (count($brackets) == 0) {
        return $pos;
      }
    }

    return NULL;
  }
protected function getClosingBracketPosition ( $ contents , $ start_pos ) { $ brackets = [ '{' ] ; for ( $ pos = $ start_pos ; $ pos < strlen ( $ contents ) ; $ pos ++ ) { $ char = substr ( $ contents , $ pos , 1 ) ; if ( $ char == '{' ) { array_push ( $ brackets , $ char ) ; } elseif ( $ char == '}' ) { array_pop ( $ brackets ) ; } if ( count ( $ brackets ) == 0 ) { return $ pos ; } } return NULL ; }
Find the position of a closing bracket for a given stanza in a string.

@param $contents
The string containing the brackets.
@param int $start_pos
The position of the opening bracket in the string that should be matched.

@return int|null
Find the position of a closing bracket for a given stanza in a string .