private function setBounds(&$segments) {
        for ($i = 0, $count = count($segments); $i < $count; ++$i) {
            if ($segments[$i]->optional && $i - 1 >= 0) {
                $optional = true;

                for ($j = $i + 1; $j < $count; ++$j) {
                    if (!$segments[$j]->optional) {
                        $optional = false;
                        break;
                    }
                }

                if ($optional) {
                    $segments[$i - 1]->preEnd = true;
                }
                else {
                    for (--$j, $jc = $i - 1; $j >= $jc; --$j) {
                        $segments[$j]->optional = false;
                    }
                }
            }

            if ($i + 1 == $count) {
                $segments[$i]->end = true;
            }
        }
    }
private function setBounds(&$segments) {
        for ($i = 0, $count = count($segments); $i < $count; ++$i) {
            if ($segments[$i]->optional && $i - 1 >= 0) {
                $optional = true;

                for ($j = $i + 1; $j < $count; ++$j) {
                    if (!$segments[$j]->optional) {
                        $optional = false;
                        break;
                    }
                }

                if ($optional) {
                    $segments[$i - 1]->preEnd = true;
                }
                else {
                    for (--$j, $jc = $i - 1; $j >= $jc; --$j) {
                        $segments[$j]->optional = false;
                    }
                }
            }

            if ($i + 1 == $count) {
                $segments[$i]->end = true;
            }
        }
    }
private function setBounds ( & $ segments ) { for ( $ i = 0 , $ count = count ( $ segments ) ; $ i < $ count ; ++ $ i ) { if ( $ segments [ $ i ] -> optional && $ i - 1 >= 0 ) { $ optional = true ; for ( $ j = $ i + 1 ; $ j < $ count ; ++ $ j ) { if ( ! $ segments [ $ j ] -> optional ) { $ optional = false ; break ; } } if ( $ optional ) { $ segments [ $ i - 1 ] -> preEnd = true ; } else { for ( -- $ j , $ jc = $ i - 1 ; $ j >= $ jc ; -- $ j ) { $ segments [ $ j ] -> optional = false ; } } } if ( $ i + 1 == $ count ) { $ segments [ $ i ] -> end = true ; } } }
Marks the boundaries.

@param RouteSegment[] &$segments Segments to processing.

@return void
Marks the boundaries .