src/Routing/Adapter/Lumen.php
protected function breakUriSegments($uri)
    {
        if (! Str::contains($uri, '?}')) {
            return (array) $uri;
        }

        $segments = preg_split(
            '/\/(\{.*?\})/',
            preg_replace('/\{(.*?)\?\}/', '{$1}', $uri),
            -1,
            PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
        );

        $uris = [];

        while ($segments) {
            $uris[] = implode('/', $segments);

            array_pop($segments);
        }

        return $uris;
    }
protected function breakUriSegments($uri)
    {
        if (! Str::contains($uri, '?}')) {
            return (array) $uri;
        }

        $segments = preg_split(
            '/\/(\{.*?\})/',
            preg_replace('/\{(.*?)\?\}/', '{$1}', $uri),
            -1,
            PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY
        );

        $uris = [];

        while ($segments) {
            $uris[] = implode('/', $segments);

            array_pop($segments);
        }

        return $uris;
    }
protected function breakUriSegments ( $ uri ) { if ( ! Str :: contains ( $ uri , '?}' ) ) { return ( array ) $ uri ; } $ segments = preg_split ( '/\/(\{.*?\})/' , preg_replace ( '/\{(.*?)\?\}/' , '{$1}' , $ uri ) , - 1 , PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ) ; $ uris = [ ] ; while ( $ segments ) { $ uris [ ] = implode ( '/' , $ segments ) ; array_pop ( $ segments ) ; } return $ uris ; }
Break a URI that has optional segments into individual URIs.

@param string $uri

@return array
Break a URI that has optional segments into individual URIs .