src/RouteResolver.php
public function resolveRouteItem($uriWithParam = null, $resolvers = null, $trailingSlash = false) {
        if (empty($uriWithParam)) {
            $uriWithParam = \Route::getCurrentRoute()->uri();
        }
        if (empty($resolvers)) {
            $resolvers = \RouteResolver::getFromRequest($uriWithParam);
        }
        $resolvedRoute = [];
          
        if (!empty($resolvers)) {
            foreach ($resolvers as $parameter => $resolver) {
                if ($resolver instanceof ParamResolver) {
                    if ($item = $resolver->item()) {
                        $urlCurrent = $uriWithParam;
                        if (isset($resolvedRoute['url'])) {
                            $urlCurrent = $resolvedRoute['url'];
                        }
                        // build real url
                        // last values of label overwrites previous
                        $resolvedRoute = [
                            'locale' => $resolver->locale($item),
                            'label' => $resolver->label($item),
                            'url' => str_replace('{'. $parameter . '}', $resolver->segment($item), $urlCurrent)
                            ];
                    }
                }
                else {
                    throw new \Exception("Resolver has to implement of 'Crumby\RouteResolver\Contracts\ParamResolver', " .  get_class($resolver) . "  given.");
                }
            }
        }  

        /**
         * fix trailng slash
         */
        if ($trailingSlash && isset($resolvedRoute['url'])) {
            $resolvedRoute['url'] = '/' . ltrim($resolvedRoute['url'], '/');
        }
        return empty($resolvedRoute) ? false : $resolvedRoute;   
    }
public function resolveRouteItem($uriWithParam = null, $resolvers = null, $trailingSlash = false) {
        if (empty($uriWithParam)) {
            $uriWithParam = \Route::getCurrentRoute()->uri();
        }
        if (empty($resolvers)) {
            $resolvers = \RouteResolver::getFromRequest($uriWithParam);
        }
        $resolvedRoute = [];
          
        if (!empty($resolvers)) {
            foreach ($resolvers as $parameter => $resolver) {
                if ($resolver instanceof ParamResolver) {
                    if ($item = $resolver->item()) {
                        $urlCurrent = $uriWithParam;
                        if (isset($resolvedRoute['url'])) {
                            $urlCurrent = $resolvedRoute['url'];
                        }
                        // build real url
                        // last values of label overwrites previous
                        $resolvedRoute = [
                            'locale' => $resolver->locale($item),
                            'label' => $resolver->label($item),
                            'url' => str_replace('{'. $parameter . '}', $resolver->segment($item), $urlCurrent)
                            ];
                    }
                }
                else {
                    throw new \Exception("Resolver has to implement of 'Crumby\RouteResolver\Contracts\ParamResolver', " .  get_class($resolver) . "  given.");
                }
            }
        }  

        /**
         * fix trailng slash
         */
        if ($trailingSlash && isset($resolvedRoute['url'])) {
            $resolvedRoute['url'] = '/' . ltrim($resolvedRoute['url'], '/');
        }
        return empty($resolvedRoute) ? false : $resolvedRoute;   
    }
public function resolveRouteItem ( $ uriWithParam = null , $ resolvers = null , $ trailingSlash = false ) { if ( empty ( $ uriWithParam ) ) { $ uriWithParam = \ Route :: getCurrentRoute ( ) -> uri ( ) ; } if ( empty ( $ resolvers ) ) { $ resolvers = \ RouteResolver :: getFromRequest ( $ uriWithParam ) ; } $ resolvedRoute = [ ] ; if ( ! empty ( $ resolvers ) ) { foreach ( $ resolvers as $ parameter => $ resolver ) { if ( $ resolver instanceof ParamResolver ) { if ( $ item = $ resolver -> item ( ) ) { $ urlCurrent = $ uriWithParam ; if ( isset ( $ resolvedRoute [ 'url' ] ) ) { $ urlCurrent = $ resolvedRoute [ 'url' ] ; } // build real url // last values of label overwrites previous $ resolvedRoute = [ 'locale' => $ resolver -> locale ( $ item ) , 'label' => $ resolver -> label ( $ item ) , 'url' => str_replace ( '{' . $ parameter . '}' , $ resolver -> segment ( $ item ) , $ urlCurrent ) ] ; } } else { throw new \ Exception ( "Resolver has to implement of 'Crumby\RouteResolver\Contracts\ParamResolver', " . get_class ( $ resolver ) . "  given." ) ; } } } /**
         * fix trailng slash
         */ if ( $ trailingSlash && isset ( $ resolvedRoute [ 'url' ] ) ) { $ resolvedRoute [ 'url' ] = '/' . ltrim ( $ resolvedRoute [ 'url' ] , '/' ) ; } return empty ( $ resolvedRoute ) ? false : $ resolvedRoute ; }
Resolves route Locale, Label, Url

@param string $uriWithParam
@param [] $resolvers  Assosiative array, where key is dynamic parameter name, value is Crumby\RouteResolver\ParamResolver
@param boolean $trailingSlash If url starts from trailing slash
@return [] | false :
[   'locale' => string,
'label' => string,
'url' => string
];
@throws \Exception
Resolves route Locale Label Url