private static function extractAttributesFromSegment($url, $path, $i, $j, $segment, &$attributes)
    {
        // Required parameters
        if (preg_match('/{[\w]+}/', $segment)) {
            $attributeName              = preg_replace(['/{/', '/\?/', '/}/'], '', $segment);
            $attributes[$attributeName] = $url[$i];
        }

        // Optional parameter
        if (
            preg_match('/{[\w]+\?}/', $segment) &&
            ( ! isset($path[$j + 1]) || $path[$j + 1] !== $url[$i])
        ) {
            $attributeName              = preg_replace(['/{/', '/\?/', '/}/'], '', $segment);
            $attributes[$attributeName] = $url[$i];
        }
    }
private static function extractAttributesFromSegment($url, $path, $i, $j, $segment, &$attributes)
    {
        // Required parameters
        if (preg_match('/{[\w]+}/', $segment)) {
            $attributeName              = preg_replace(['/{/', '/\?/', '/}/'], '', $segment);
            $attributes[$attributeName] = $url[$i];
        }

        // Optional parameter
        if (
            preg_match('/{[\w]+\?}/', $segment) &&
            ( ! isset($path[$j + 1]) || $path[$j + 1] !== $url[$i])
        ) {
            $attributeName              = preg_replace(['/{/', '/\?/', '/}/'], '', $segment);
            $attributes[$attributeName] = $url[$i];
        }
    }
private static function extractAttributesFromSegment ( $ url , $ path , $ i , $ j , $ segment , & $ attributes ) { // Required parameters if ( preg_match ( '/{[\w]+}/' , $ segment ) ) { $ attributeName = preg_replace ( [ '/{/' , '/\?/' , '/}/' ] , '' , $ segment ) ; $ attributes [ $ attributeName ] = $ url [ $ i ] ; } // Optional parameter if ( preg_match ( '/{[\w]+\?}/' , $ segment ) && ( ! isset ( $ path [ $ j + 1 ] ) || $ path [ $ j + 1 ] !== $ url [ $ i ] ) ) { $ attributeName = preg_replace ( [ '/{/' , '/\?/' , '/}/' ] , '' , $ segment ) ; $ attributes [ $ attributeName ] = $ url [ $ i ] ; } }
Extract attribute from a segment.

@param  array   $url
@param  array   $path
@param  int     $i
@param  int     $j
@param  string  $segment
@param  array   $attributes
Extract attribute from a segment .