src/RouteResolver.php
public function getFromRequest($route = null) {
        $resolvers = [];
        foreach ($this->segmentsResolvers as $key => $resolverClass) {
            if( $bindedClass = request()->route($key) ) {
                $resolvers[$key] = new $resolverClass($bindedClass);
            }
        }
        // sort resolvers in same order they are in request
        if (!empty($resolvers)) {
            if (empty($route)) {
                $route = \Route::getCurrentRoute()->uri();
            }       
            $segments = explode('/', $route);
            $sortedResolvers = [];
            foreach($segments as $segment) {
                $segment = trim($segment, "{}");
                if (isset($resolvers [$segment])) {
                    $sortedResolvers[$segment] = $resolvers[$segment];
                }
            }
            $resolvers = $sortedResolvers;
        }
        return empty($resolvers) ? false  : $resolvers;
    }
public function getFromRequest($route = null) {
        $resolvers = [];
        foreach ($this->segmentsResolvers as $key => $resolverClass) {
            if( $bindedClass = request()->route($key) ) {
                $resolvers[$key] = new $resolverClass($bindedClass);
            }
        }
        // sort resolvers in same order they are in request
        if (!empty($resolvers)) {
            if (empty($route)) {
                $route = \Route::getCurrentRoute()->uri();
            }       
            $segments = explode('/', $route);
            $sortedResolvers = [];
            foreach($segments as $segment) {
                $segment = trim($segment, "{}");
                if (isset($resolvers [$segment])) {
                    $sortedResolvers[$segment] = $resolvers[$segment];
                }
            }
            $resolvers = $sortedResolvers;
        }
        return empty($resolvers) ? false  : $resolvers;
    }
public function getFromRequest ( $ route = null ) { $ resolvers = [ ] ; foreach ( $ this -> segmentsResolvers as $ key => $ resolverClass ) { if ( $ bindedClass = request ( ) -> route ( $ key ) ) { $ resolvers [ $ key ] = new $ resolverClass ( $ bindedClass ) ; } } // sort resolvers in same order they are in request if ( ! empty ( $ resolvers ) ) { if ( empty ( $ route ) ) { $ route = \ Route :: getCurrentRoute ( ) -> uri ( ) ; } $ segments = explode ( '/' , $ route ) ; $ sortedResolvers = [ ] ; foreach ( $ segments as $ segment ) { $ segment = trim ( $ segment , "{}" ) ; if ( isset ( $ resolvers [ $ segment ] ) ) { $ sortedResolvers [ $ segment ] = $ resolvers [ $ segment ] ; } } $ resolvers = $ sortedResolvers ; } return empty ( $ resolvers ) ? false : $ resolvers ; }
Test request and dynamically creates classes to resolve properties of binded class
@return [] of Crumby\RouteResolver\ParamResolver
Test request and dynamically creates classes to resolve properties of binded class